Skip to content
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

Page_Up, Page_Down translated to \, Menu #4396

Open
donaldsycamore opened this issue Oct 17, 2024 · 7 comments
Open

Page_Up, Page_Down translated to \, Menu #4396

donaldsycamore opened this issue Oct 17, 2024 · 7 comments
Labels
bug Something isn't working keyboard linux

Comments

@donaldsycamore
Copy link

donaldsycamore commented Oct 17, 2024

Describe the bug
On Debian Bookworm (latest stable), with Xpra installed via Xpra-provided debian packages, with GNOME 3 & Wayland, in Seamless mode, and US keymap, Page_Up on the client is translated to the "" key, and Page_Down is translated to Menu.

  1. server command: xpra start --start=xfce4-terminal
  2. client command: xpra gui -> connect -> SSH, username & hostname -> copnnect
  3. xpra toolbox -> Keyboard running in a normal login session correctly shows Page_Up and Page_Down. xpra toolbox -> Keyboard running on the Xpra server shows KP_Divide and Menu

System Information (please complete the following information):

  • Server OS: Debian Bookworm
  • Client OS: Debian Bookworm
  • Xpra Server Version 6.2.0-r0
  • Xpra Client Version 6.2.0-r0

Additional context

2024-10-18 09:19:22,706 parse_key_event(<Gdk.EventKey object at 0x7fac347e0be0 (void at 0x3bbc3640)>, True)=KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=True)
2024-10-18 09:19:22,706 handle_key_action(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=True)) wid=7
2024-10-18 09:19:22,707 key_handled_as_shortcut(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), 'Page_Down', ['mod2'], True) shortcuts_enabled=True, shortcuts=None
2024-10-18 09:19:22,707 send_key_action(7, KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=True))
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/client/base/client.py", line 1253, in call_handler
    handler(packet)
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 1251, in _process_new_override_redirect
    return self._process_new_common(packet, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 955, in _process_new_common
    return self.make_new_window(wid, wx, wy, ww, wh, bw, bh, metadata, override_redirect, client_properties)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 992, in make_new_window
    self.patch_OR_popup_transient_for(metadata)
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 974, in patch_OR_popup_transient_for
    twid = self._find_pid_focused_window(pid, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 959, in _find_pid_focused_window
    if twin._override_redirect != OR:
       ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ClientTray' object has no attribute '_override_redirect'
2024-10-18 09:19:22,805 parse_key_event(<Gdk.EventKey object at 0x7fac347e28f0 (void at 0x3d231470)>, False)=KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=False)
2024-10-18 09:19:22,805 handle_key_action(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=False)) wid=7
2024-10-18 09:19:22,805 key_handled_as_shortcut(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), 'Page_Down', ['mod2'], False) shortcuts_enabled=True, shortcuts=None
2024-10-18 09:19:22,805 send_key_action(7, KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=False))

Keyboard debugging on the client shows logs like:

PageUp:

2024-10-18 09:18:38,840 parse_key_event(<Gdk.EventKey object at 0x7fac347e0500 (void at 0x3d231330)>, True)=KeyEvent(modifiers=['mod2'], keyname=Page_Up, keyval=65365, keycode=112, group=0, string=, pressed=True)
2024-10-18 09:18:38,840 handle_key_action(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), KeyEvent(modifiers=['mod2'], keyname=Page_Up, keyval=65365, keycode=112, group=0, string=, pressed=True)) wid=7
2024-10-18 09:18:38,840 key_handled_as_shortcut(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), 'Page_Up', ['mod2'], True) shortcuts_enabled=True, shortcuts=None
2024-10-18 09:18:38,841 send_key_action(7, KeyEvent(modifiers=['mod2'], keyname=Page_Up, keyval=65365, keycode=112, group=0, string=, pressed=True))
2024-10-18 09:18:38,922 parse_key_event(<Gdk.EventKey object at 0x7fac347e1e00 (void at 0x3d231150)>, False)=KeyEvent(modifiers=['mod2'], keyname=Page_Up, keyval=65365, keycode=112, group=0, string=, pressed=False)
2024-10-18 09:18:38,922 handle_key_action(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), KeyEvent(modifiers=['mod2'], keyname=Page_Up, keyval=65365, keycode=112, group=0, string=, pressed=False)) wid=7
2024-10-18 09:18:38,922 key_handled_as_shortcut(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), 'Page_Up', ['mod2'], False) shortcuts_enabled=True, shortcuts=None
2024-10-18 09:18:38,923 send_key_action(7, KeyEvent(modifiers=['mod2'], keyname=Page_Up, keyval=65365, keycode=112, group=0, string=, pressed=False))

