Bug 5646 - native wayland support in client
Summary: native wayland support in client
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Client platforms (show other bugs)
Version: pre-1.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Peter Åstrand
URL:
Keywords:
Depends on: 8337 5647 7058
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-22 15:55 CEST by Pierre Ossman
Modified: 2024-10-01 10:34 CEST (History)
3 users (show)

See Also:
Acceptance Criteria:


Attachments
Screenshot of Gnome Wayland's keyboard grab permission popup (39.06 KB, image/png)
2024-07-11 11:49 CEST, Samuel Mannehed
Details

Description Pierre Ossman cendio 2015-09-22 15:55:31 CEST
The Linux world is slowly but surely moving towards Wayland as a replacement for X11. At some point we need to be able to natively support this brave new world. It does have legacy support for X11 applications though, so we are not completely excluded from that world.
Comment 1 Pierre Ossman cendio 2021-12-09 10:35:21 CET
Note that Wayland explicitly hides global coordinates from windows. This can cause problems coordinating monitor placement between tlclient and vncviewer. See bug 7793 for some details.
Comment 2 Samuel Mannehed cendio 2024-06-28 15:10:16 CEST
It seems possible to get native Wayland support with Qt. We have a prototype implementation that works well regarding keyboard grab (or "inhibit shortcuts" as it's called in Wayland-land).

However, full screen on multiple monitors is still an issue that needs more investigation on Wayland.
Comment 3 Samuel Mannehed cendio 2024-07-03 15:56:14 CEST
The attempt at making vncviewer work on native Wayland using Qt6 can be found here:

https://git.cendio.se/cendio/qt-tigervnc/-/tree/qt-wayland2

Some notes:

 * This branch of qt-tigervnc should be built using Qt6. This is because the qApp->nativeInterface() function (which is only available in Qt6) was needed:

   https://doc.qt.io/qt-6/qguiapplication.html#nativeInterface

 * To build with Qt6, instead of the default Qt5, remove "Qt5" from the find_package command at vncviewer/CMakeLists.txt:2
> diff --git vncviewer/CMakeLists.txt vncviewer/CMakeLists.txt
> index 993d7e81..f9b10f1f 100644
> --- vncviewer/CMakeLists.txt
> +++ vncviewer/CMakeLists.txt
> @@ -1,5 +1,5 @@
>  #list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/Static/6.2.4/gcc_64s")
> -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Network Widgets REQUIRED)
> +find_package(QT NAMES Qt6 COMPONENTS Core Network Widgets REQUIRED)
>  find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Widgets REQUIRED)
>  if(QT_VERSION_MAJOR LESS_EQUAL 5 AND BUILD_STATIC)
>    find_package(QT NAMES Qt6 Qt5 COMPONENTS

 * To build this branch of qt-tigervnc (can't be built in cenbuild yet) the following packages are needed:

   libxkbcommon-devel
   qt6-qtbase-devel
   qt6-qtbase-private-devel

 * The reason we need the Qt private API is that we need access to the Wayland surface. There are two pull requests opened that aim to add this to the public API:

   https://codereview.qt-project.org/c/qt/qtbase/+/571272
   https://codereview.qt-project.org/c/qt/qtwayland/+/571271

 * Regarding full screen on multiple monitors together with Wayland, it is currently disabled in this branch. The area is problematic, for reference, here is a issue on the topic for Remmina:

   https://gitlab.com/Remmina/Remmina/-/issues/2644
Comment 4 Samuel Mannehed cendio 2024-07-04 09:37:02 CEST
Some further notes regarding https://git.cendio.se/cendio/qt-tigervnc/-/tree/qt-wayland2:

* When exiting fullscreen, it crashes with:
> 'vncviewer/vncviewer' terminated by signal SIGSEGV (Address boundary error)
  It happens both when disabling fullscreen from the F8 menu,
  and when switching to Windowed from the options.
  Tested on Fedora 40 with GNOME on Wayland. 

* When using vncviewer to connect in windowed mode, the mouse doesn't focus
  the remote session. This means I have to click in the session before being
  able to interact with the remote apps. It also means F8 doesn't work until
  after I have clicked in the session.

* When switching to fullscreen if "send system keys" are enabled, or if
  enabling "send system keys" GNOME shows a pop-up that asks to "Allow
  inhibiting shortcuts" every time.

  It seems remmina only shows it once. Here's their source code, perhaps we
  can use the same methods they use:
  https://gitlab.com/Remmina/Remmina/-/blob/master/src/rcw.c#L2303
  https://gitlab.com/Remmina/Remmina/-/blob/master/src/rcw.c#L547
  https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkseat.c#L270
  https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/wayland/gdkseat-wayland.c#L4234
  https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/wayland/gdkseat-wayland.c#L3985
  https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/wayland/gdktoplevel-wayland.c#L1752
Comment 5 Samuel Mannehed cendio 2024-07-11 11:49:37 CEST
Created attachment 1209 [details]
Screenshot of Gnome Wayland's keyboard grab permission popup
Comment 6 Pierre Ossman cendio 2024-10-01 10:34:20 CEST
(In reply to Samuel Mannehed from comment #3)
> 
>  * Regarding full screen on multiple monitors together with Wayland, it is
> currently disabled in this branch. The area is problematic, for reference,
> here is a issue on the topic for Remmina:
> 
>    https://gitlab.com/Remmina/Remmina/-/issues/2644

Discussion with the Wayland people:

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/99

Note You need to log in before you can comment on or make changes to this bug.