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.94k stars 166 forks source link

basic gtk wayland client #2243

Closed totaam closed 5 years ago

totaam commented 5 years ago

Needs many workarounds for the never ending API deprecation in GTK3. Many API calls now fail or return nothing: no default screen, no root window, etc. No x11 gl code, no x11 clipboard, no keyboard layout, etc

We should be able to at least run the client without xwayland:

DISPLAY="" GDK_BACKEND=wayland /usr/bin/python3 /usr/bin/xpra attach tcp://localhost:10000/

Related to #1925. For server support, see #387

totaam commented 5 years ago

2019-04-01 10:24:23: antoine commented


Updates:

Still TODO:

Links:

totaam commented 5 years ago

2019-06-30 13:36:14: mviereck commented


I gave this a try running in Weston v5.0.0 and xpra v3.0-r23019 on Debian buster.

I found one issue with the xpra server: It fails if started with GDK_BACKEND=wayland. It must be started with GKD_BACKEND=x11 (or unset) instead.

The xpra client needs GDK_BACKEND=wayland as noted above. It starts up, but does not show a client window. The log shows an error, but the client does not terminate. The server looks like it gets a valid connection:

==/home/lauscher/.cache/x11docker/xterm-9065ed/xpraclient.log <==
2019-06-30 14:01:04,176 Xpra GTK3 client version 3.0-[r23019](../commit/663065d4e89dc895095d9bf865a04d4c8c1397e1) 64-bit
2019-06-30 14:01:04,178  running on Linux Debian 10 buster
2019-06-30 14:01:04,178  window manager is 'wayland'
2019-06-30 14:01:04,530 Error: failed to load posix keyboard bindings
2019-06-30 14:01:04,530  cannot load X11 bindings with wayland under python3 / GTK3
2019-06-30 14:01:04,564 keyboard bindings are not available, expect keyboard mapping problems
2019-06-30 14:01:04,568 OpenGL safety warning (enabled at your own risk):
2019-06-30 14:01:04,569  disabled under wayland with GTK3 (buggy)
2019-06-30 14:01:04,655 No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
2019-06-30 14:01:05,063 Error loading OpenGL support:
2019-06-30 14:01:05,063  no X11 display registered
2019-06-30 14:01:05,117  using default keyboard settings
2019-06-30 14:01:05,123  desktop size is 1824x984 with 1 screen:
2019-06-30 14:01:05,123   wayland-102 (482x259 mm - DPI: 96x96)
2019-06-30 14:01:05,124     weston-X11 none
2019-06-30 14:01:05,126 failed to get antialias info from xsettings: 'NoneType' object is not callable
2019-06-30 14:01:05,136 error preparing connection: 'NoneType' object is not callable
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/client/client_base.py", line 336, in send_hello
    hello.update(self.make_hello())
  File "/usr/lib/python3/dist-packages/xpra/client/gtk_base/gtk_client_base.py", line 673, in make_hello
    capabilities = UIXpraClient.make_hello(self)
  File "/usr/lib/python3/dist-packages/xpra/client/ui_client_base.py", line 361, in make_hello
    caps.update(c.get_caps(self))
  File "/usr/lib/python3/dist-packages/xpra/client/mixins/window_manager.py", line 271, in get_caps
    "double_click.time"         : get_double_click_time(),
  File "/usr/lib/python3/dist-packages/xpra/platform/xposix/gui.py", line 400, in get_double_click_time
    return _get_xsettings_int("Net/DoubleClickTime", -1)
  File "/usr/lib/python3/dist-packages/xpra/platform/xposix/gui.py", line 390, in _get_xsettings_int
    d = _get_xsettings_dict()
  File "/usr/lib/python3/dist-packages/xpra/platform/xposix/gui.py", line 152, in _get_xsettings_dict
    v = _get_xsettings()
  File "/usr/lib/python3/dist-packages/xpra/platform/xposix/gui.py", line 136, in _get_xsettings
    X11Window = X11WindowBindings()