PageDown:

2024-10-18 09:19:22,706 parse_key_event(<Gdk.EventKey object at 0x7fac347e0be0 (void at 0x3bbc3640)>, True)=KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=True)
2024-10-18 09:19:22,706 handle_key_action(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=True)) wid=7
2024-10-18 09:19:22,707 key_handled_as_shortcut(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), 'Page_Down', ['mod2'], True) shortcuts_enabled=True, shortcuts=None
2024-10-18 09:19:22,707 send_key_action(7, KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=True))
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/client/base/client.py", line 1253, in call_handler
    handler(packet)
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 1251, in _process_new_override_redirect
    return self._process_new_common(packet, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 955, in _process_new_common
    return self.make_new_window(wid, wx, wy, ww, wh, bw, bh, metadata, override_redirect, client_properties)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 992, in make_new_window
    self.patch_OR_popup_transient_for(metadata)
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 974, in patch_OR_popup_transient_for
    twid = self._find_pid_focused_window(pid, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/windows.py", line 959, in _find_pid_focused_window
    if twin._override_redirect != OR:
       ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ClientTray' object has no attribute '_override_redirect'
2024-10-18 09:19:22,805 parse_key_event(<Gdk.EventKey object at 0x7fac347e28f0 (void at 0x3d231470)>, False)=KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=False)
2024-10-18 09:19:22,805 handle_key_action(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=False)) wid=7
2024-10-18 09:19:22,805 key_handled_as_shortcut(GLClientWindow(7 : GLAreaBacking(0x7, (1440, 1011))), 'Page_Down', ['mod2'], False) shortcuts_enabled=True, shortcuts=None
2024-10-18 09:19:22,805 send_key_action(7, KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=False))

This issue also occurs when I use a client running on PostmarketOS (Alpine Linux) to connect to this same session.

@donaldsycamore donaldsycamore added the bug Something isn't working label Oct 17, 2024
@totaam
Copy link
Collaborator

totaam commented Oct 18, 2024

AttributeError: 'ClientTray' object has no attribute '_override_redirect'

This is unrelated and fixed in 65eea92 - thanks for reporting it.

parse_key_event(<Gdk.EventKey object at 0x7fac347e0be0 (void at 0x3bbc3640)>, True)= \
KeyEvent(modifiers=['mod2'], keyname=Page_Down, keyval=65366, keycode=117, group=0, string=, pressed=True)

Looks correct to me.
The problem may be server-side.
Is this a default us layout or a more complicated one?

@donaldsycamore
Copy link
Author

Yes, US layout (the norm here in New Zealand).

@totaam
Copy link
Collaborator

totaam commented Oct 20, 2024

I believe that c57e4d4 fixes the problem and will be backported to older branches.
Until then, you can easily apply it by hand.

Hopefully it doesn't break any other platform..

@donaldsycamore
Copy link
Author

Thanks, that indeed fixes it for me.

totaam added a commit that referenced this issue Oct 27, 2024
This reverts commit 0a3334f.
Which causes too many new problems with keyboard mapping.
@totaam
Copy link
Collaborator

totaam commented Oct 27, 2024

This has caused some breakage: #4404 and #4396, so I have reverted the commit in the v6.2.x branch.
A better solution is needed.

@totaam totaam reopened this Oct 27, 2024
totaam added a commit that referenced this issue Oct 28, 2024
@totaam
Copy link
Collaborator

totaam commented Oct 28, 2024

@donaldsycamore is that a Wayland session by any chance?

@totaam
Copy link
Collaborator

totaam commented Oct 28, 2024

I think I know what happened here:

  • with x11 clients connecting to an x11 server, we can preserve the client supplied keycode if we have applied the same keymap (that's the original if self.query_struct check)
  • when wayland client support was improved, we re-used the same query_struct for providing the (much more limited) keyboard data we get: basic gtk wayland client #2243 (comment)

The commit above is a better fix and only uses the client keycode for X11 clients, other clients fall through to

def find_matching_keycode(self, client_keycode: int, keyname: str,
pressed: bool, modifiers, keyval: int, keystr: str, group: int) -> tuple[int, int]:

@donaldsycamore please confirm that fb72d90 also works for you.

totaam added a commit that referenced this issue Oct 29, 2024
let the find_matching_keycode fall through use the keycode_translation for non X11 clients,
as this may require using a different group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working keyboard linux
Projects
None yet
Development

No branches or pull requests

2 participants