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
_NET_ACTIVE_WINDOW: invalidate focus to force SetInputFocus call #3027
Conversation
The sender of the _NET_ACTIVE_WINDOW client message might know better when to set focus than i3, as i3 does not know about unmanaged (override_redirect=1) windows. related to i3/i3lock#35
When grabbing the pointer/keyboard fails, a new code path is activated, which: 1. Uses the standards-compliant _NET_ACTIVE_WINDOW root window property to determine the window to restore focus to. 2. Sets the input focus to the i3lock window, effectively force-closing any open context menus (tested with Google Chrome). 3. Upon exiting, restores focus to the window from step ① by sending a _NET_ACTIVE_WINDOW ClientMessage to the root window. Note that this step requires i3/i3#3027 in i3 to not mess up focus. fixes i3#35
I don't understand this change. This path is never reached for unmanaged windows? |
Correct, and it doesn’t need to be. In i3lock, we’re using the _NET_ACTIVE_WINDOW ClientMessage on the managed window which had focus before i3lock took it. Without this change, though, i3 won’t send a SetInputFocus request, because it didn’t notice the focus changes by the unmanaged window. |
IMHO we are supporting broken client behavior with this change, just that in this case the broken client is i3lock. The reason we need this change is because the client caused us to be out of sync. Wouldn't a correct fix to avoid running out of sync, e.g., by processing FocusOut events? Openbox seems to do this, but unfortunately it is rather involved since one has to coordinate with FocusIn events. But I think I've already lost the argument that we are turning i3lock into a broken client, so let's move on. At the very least the one positive thing about this change is that it's a safety net for when the request originates not from the broken client, but somewhere else. |
When grabbing the pointer/keyboard fails, a new code path is activated, which: 1. Uses the standards-compliant _NET_ACTIVE_WINDOW root window property to determine the window to restore focus to. 2. Sets the input focus to the i3lock window, effectively force-closing any open context menus (tested with Google Chrome). 3. Upon exiting, restores focus to the window from step ① by sending a _NET_ACTIVE_WINDOW ClientMessage to the root window. Note that this step requires i3/i3#3027 in i3 to not mess up focus. fixes i3#35
IIUC, maintaining sync would result in 1 fewer force-focus at the expense of more complicated code paths. If it turns out that this 1 force-focus is a problem, we can always switch to the maintain-sync approach :). |
When grabbing the pointer/keyboard fails, a new code path is activated, which: 1. Uses the standards-compliant _NET_ACTIVE_WINDOW root window property to determine the window to restore focus to. 2. Sets the input focus to the i3lock window, effectively force-closing any open context menus (tested with Google Chrome). 3. Upon exiting, restores focus to the window from step ① by sending a _NET_ACTIVE_WINDOW ClientMessage to the root window. Note that this step requires i3/i3#3027 in i3 to not mess up focus. fixes i3#35
When grabbing the pointer/keyboard fails, a new code path is activated, which: 1. Uses the standards-compliant _NET_ACTIVE_WINDOW root window property to determine the window to restore focus to. 2. Sets the input focus to the i3lock window, thereby possibly force-closing open context menus (works with e.g. Google Chrome, does not work with e.g. thunar, gedit). 3. Upon exiting, restores focus to the window from step ① by sending a _NET_ACTIVE_WINDOW ClientMessage to the root window. Note that this step requires i3/i3#3027 in i3 to not mess up focus. fixes i3#35
When grabbing the pointer/keyboard fails, a new code path is activated, which: 1. Uses the standards-compliant _NET_ACTIVE_WINDOW root window property to determine the window to restore focus to. 2. Sets the input focus to the i3lock window, thereby possibly force-closing open context menus (works with e.g. Google Chrome, does not work with e.g. thunar, gedit). 3. Upon exiting, restores focus to the window from step ① by sending a _NET_ACTIVE_WINDOW ClientMessage to the root window. Note that this step requires i3/i3#3027 in i3 to not mess up focus. fixes #35
When grabbing the pointer/keyboard fails, a new code path is activated, which: 1. Uses the standards-compliant _NET_ACTIVE_WINDOW root window property to determine the window to restore focus to. 2. Sets the input focus to the i3lock window, thereby possibly force-closing open context menus (works with e.g. Google Chrome, does not work with e.g. thunar, gedit). 3. Upon exiting, restores focus to the window from step ① by sending a _NET_ACTIVE_WINDOW ClientMessage to the root window. Note that this step requires i3/i3#3027 in i3 to not mess up focus. fixes i3#35
The sender of the _NET_ACTIVE_WINDOW client message might know better when to
set focus than i3, as i3 does not know about unmanaged (override_redirect=1)
windows.
related to i3/i3lock#35