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

basic gtk wayland client #2243

Closed
totaam opened this issue Apr 1, 2019 · 14 comments
Closed

basic gtk wayland client #2243

totaam opened this issue Apr 1, 2019 · 14 comments
Labels

Comments

@totaam
Copy link
Collaborator

totaam commented Apr 1, 2019

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
Copy link
Collaborator Author

totaam commented Apr 1, 2019

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


Updates:

Still TODO:

  • re-implement all the functionality currently using the x11 bindings (ie: workspace, etc)
  • get DPI from somewhere
  • get_mouse_position : make sure the server will ignore this (-1, -1) position if we can't get a real value
  • get_current_modifiers : as above - new packet format: dictionary instead of positional arguments #1942 may help
  • icon theme missing : gtk bug? do we care?
  • get the keymap from somewhere
  • get_root_size : query all monitors? Add them up? (we can still get monitors from the default display, example: [https://askubuntu.com/a/1104252/14126])
  • window has no decorations
  • opengl context adapter

Links:

@totaam
Copy link
Collaborator Author

totaam commented Jun 30, 2019

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
Copy link
Collaborator Author

totaam commented Jun 30, 2019

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
Copy link
Collaborator Author

totaam commented Jul 2, 2019

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
Copy link
Collaborator Author

totaam commented Jul 3, 2019

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
Copy link
Collaborator Author

totaam commented Jul 4, 2019

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
Copy link
Collaborator Author

totaam commented Jul 6, 2019

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
Copy link
Collaborator Author

totaam commented Jul 25, 2019

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
Copy link
Collaborator Author

totaam commented Jul 25, 2019

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 totaam closed this as completed Jul 25, 2019
@totaam
Copy link
Collaborator Author

totaam commented Jul 28, 2019

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
Copy link
Collaborator Author

totaam commented Aug 1, 2019

r23305 broke non-opengl GTK2 rendering: #2377

@totaam
Copy link
Collaborator Author

totaam commented Aug 4, 2019

Missed from the refactoring: r23429.

@totaam
Copy link
Collaborator Author

totaam commented Aug 17, 2019

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
Copy link
Collaborator Author

totaam commented Nov 7, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant