Terminal window auto-resize leads to intability #3

Closed
opened 2 years ago by nikp123 · 6 comments
nikp123 commented 2 years ago

Great project, I've been enjoying using this terminal so far, however there are some issues regarding window resizing that prevent me from using this terminal as my default.

Setup:
2 monitors (one 1366x768 to the left at 1.25 scaling,
second 1080p on the right at 1.0 scaling)

How to reproduce:

  1. SwayWM with the above mentioned monitor config
  2. Drag window from 2nd (primary) monitor to the 1st or create the window on the 1st monitor

Issue(s):

  1. Window renders way past it's borders (perhaps x2 as much)
  2. Program fails with SIGSEGV on '_pixman_log_error'

Output log:

@(gdb) r
Starting program: /media/DATA/AUR/foot-git/src/foot/build/foot 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
info: config.c:658: loading configuration from /home/nikp123/.config/footrc
info: wayland.c:789: HDMI-A-1: 1920x1080+1092x0@60Hz 2343 (23.10", PPI=96x98, scale=1)
info: wayland.c:789: eDP-1: 1366x768+0x645@60Hz 0x0354 (13.23", PPI=124x128, scale=2)
info: wayland.c:824: cursor theme: (null), size: 24
info: terminal.c:482: using 4 rendering threads
[New Thread 0x7ffff704c700 (LWP 82237)]
[New Thread 0x7ffff684b700 (LWP 82238)]
[New Thread 0x7ffff604a700 (LWP 82239)]
[New Thread 0x7ffff5849700 (LWP 82240)]
info: wayland.c:1015: requesting SSD decorations
info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF.ttf: size=12.00pt/16px, dpi=96
info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Bold.ttf: size=12.00pt/16px, dpi=96
info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Italic.ttf: size=12.00pt/16px, dpi=96
info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Bold Italic.ttf: size=12.00pt/16px, dpi=96
info: terminal.c:526: cell width=8, height=17
[Detaching after fork from child process 82241]
info: wayland.c:625: using SSD decorations
info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF.ttf: size=12.00pt/16px, dpi=96
info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Bold.ttf: size=12.00pt/16px, dpi=96
info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Italic.ttf: size=12.00pt/16px, dpi=96
info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Bold Italic.ttf: size=12.00pt/16px, dpi=96
info: terminal.c:526: cell width=8, height=17
*** BUG ***
In pixman_region_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug


Thread 1 "foot" received signal SIGSEGV, Segmentation fault.
0x00007ffff7bd5af3 in ?? () from /usr/lib/libpixman-1.so.0
@(gdb) bt
#0  0x00007ffff7bd5af3 in ?? () from /usr/lib/libpixman-1.so.0
#1  0x00007ffff7c4a94e in pixman_fill () from /usr/lib/libpixman-1.so.0
#2  0x00007ffff7c4c226 in pixman_image_fill_boxes () from /usr/lib/libpixman-1.so.0
#3  0x00007ffff7c4c3d6 in pixman_image_fill_rectangles () from /usr/lib/libpixman-1.so.0
#4  0x00005555555781e6 in grid_render ()
#5  0x00007ffff7a2369a in ffi_call_unix64 () from /usr/lib/libffi.so.6
#6  0x00007ffff7a22fb6 in ffi_call () from /usr/lib/libffi.so.6
#7  0x00007ffff7bb4e92 in ?? () from /usr/lib/libwayland-client.so.0
#8  0x00007ffff7bb16c1 in ?? () from /usr/lib/libwayland-client.so.0
#9  0x00007ffff7bb2ccc in wl_display_dispatch_queue_pending () from /usr/lib/libwayland-client.so.0
#10 0x0000555555577514 in fdm_wayl ()
#11 0x00005555555727f4 in main ()
@(gdb) 

PS: I'm not sure how to rebuild with debug symbols so this is the best log I've got.

Great project, I've been enjoying using this terminal so far, however there are some issues regarding window resizing that prevent me from using this terminal as my default. Setup: 2 monitors (one 1366x768 to the left at 1.25 scaling, second 1080p on the right at 1.0 scaling) How to reproduce: 1. SwayWM with the above mentioned monitor config 2. Drag window from 2nd (primary) monitor to the 1st or create the window on the 1st monitor Issue(s): 1. Window renders way past it's borders (perhaps x2 as much) 2. Program fails with SIGSEGV on '_pixman_log_error' Output log: ``` @(gdb) r Starting program: /media/DATA/AUR/foot-git/src/foot/build/foot [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". info: config.c:658: loading configuration from /home/nikp123/.config/footrc info: wayland.c:789: HDMI-A-1: 1920x1080+1092x0@60Hz 2343 (23.10", PPI=96x98, scale=1) info: wayland.c:789: eDP-1: 1366x768+0x645@60Hz 0x0354 (13.23", PPI=124x128, scale=2) info: wayland.c:824: cursor theme: (null), size: 24 info: terminal.c:482: using 4 rendering threads [New Thread 0x7ffff704c700 (LWP 82237)] [New Thread 0x7ffff684b700 (LWP 82238)] [New Thread 0x7ffff604a700 (LWP 82239)] [New Thread 0x7ffff5849700 (LWP 82240)] info: wayland.c:1015: requesting SSD decorations info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF.ttf: size=12.00pt/16px, dpi=96 info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Bold.ttf: size=12.00pt/16px, dpi=96 info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Italic.ttf: size=12.00pt/16px, dpi=96 info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Bold Italic.ttf: size=12.00pt/16px, dpi=96 info: terminal.c:526: cell width=8, height=17 [Detaching after fork from child process 82241] info: wayland.c:625: using SSD decorations info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF.ttf: size=12.00pt/16px, dpi=96 info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Bold.ttf: size=12.00pt/16px, dpi=96 info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Italic.ttf: size=12.00pt/16px, dpi=96 info: fcft.c:451: /usr/share/fonts/TTF/TerminusTTF-Bold Italic.ttf: size=12.00pt/16px, dpi=96 info: terminal.c:526: cell width=8, height=17 *** BUG *** In pixman_region_init_rect: Invalid rectangle passed Set a breakpoint on '_pixman_log_error' to debug Thread 1 "foot" received signal SIGSEGV, Segmentation fault. 0x00007ffff7bd5af3 in ?? () from /usr/lib/libpixman-1.so.0 @(gdb) bt #0 0x00007ffff7bd5af3 in ?? () from /usr/lib/libpixman-1.so.0 #1 0x00007ffff7c4a94e in pixman_fill () from /usr/lib/libpixman-1.so.0 #2 0x00007ffff7c4c226 in pixman_image_fill_boxes () from /usr/lib/libpixman-1.so.0 #3 0x00007ffff7c4c3d6 in pixman_image_fill_rectangles () from /usr/lib/libpixman-1.so.0 #4 0x00005555555781e6 in grid_render () #5 0x00007ffff7a2369a in ffi_call_unix64 () from /usr/lib/libffi.so.6 #6 0x00007ffff7a22fb6 in ffi_call () from /usr/lib/libffi.so.6 #7 0x00007ffff7bb4e92 in ?? () from /usr/lib/libwayland-client.so.0 #8 0x00007ffff7bb16c1 in ?? () from /usr/lib/libwayland-client.so.0 #9 0x00007ffff7bb2ccc in wl_display_dispatch_queue_pending () from /usr/lib/libwayland-client.so.0 #10 0x0000555555577514 in fdm_wayl () #11 0x00005555555727f4 in main () @(gdb) ``` PS: I'm not sure how to rebuild with debug symbols so this is the best log I've got.
dnkl closed this issue 2 years ago
Owner

Hi, and thanks for the bug report!

I wasn't able to reproduce the crash, but did see the window size doubling when moving it between outputs with different scaling factors.

This is a setup I don't have, which explains why I hadn't noticed it.

In case latest master does not fix this issue for you, just reopen it :) It might be worth trying to figure out why it crashed for you but not for me.

PS: I'm not sure how to rebuild with debug symbols so this is the best log I've got.

You can clone this repo and follow the instructions in https://codeberg.org/dnkl/foot#user-content-other, but replace release with debug.

Hi, and thanks for the bug report! I wasn't able to reproduce the crash, but did see the window size doubling when moving it between outputs with different scaling factors. This is a setup I don't have, which explains why I hadn't noticed it. In case latest master does **not** fix this issue for you, just reopen it :) It might be worth trying to figure out why it crashed for you but not for me. > PS: I'm not sure how to rebuild with debug symbols so this is the best log I've got. You can clone this repo and follow the instructions in https://codeberg.org/dnkl/foot#user-content-other, but replace `release` with `debug`.
Poster

Thank you for fixing, however there's one more issue:

When the window is resized by moving the window to the other monitor, the font is improperly resized.

fxp. when i move the window from a monitor of x1 scale to x1.25 scale the font shrinks instead of growing

Should I post this as a new issue?

Thank you for fixing, however there's one more issue: When the window is resized by moving the window to the other monitor, the font is improperly resized. fxp. when i move the window from a monitor of x1 scale to x1.25 scale the font shrinks instead of growing Should I post this as a new issue?
Owner

This is actually expected, and a result of how non-integral scaling is implemented in Wayland compositors; when you set a scaling factor of 1.25 foot will see a scaling factor of 2x. The compositor will then down-scale the image rendered by foot.

Combine this with foot's auto-DPI feature and you get what you see - the font shrinks.

If you set your scaling factor to 2 instead of 1.25, it should work as intended (which is, no font resize at all - see https://codeberg.org/dnkl/foot#user-content-dpi-and-font-size).

There's really no good way to actually "fix" this. You could try explicitly setting the DPI in footrc (font=<fontname>:dpi=96) and see if that works better for you.

This is actually expected, and a result of how non-integral scaling is implemented in Wayland compositors; when you set a scaling factor of 1.25 foot will see a scaling factor of 2x. The compositor will then down-scale the image rendered by foot. Combine this with foot's auto-DPI feature and you get what you see - the font shrinks. If you set your scaling factor to 2 instead of 1.25, it should work as intended (which is, no font resize at all - see https://codeberg.org/dnkl/foot#user-content-dpi-and-font-size). There's really no good way to actually "fix" this. You could try explicitly setting the DPI in footrc (`font=<fontname>:dpi=96`) and see if that works better for you.
Poster

@dnkl Neither, dpi or pixelsize options seem to work. It resizes anyway

@dnkl Neither, dpi or pixelsize options seem to work. It resizes anyway
Owner

OK, thinking about it that actually makes sense - the main issue is still that Sway downscales the image when you move it to the 1.25-scaled monitor.

The only way I see this being solved is by taking the scale factor into account when scaling the font.

Since this is something you don't want for integral scale factors, and since there's no way for foot to detect a non-integral scale factor, it will most likely end up being a config option you have flip.

Let me experiment a bit and see what can be done about all this.

OK, thinking about it that actually makes sense - the main issue is still that Sway downscales the image when you move it to the 1.25-scaled monitor. The only way I see this being solved is by taking the scale factor into account when scaling the font. Since this is something you **don't** want for integral scale factors, and since there's no way for foot to detect a non-integral scale factor, it will most likely end up being a config option you have flip. Let me experiment a bit and see what can be done about all this.
Owner

Moved to #5

Moved to https://codeberg.org/dnkl/foot/issues/5
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.