-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Fix window focus stack #742
Conversation
I am in worry, that we run again in strange window switching foreground/background behavior with your PR. |
Well, i can reproduce #647
But your PR doesn't fix the issue on my box. |
Hmm, |
I've tried a new vm with Ubuntu MATE 22.04. I just noticed that I don't get this issue with any pre-installed programs but it does happen when opening for example 1. mate 22.04 stock - previous window active only after click.webm |
One more thing to watch out for is that mate-netbook/maximus breaks the window focus/active states in a similar way (but when opening or unmaximising windows), so make sure that's not running. I'd like to look into that too at some point. I think mate-netbook used to be installed by default, so I wonder if that could have been actually the root cause of the focus issues back then. |
On a fresh fedora 36 vm I get pretty much the same issue, with one minor difference though is that I can't type in the un-focused window, unlike on ubuntu. But this PR fixes it the same way on fedora as well. |
I'll see if I can make this work without reverting that commit. I was just happy that I managed to make it work correctly after upgrading to 22.04 (from 18.04), but I guess there should be a better way to fix this. |
I've found another way to fix this at https://github.com/mate-desktop/marco/blob/v1.26.0/src/core/display.c#L2223 by matching not just When I open from the terminal and then close an app e.g. Would changing that make more sense? So that |
2abf33f
to
42de4f5
Compare
I've updated the PR with the (Btw, very rarely, maybe one out of 50 tries the focus is still not regained. After adding some logging it appears that |
@mate-desktop/core-team |
I normally use compiz so #647 is not something I would notice in quick marco tests if it is intermittant. I was unable to duplicate the issue with two Pluma windows open,moving focus from one to the other. On closing the pluma window I had just moved focus to, focus returned to the previous pluma window. For this test I used marco with compositng ON, and never at any time have I turned on focus follows mouse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I was NOT able to duplicate the issue in a quick test, I didn't get any ugly surprises with this either. Again,note that in my normal workflow I use compiz so I would not see an intermittant issue.
Also I cannot test whether this fixes #301 as I have neither snappy nor flatpack installed |
Ok, with you gitk example the foreground problem is reproducible for me now. But it isn't the focus which is broken. The problem is that the window has focus but it isn't in the foreground. |
When opening and then closing certain applications the focus was correctly regained by the previous window but it wasn't brought into the foreground. To fix this we call meta_workspace_focus_default_window() for both NotifyDetailNone and NotifyPointerRoot. These two are always mentioned together in the X docs: https://tronche.com/gui/x/xlib/events/input-focus/normal-and-grabbed.html Some programs will have NotifyDetailNone when closed, while others end up with NotifyPointerRoot.
42de4f5
to
c9e1150
Compare
Yep, that makes sense. I've just reworded the commit message. |
Can you reproduce that problem with |
When I apply this patch to |
I noticed another fix by this commit. |
Is this ready to go or is more work/review needed? |
That code was added to handle specific case. I doubt that your problem is caused by X protocol, so debug message now likely will be lies in some cases. Adding |
OK, I will wait on this for others to weigh in or more work to be done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,
Commit runs fine since several days and fixes several issues.
Ready to go for me.
A potentially difficult follow-on question. Do we have a way to track when this change appears in various distros' repositories? Building from source is not an option for [most] non-developers. Building like that also introduces local "which version is installed" issues, like when the local distro update overrides with whatever old version is in their repository. For me, recent Ubuntu flavours would be interesting, but Linuxmint (version 21, latest, presently) is of primary interest. I know that tracking downstream adoption is probly outside the scope here, so please be kind with any responses. Thank You. Or... is it possible to provide a .deb package out of this github project (and could an end user trust it ;-)? I'd be willing to test in situ (Linuxmint 21) then report back. |
A .deb package could be broken at any time by a change in an underlying library which would require recompilation. We would have to maintain that, and I can tell you from personal experience with my own custom built .debs that that happens far more often than underlying code changes that force source code changes. On Debian Unstable this can happen at any time, and there are also testing and stable to deal with, plus Ubuntu, plus Mint, etc |
This reverts f96255beb (except for some unnecessary whitespace changes) to fix #647
I've been using this for a few days and had no issues at all. It works fine with multiple workspaces too.