Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upHard/impossible to give keyboard focus to override_redirect window opened while another VM was focused #2311
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Sep 13, 2016
Member
I see how does it break usability, but not giving direct way to steal
focus is one of our design goals for GUI virtualization... Any idea how
to handle it, without compromising this goal?
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
|
I see how does it break usability, but not giving direct way to steal Best Regards, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rustybird
Sep 13, 2016
I totally agree that the window should not be able to just steal the keyboard focus without user interaction, i.e. clicking on it. (Although xfwm currently doesn't seem to have any such inter-VM focus stealing prevention? If I run sleep 5; xev and focus another VM, the xev popup receives my keyboard input...)
Is it maybe just that when you click on the VM's window, xfwm (probably like other window managers) sees that it has override_redirect set and does not call XSetInputFocus() on it -- there's no FocusInEvent when window.py is run in dom0 --, and that doing so if the window belongs to a VM would be enough to fix this issue?
rustybird
commented
Sep 13, 2016
•
|
I totally agree that the window should not be able to just steal the keyboard focus without user interaction, i.e. clicking on it. (Although xfwm currently doesn't seem to have any such inter-VM focus stealing prevention? If I run Is it maybe just that when you click on the VM's window, xfwm (probably like other window managers) sees that it has override_redirect set and does not call |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rustybird
Sep 14, 2016
Ah, the window manager is totally out of the loop for override_redirect windows. I thought it was possible to "override the override".
So my second attempt was to modify xside.c to call XSetInputFocus() not only on windows with is_docked, but also on those with override_redirect. That fixes the issue, but has the side effect of making a main window lose focus (and not get it back automatically) if you click on one of its menu dropdowns; it also breaks the Firefox menu for some reason. And window type hints seem to be used too inconsistently for blacklisting to be viable.
What do you think of this approach:
- Keep track of
- windows requesting focus, and
- X11 clients grabbing the keyboard (but how to detect this?)
- When the user clicks on an
override_redirectwindow, focus it if- it previously requested focus, or
- any X11 client in the same VM is currently grabbing the keyboard
rustybird
commented
Sep 14, 2016
|
Ah, the window manager is totally out of the loop for So my second attempt was to modify xside.c to call What do you think of this approach:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Sep 15, 2016
Member
This may work, but may also have some unwanted side effects. Generally I'm quite reluctant to make any change in GUI code in those two areas:
- input focus
- order of windows (back/front)
There are so many corner cases, so many different toolkits (and applications behaving differently - take Firefox as an example), that it's really hard to not break anything.
That said, it may be good idea to add new flag to MSG_WINDOW_FLAGS to signal that given override_redirect window wants focus. When user clicks on that window and the flag is set, give it a focus. Then implement some heuristic in gui-agent for setting this flag. The one you've given may be good enough (especially the first one, not sure about the later one).
|
This may work, but may also have some unwanted side effects. Generally I'm quite reluctant to make any change in GUI code in those two areas:
There are so many corner cases, so many different toolkits (and applications behaving differently - take Firefox as an example), that it's really hard to not break anything. That said, it may be good idea to add new flag to MSG_WINDOW_FLAGS to signal that given |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
JeramyNS
Oct 21, 2016
I'm getting a similar issue however the apps I'm switching between are on the same VM.
Basically on workspace 2 I have my ide (phpstorm) and I am constantly switching to workspace 1 where chrome lives.
I find that most times (not every time) I switch from phpstorm to chrome, the mouse will be attached to chrome but the keyboard will still be attached to the ide. Unfortunately causing me to break the code before I can even test it
Switching from chrome by clicking on either the desktop or another app before re-focusing fixes the problem.
Really keen to get this one fixed before I break someone
JeramyNS
commented
Oct 21, 2016
•
|
I'm getting a similar issue however the apps I'm switching between are on the same VM. Basically on workspace 2 I have my ide (phpstorm) and I am constantly switching to workspace 1 where chrome lives. Switching from chrome by clicking on either the desktop or another app before re-focusing fixes the problem. Really keen to get this one fixed before I break someone |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
JeramyNS
Oct 21, 2016
Actually I'm thinking mine might be a different issue. Just had it happen again without realizing it and then clicked one of the tabs in chrome. Instead of opening the tab, it brought up the ide drop down menu from the other workspace.
What do you think? Should I move this to a separate issue?
JeramyNS
commented
Oct 21, 2016
|
Actually I'm thinking mine might be a different issue. Just had it happen again without realizing it and then clicked one of the tabs in chrome. Instead of opening the tab, it brought up the ide drop down menu from the other workspace. |
rustybird commentedSep 13, 2016
Qubes OS version:
If an undecorated window (i.e., using override_redirect) is opened from a VM while a window from a different VM is focused, clicking on the undecorated window is not enough to give it keyboard focus:
Steps to reproduce the behavior:
For testing, I've used a Python script that opens an override_redirect window and prints all X11 events to the terminal: https://gist.github.com/rustybird/6dd826a990c643609519e63c61482e63
sleep 10; ./window.pyin the terminal.The popup window will receive mouse clicks, but no keyboard input.