Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.91k stars 164 forks source link

Alt/Meta Keyboard Handling on OS X #4304

Open nakkaya opened 1 month ago

nakkaya commented 1 month ago

On Mac OS X connecting to a Linux box with the following command,

xpra attach tcp://:pass@host:port --swap-keys=no --open-url=yes --ssh-upgrade=no

Meta key in emacs does not work. Looks like Alt/Meta is not passed at all. It has been a while since I connected from Mac to Linux but this used to work correctly a while back.

System Information (please complete the following information):

totaam commented 1 month ago

Does swap-keys=no make any difference?

nakkaya commented 1 month ago

With swap-keys=no control key also breaks, alt/meta still does not work.

SaitouToshihide commented 1 month ago

I apologize for possibly interrupting, but it seems this is related to issue #2804.

bsd% xpra --version
xpra v5.0.9-r65
mac% xpra --version
xpra v4.4.6-r29

This combination (bsd server, mac client v4.4.6) worked without issues. However, after upgrading the client to version 5, I have experienced spurious key events, such as a release event being sent while the Meta (Cmd) key is held down without releasing.

Xev log (Client version 5.0.8, Meta-w key combination):

KeyPress event, serial 119, synthetic NO, window 0xe00001,
    root 0x3eb, subw 0x0, time 412703757, (132,-16), root:(132,37),
    state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 119, synthetic NO, window 0xe00001,
    root 0x3eb, subw 0x0, time 412704445, (132,-16), root:(132,37),
    state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 119, synthetic NO, window 0xe00001,
    root 0x3eb, subw 0x0, time 412704445, (132,-16), root:(132,37),
    state 0x0, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XmbLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

KeyRelease event, serial 119, synthetic NO, window 0xe00001,
    root 0x3eb, subw 0x0, time 412704628, (132,-16), root:(132,37),
    state 0x0, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False
totaam commented 1 month ago

I can't think of any changes to the keyboard handling code client side, so the changes in behaviour may be related to some library updates (ie: GTK).


Here are some links to the list of commits:

nakkaya commented 1 month ago

Since you mentioned something else causing the issue I tried updating brew and reinstalling xpra. Now I lost input support fully but atleast I got an error,

grep: /usr/share/locale/locale.alias: No such file or directory
grep: /usr/share/locale/locale.alias: No such file or directory

2024-07-22 18:36:20,519 Xpra GTK3 client version 6.0.2-r0
2024-07-22 18:36:20,536  running on Mac OS X 14.5
2024-07-22 18:36:20,536  cpython 3.11
grep: /usr/share/locale/locale.alias: No such file or directory
xpra main error:
Traceback (most recent call last):
  File "/Applications/Xpra.app/Contents/Resources/lib/python/xpra/scripts/main.py", line 138, in main
    return run_mode(script_file, cmdline, err, options, args, mode, defaults)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Xpra.app/Contents/Resources/lib/python/xpra/scripts/main.py", line 521, in run_mode
    return do_run_mode(script_file, cmdline, error_cb, options, args, full_mode, defaults)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Xpra.app/Contents/Resources/lib/python/xpra/scripts/main.py", line 720, in do_run_mode
    return run_splash(args)
           ^^^^^^^^^^^^^^^^
  File "/Applications/Xpra.app/Contents/Resources/lib/python/xpra/scripts/main.py", line 2595, in run_splash
    return splash.main(args)
           ^^^^^^^^^^^^^^^^^
  File "/Applications/Xpra.app/Contents/Resources/lib/python/xpra/gtk/dialogs/splash.py", line 312, in main
    with program_context("splash", "Splash"):
  File "/Applications/Xpra.app/Contents/Resources/lib/python/xpra/platform/__init__.py", line 84, in __enter__
    init(self.prgname, self.appname)
  File "/Applications/Xpra.app/Contents/Resources/lib/python/xpra/platform/__init__.py", line 25, in init
    do_init()
  File "/Applications/Xpra.app/Contents/Resources/lib/python/xpra/platform/darwin/__init__.py", line 16, in do_init
    from AppKit import NSApp
  File "AppKit/__init__.pyc", line 217, in <module>
  File "AppKit/__init__.pyc", line 12, in _setup
  File "Foundation/__init__.pyc", line 203, in <module>
  File "Foundation/__init__.pyc", line 12, in _setup
  File "CoreFoundation/__init__.pyc", line 37, in <module>
  File "CoreFoundation/__init__.pyc", line 12, in _setup
  File "objc/__init__.pyc", line 7, in <module>
  File "objc/_objc.pyc", line 13, in <module>
  File "objc/_objc.pyc", line 9, in __load
  File "imp.pyc", line 343, in load_dynamic
ImportError: dlopen(/Applications/Xpra.app/Contents/Resources/lib/python/lib-dynload/objc/_objc.so, 0x0002): symbol not found in flat namespace '_ffi_find_closure_for_code_np'

2024-07-22 18:36:20,888 GStreamer version 1.24.5
2024-07-22 18:36:20,910 created unix domain sockets:
2024-07-22 18:36:20,910  '/Users/nakkaya/.xpra/clients/mini.local-51333'
2024-07-22 18:36:20,986 Warning: no keyboard support, dlopen(/Applications/Xpra.app/Contents/Resources/lib/python/lib-dynload/objc/_objc.so, 0x0002): symbol not found in flat namespace '_ffi_find_closure_for_code_np'
2024-07-22 18:36:20.994 Xpra[51333:1119085] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
2024-07-22 18:36:21,111  desktop size is 2560x1440:
2024-07-22 18:36:21,111   mini.local (677x381 mm - DPI: 96x96)
2024-07-22 18:36:21,111     monitor 1        (699x389 mm - DPI: 93x94) workarea: 2560x1415 at    0x25
2024-07-22 18:36:21,190 enabled remote logging
2024-07-22 18:36:21,190 Xpra X11 seamless server version 6.1
2024-07-22 18:36:21,192 Warning: cannot query ICC profiles:
2024-07-22 18:36:21,192  cannot import name '_imagingcms' from 'PIL' (/Applications/Xpra.app/Contents/Resources/lib/python/PIL/__init__.pyc)
2024-07-22 18:36:21,192 Warning: no clipboard support
2024-07-22 18:36:21,192 Attached to xpra server at tcp://thinkpad:9090/
2024-07-22 18:36:21,192  (press Control-C to detach)

2024-07-22 18:36:21,243 running, 1 windows
^C
2024-07-22 18:36:30,532 Python/GTK3 Client got signal SIGINT
2024-07-22 18:36:30,533 exiting
2024-07-22 18:36:30,552 removing unix domain socket '/Users/nakkaya/.xpra/clients/mini.local-51333'
totaam commented 1 month ago

@nakkaya

ImportError: dlopen(/Applications/Xpra.app/Contents/Resources/lib/python/lib-dynload/objc/_objc.so, 0x0002): symbol not found in flat namespace '_ffi_find_closure_for_code_np'

That's https://github.com/Xpra-org/gtk-osx-build/issues/27 - that's unrelated, and no-one seems to know how to fix it.

nakkaya commented 1 month ago

What is the recommended install method for OS X? Other than brew version using the disk image from Downloads page results in the same error?

totaam commented 1 month ago

@nakkaya until we can figure out the libffi issue, you may try different versions - some may work, others not. It seems to depend on the libffi version included in your OS, as well as the one we bundle, both vary. Some combinations crash, others not.