TypeError: 'NoneType' object is not callable
==/home/lauscher/.cache/x11docker/xterm-9065ed/xpraserver.log <==
2019-06-30 14:01:05,556 watching for applications menu changes in:
2019-06-30 14:01:05,556  '/usr/share/xfce4/applications'
2019-06-30 14:01:05,556  '/usr/local/share/applications'
2019-06-30 14:01:05,556  '/usr/share/applications'
2019-06-30 14:01:05,557  '/usr/share/applications'
2019-06-30 14:01:05,557 6.5GB of system memory
2019-06-30 14:01:06,099 New unix-domain connection received on /home/lauscher/.cache/x11docker/xterm-9065ed/buster-104
2019-06-30 14:01:06,177 New unix-domain connection received on /home/lauscher/.cache/x11docker/xterm-9065ed/buster-104

get the keymap from somewhere

/etc/default/keyboard might help.

totaam commented 5 years ago

2019-06-30 14:01:05,126 failed to get antialias info from xsettings: 'NoneType' object is not callable

Thanks for pointing that out, fixed in r23057.

get the keymap from somewhere

/etc/default/keyboard might help.

That's a Debian thing, it doesn't exist on other distros.. As for wayland, there is no "standard" way of doing this that I can find. Looks like every compositor is going to have its own way of configuring things: Does Wayland use XKB for keyboard layouts?: But Wayland does not define how this keymap is decided on. This decision is up to the compositor.

totaam commented 5 years ago

Note: if we cannot support the native Wayland client well enough before the 3.0 release then we will have to force it to switch to the X11 backend.

totaam commented 5 years ago

2019-07-03 12:41:41: mviereck commented


There is SirCmpwn, a developer of wlroots and Wayland compositor sway. I believe he likes to help others in Wayland development. It might be worth to contact him for questions like keyboard layouts.

https://swaywm.org/ https://github.com/swaywm/sway

Looks like every compositor is going to have its own way of configuring things

There is some work done to develop an additional standard that includes more than the core Wayland protocol, the xdg_shell interface. That might help.

totaam commented 5 years ago

2019-07-04 23:08:44: mviereck commented


I accidently found that the xpra client fails with "Cannot open display" even on x11 if GDK_BACKEND is set but empty. To avoid this you could unset GDK_BACKEND if it is empty.

totaam commented 5 years ago

2019-07-06 11:22:09: mviereck commented


I'd like to test xpra Wayland client in a fedora VM. I get the slightly outdated version xpra v3.0-r23019 from winswitch beta repository with the bug mentioned in comment 3. Could you please push an update for fedora?

I've encountered issues on Debian buster with outdated Weston 5.0.0 (window decoration mismatches window content). I think it makes sense to test with more recent versions of Weston before reporting bugs here, so I want to try in a fedora 30 VM.

totaam commented 5 years ago

2019-07-25 10:40:42: antoine uploaded file fix-wayland-client-offsets.patch (9.6 KiB)

we have to use a drawing area to get the correct coordinates

totaam commented 5 years ago

Minor updates:

This is as good as it is going to get for this release. To test from an X11 desktop, run weston then from a terminal:

GDK_BACKEND=wayland python3 /usr/bin/xpra attach

Things that are just not supported in this release: clipboard, keyboard layout, etc That's why the default remains the X11 backend.

Will follow up in #2368

totaam commented 5 years ago

We detect the keyboard layout using localectl status as of r23321 - which is better than nothing.

As for the clipboard, we removed the GTK clipboard in #812... And that was a lot of work. Re-adding something like it would allow some sort of clipboard synchronization with wayland clients, but the big problem here is that there is no notification change support on wayland, so this would not work well at all. (removing things without providing a replacement is an improvement / feature apparently)

totaam commented 5 years ago

r23305 broke non-opengl GTK2 rendering: #2377

totaam commented 5 years ago

Missed from the refactoring: r23429.

totaam commented 5 years ago

2019-08-17 20:14:52: mviereck commented


I can confirm that xpra client on Wayland works well on Weston v5.0.0 and kwin_wayland 5.14.5. The window content now fits into the window border and the keyboard matches the system setting.

Tested on Debian bullseye with xpra v3.0-r23522

Thank you!

totaam commented 4 years ago

Wayland, at least when testing via Weston, is afflicted by a GTK3 CSD geometry bug: #2475 / #2457.