gromit-mpx icon indicating copy to clipboard operation
gromit-mpx copied to clipboard

Modifier keys like Shift, Ctrl, Alt don't always work under XWayland

Open bk138 opened this issue 5 years ago • 10 comments
trafficstars

Bug behaviour

Modifier keys like Shift, Ctrl, Alt only work when Gromit-MPX is toggled on over other XWayland windows, but are ignored for drawing over pure Wayland windows. For instance, when toggled over an xterm, all works, but over a gnome-terminal, it does not.

Things tried so far

  • [ ] looks good, but is for wayland, not xwayland:

    • https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/96061/
    • https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=d674cf3686c90551f3006ba4e55f1fd66f77658c
    • also: https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=467296f8e2b8352bd93e9bc7039f9c232e18bee0
  • [x] ask modifiert state from slave device? -> :no_entry:

  • [x] gtk_window_new (GTK_WINDOW_TOPLEVEL); instead of gtk_window_new (GTK_WINDOW_POPUP); and set stay-on-top and set sticky?

    • with X11 session: still goes to background, sticky also not working
    • same under wayland with xwayland
    • -> :no_entry:
  • [x] look into GKD_WINDOW_TEMP, which is used for gtk_window_new (GTK_WINDOW_POPUP);

    • there is no special xwayland handling in GTK/GDK -> :no_entry:
  • [ ] difference between X11 session and Wayland session using XWayland is that the latter is rootless. Might this be the reason? Can we maybe set an additional property to our GTK_WINDOW_POPUP so that it eats modifier events as well in that case?

    • https://stackoverflow.com/questions/39087079/detect-modifier-key-release-in-x11-root-window
  • [ ] have a look at https://github.com/swaywm/sway/issues/719

  • [ ] https://stackoverflow.com/questions/1925568/how-to-give-keyboard-focus-to-a-pop-up-gtk-window

  • [x] xwayland keyboard grabs? --> https://unix.stackexchange.com/a/607473/80396 and https://gitlab.com/Remmina/Remmina/-/issues/2106 -> hmm well no, that seems for grabbing the whole keyboard with XGrabKeyboard(), not XGrabKey() :no_entry:

bk138 avatar Nov 17 '20 20:11 bk138

As a workaround, would it be possible to have a command line option that starts drawing? E.g.

gromit-mpx --draw

That way I can bind F9 im my desktop environment to run that command.

One option would be registering global shortcuts in the desktop environment itself, but I have no idea if there is a standard way of doing this that wouldn't involve different code for kde/gnome/etc.

TRPB avatar Nov 22 '20 14:11 TRPB

As a workaround, would it be possible to have a command line option that starts drawing? E.g.

gromit-mpx --draw

That way I can bind F9 im my desktop environment to run that command.

One option would be registering global shortcuts in the desktop environment itself, but I have no idea if there is a standard way of doing this that wouldn't involve different code for kde/gnome/etc.

What you mention has already been tackled in #27 with https://github.com/bk138/gromit-mpx/commit/6501486df975205eb202f06b7b1da3883d65e5f9 - this here is about the modifier keys only.

bk138 avatar Nov 22 '20 15:11 bk138