-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wezterm does not always notice window resize #1992
Comments
Today, I built another set of binaries of version I found the reported issue only reproduced on the Gentoo machine and any resize-related problems were not found on the Arch Linux machine. I'm using i3-gaps of version 4.20.1 on both machines. So, some other difference(s) must be causing the issue. I will try different settings on Gentoo side. |
As the first step, I tried different Nvidia driver versions available on Gentoo. |
@wez BTW, I tried to modify source code and found only a couple of lines of change solved the problem although repaint is somewhat delayed when toggling fullscreen state. The change was made on top of bc7c838 as follows: diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs
index f2931fd5..c84bcd79 100644
--- a/window/src/os/x11/window.rs
+++ b/window/src/os/x11/window.rs
@@ -205,7 +205,7 @@ impl XWindowInner {
}
if let Some(resize) = resize.take() {
- self.dispatched_any_resize = true;
+ self.dispatched_any_resize = false;
self.events.dispatch(resize);
}
@@ -231,7 +231,7 @@ impl XWindowInner {
}
if !self.dispatched_any_resize {
- self.dispatched_any_resize = true;
+ self.dispatched_any_resize = false;
log::trace!(
"About to paint, but we've never dispatched a Resized \
I tested 4 patterns of combinations of boolean values, only setting both to false helped. Of course, we have not understood the actual cause yet, however, I believe we have confirmed that the window manager is giving the window a resize notification. |
I think the root cause is that your WM isn't sending resize events consistently. The change that you've sketched out pessimizes painting by requiring that wezterm ask the X server for the dimensions prior to every paint. I think that makes sense for this situation, but I'd prefer to only use it when we can't trust the WM. Have you considered filing a bug report with the i3-gaps folks to see if they can fix this at the source? |
OK, I understand what those changes actually mean.
Yes, but I'm not sure if it is really caused by i3-gaps because wezterm works well with i3-gaps on my Arch machine. I will continue my investigation on the difference between my machines and report here when I find something important. |
I found using Nouveau driver instead of Nvidia's proprietary one fixes the issue. Other things I have tried but did not work:
Now I'm a bit more confident with the irrelevance of window manager to this issue. Since Nouveau's performance is not good on my GeForce GTX 1070, I don't want to solve the issue by switching the driver. EDIT: It seems that |
I recently noticed that the window_padding on window-resized events are no longer called on my macOS, so maybe this is related. |
I am noticing resize related problems on WindowMaker window manager on Ubuntu 20.04. I tested this scenario with git bisect:
Git bisect had a bunch of commits that needed to be skipped due to e.g.:
At the end:
|
I think this is also related (but I've not explicitly tested if it's the same commit that introduced the issue). If I minimize a wezterm window and then unminimize it, the cursor is hollow (indicating it doesn't have focus, although keypresses etc actually do go there). |
I have the same issue, on Awesome WM + nvidia drivers. Problem for me is that I'm on a new machine, so everything installed the latest versions at the same time and I'm not sure which package "caused" this. Could be the latest nightly, or the latest version of nvidia drivers. |
This commit: * Logs atom names in property change events (makes it easier to understand user's logs) * Sets flags in cases where property changes might imply that a configure or focus event should have or should be sent * Adjusts the "unsure about state" logic so that it doesn't just trigger on the initial paint, but also on those flags being set refs: #1992
I just pushed a commit that may help with this; could you give it a try when you have a chance? It should show up in a nightly build within about 20 minutes from now. If you prefer to use packages provided by your distribution or package manager of choice and don't want to replace that with a nightly download, keep in mind that you can download portable packages (eg: a If you are eager and can build from source then you may be able to try this out more quickly. |
I built from source and tested. Unfortunately, no change for my test described in #1992 (comment) Edit: I also tested using the __EGL_VENDOR_LIBRARY_FILENAMES define mentioned in #1992 (comment) and can confirm setting that variable as described does fix the issue (although there is a weird flicker upon resize). I am using nvidia driver version 470.129.06 |
@wez Are you sure? My issue is not just painting related. When I run the last of the steps described above to reproduce the bug, (opening the launcher when the window has been sized to a quarter of the screen), the launcher itself thinks the size of the window is full screen rather than quarter screen (you can still move the selected item up and down, although most of the time it's not visible until you move down enough items), so wezterm has the wrong idea of the size. Setting the EGL variable somehow makes this test ensure that wezterm has the correct size. |
@wez Sorry for my late reply because I was quite busy recently. |
@wez I compared binaries that I built from the latest commit 9270e3b and from the first reported commit 64b6e63. |
From the logs shared in #2063 (comment) it looks like focus change events can correlate with the WM tiling windows, even though the WM doesn't send a CONFIGURE_NOTIFY event. So let's set a flag to query the geometry when the focus changes refs: #2063 refs: #1992
Main idea here is to add expose events to the trace so that we can get a sense of whether those are emitted when a WM isn't delivering CONFIGURE_NOTIFY consistently. If the exposed area is bigger than what we think the window is, then we mark geometry as unsure. I'm considering always marking as unsure for an expose event, or at least, adding a config option to enable that, as a way to workaround this situation. refs: #2063 refs: #1992
The hope here is that the nvidia-specific resize issue might have a workaround if it is emitting some other events that we were previously not listening for. This commit optionally enables the Present extension and listens for its version of CONFIGURE_NOTIFY, routing it through the same logic as the base CONFIGURE_NOTIFY event. On my AMD hardware under Gnome, I see something like: ``` 18:04:26.476 TRACE window::os::x11::window > Present::ConfigureNotify: width 1168 -> 1180, height 858 -> 873, dpi 124.7998046875 -> 124.7998046875 18:04:26.478 TRACE window::os::x11::window > Ignoring X::ConfigureNotify (1180x873 dpi=124.7998046875) because width,height,dpi are unchanged ``` with the Present event firing before the X event. Let's see how this goes. refs: #2063 refs: #1992
@wez Are you able to restore the missing commits that prevent earlier builds from being built from source? Builds between 2022-05-08 and 2022-05-10 complain about not being able to find: |
BTW, I built from source just now (after seeing your commit da59a22) and this seems to fix this issue for me - my test case has wezterm using the correct window size for the launcher when the window size is reduced. The only remaining niggle I can see is the hollow / solid cursor weirdness I mentioned above, where after I maximise the window I sometimes get a hollow cursor (even though the window has focus and accepts keystrokes). Moving focus out and back gives the expected solid cursor. |
done! |
Summarizing here the findings from over in #2063:
|
Also, with the restored commits I was able to complete the git bisect to confirm that abc42f7 was the commit that introduced the regression. |
@Lenbok could you summarize the difference in behavior you see between that rev and the one prior? I don't have a clear picture |
Well, that's weird! Thanks for confirming! |
Interestingly, it seems that I'm not completely sure that I have the same problem as reported in #1628, but I have found some common points. |
@yuttie are you saying that setting |
@wez No. I mean that both the problems #1628 and #1992 do not exist at b25d4d2 but do exist at abc42f7 (b25d4d2's child commit). I suspect abc42f7 introduced the problems. These issues might have the same root. |
This does two things: * Sets the event queue owner explicitly to xcb * Adopts a dri2 resize related workaround from the rust-xcb opengl example I think the latter is probably a NOP, but the former sounds like something important. refs: #1992
I took a look at the rust-xcb opengl example and adapted a couple of bits from it to wezterm's code base; could you give 1485cf3 a try when you have a chance? |
Great! |
@wez I also tried its parent commit 00e5b9a. Regarding #1628, I could reproduce the problem with binary built from 00e5b9a, and therefore it seems that those changes introduced by 1485cf3 solved the issue. On the other hand, regarding the present issue (#1992), I could not reproduce the problem with binary built from 00e5b9a. Is it possible for you to create a branch that reverts those workarounds related to #1992? |
I had the same problem. After window resize, wezterm does not accept keyboard input (mouse input still works). An error pops up when that happens: If related, I use Nvidia driver and fcitx IME. I didn't notice the issue was associated with window resize (because of titling window manager). Thanks for making wezterm awesome. |
This was the bit that I think made the difference: I'd suggest checking out abc42f7 and then adding that line; here's the relevant section of code in wezterm/window/src/os/x11/connection.rs Lines 360 to 369 in 5fb60de
Thanks for being thorough! |
@wez I'd like to say thank you for your time to develop and improve wezterm. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
What Operating System(s) are you seeing this problem on?
Linux X11
WezTerm version
20220514-175933-64b6e63f
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
Sometimes wezterm does not recognize its window resize.
Especially toggling fullscreen mostly does not work while resizing horizontally or vertically in a incremental fashion works a bit better.
Please watch my screen recording.
It seems that continuously (frequently) changing window size makes wezterm notice resize events, e.g., by using mouse or by holding keys for shrinking/enlarging a window or toggling fullscreen.
I tried both my window manager's key binding and wezterm's Alt+Enter to toggle fullscreen state.
I'm using i3, specifically i3-gaps v4.20.1, as the window manager on Gentoo Linux.
To Reproduce
Launch a wezterm and resize its window.
Configuration
no config
Expected Behavior
Resizing a terminal window should affect the terminal's content area size.
Logs
wezterm-20220514-175933-64b6e63f.log
wezterm-20220514-175933-64b6e63f.mp4
Anything else?
I bisected at release level and found that
WezTerm-20210502-154244-3f7122cb-Ubuntu16.04.AppImage
worked much better thanWezTerm-20210814-124438-54e29167-Ubuntu16.04.AppImage
.Although the former do fail to response to fullscreen toggle but much less frequently.
I've checked the release notes of the latter, it seems that the most relevant issue is only #695.
The text was updated successfully, but these errors were encountered: