Johan Helsing

What’s new with the Wayland platform plugin in Qt 5.11?

Published Tuesday May 29th, 2018
8 Comments on What’s new with the Wayland platform plugin in Qt 5.11?
Posted in Dev Loop, Qt, Wayland | Tags: , ,

Wayland is a display server protocol used on modern Linux systems, the Qt Wayland platform plugin lets Qt applications run on Wayland display servers (compositors).

Apart from bug fixes, the Qt 5.11 release contains a substantial amount of improvements, especially for desktop users.

Key composition support

key-composition

Support for compose keys has been missing for a long time and has finally been added. That means you can now enter characters that require a sequence of keys, such as:

  • ¨, A to write “ä”
  • compose key, S, S to write “ß”

Qt Wayland in official binaries

Starting with Qt 5.11 and Qt Creator 4.7, binaries in the official installers now also include Qt Wayland (previously you would have to build it yourself).

So the official build of Qt Creator itself now runs on Wayland, as well as the applications you build with the official Qt packages.

UPDATE: It’s still unclear whether QtWayland will be in the official release of Qt Creator 4.7.0. Due to a mistake, Qt Wayland was made the default platform plugin on gnome-shell sessions in Qt 5.11. The combination of gnome-shell and Qt Wayland still results in too many bugs, and hence Qt Wayland was removed from the Qt Creator pre-release builds altogether, at least until Qt Wayland is made opt-in again.

Qt creator 4.7 nightly running on Wayland

Qt creator 4.7 nightly running on Wayland

There are nightlies for QtCreator 4.7 available if you want to try it out before the official release.

Fallback to X11 if Wayland is not available

The common way of selecting a Qt platform plugin, has been to set the environment variable QT_QPA_PLATFORM=wayland. This has been a problem on Linux desktops, because some applications—for instance the official QtCreator package—use a bundled version of Qt that doesn’t include Wayland, and will fail to launch with the following message:

This application failed to start because it could not find or load the Qt platform plugin "wayland" in "".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Reinstalling the application may fix this problem.

In Qt 5.11 we added support for fallback platform plugins, this means you can now set QT_QPA_PLATFORM="wayland;xcb", which makes Qt use the xcb (X11) plugin if Wayland is not available.

Improved high-dpi support

automatic-dpi-change
If you have a multi-monitor setup with both high-dpi and low-dpi screens, you’ll be happy to hear that windows now switch to the appropriate scale when moved from one screen to another. No more tiny or blurry windows 🙂

Testing and continuous integration

QA-wise Qt Wayland has seen significant improvements lately. We now run a subset of the QtBase unit tests on every patch set submitted, which means we will catch more bugs earlier. However, this is a topic suitable for a separate blog post.

News from the development branch

There has also been many recent changes that didn’t make it into the 5.11 release. State changes, such as resizing or maximizing have seen a lot of work. We now finally support maximizing and full screen on xdg-shell-v6. We have also added a new shell integration for xdg-shell stable.

Qt Wayland backports repository

If you want to test the new features and fixes in Qt Wayland, but don’t want to wait for a release, or if you don’t want to upgrade or compile all of Qt, I have set up an unofficial qtwayland-backports repository.

It contains branches with new versions of Qt Wayland that compile against older versions of Qt. I.e. if you use Qt 5.10.x, you can still test recent changes in the Qt Wayland dev branch using the dev-for-5.10 branch.

Arch Linux users can install the AUR package, qt5-wayland-dev-backport-git, as a drop-in replacement for qt5-wayland. Again, note that these backports are unofficial and there are no guarantees that I will keep updating them.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Dev Loop, Qt, Wayland | Tags: , ,

8 comments

Damjan says:

How is key composition supposed to work? In X11 it uses ~/.XCompose or /usr/share/X11/locale//Compose to know the combinations. What does it use in wayland? Any required configurations of the Compositor?

Johan Helsing Johan Helsing says:

We’re using libxkbcommon for compose key state and configuration. I think you should be able to use ~/.XCompose like before, or you can set XCOMPOSEFILE or edit your systems compose file for your locale.

Type “man compose” in your terminal for details.

Allan Jensen Allan Jensen says:

Also new in 5.11, if QT_QPA_PLATFORM is not set, Qt will respect the XDG_SESSION_TYPE environment variable to select a Wayland plugin if the session type if Wayland.

Daniel Harper says:

Is there any chance to get the QT installer updated for Wayland support? I’m currently having to force QT_QPA_PLATFORM to get it to run in a Wayland seesion.

Timur Kristóf says:

Does this mean that Qt apps can now finally work well with Gnome on Wayland?

Johan Helsing Johan Helsing says:

That depends on what issues you had before 😉

Anyways, I just tested on gnome-shell, and it works, but there’s still a couple of issues:

– Applications get locked in the top left corner when launched (If you tile and untile using super+left it will get unstuck, though, and start working as expected)
– Some flickering in widget apps
– Second-level menus are sometimes misplaced
– Gnome-shell sometimes freezes when moving Qt windows from one screen to another

I don’t see these issues on other compositors, so I’m not sure whether it’s an issue with Qt or gnome-shell.

I use KDE plasma, myself, so that’s probably the compositior with best support right now. I’ll try out gnome-shell for a while, though, and see if there’s anything that can be done on the Qt side.

Michael Arnold says:

Great progress!

Couple of pointers to Gnome issues logged here: https://forum.qt.io/topic/90639/comparing-qt-widgets-app-under-gnome-wayland-using-platform-wayland-egl-to-xcb

To “unstick” a qt window in gnome-shell you can also use ALT-SPACE_BAR.

Are there any plans to make the client side decorations (CSD’s) look more “native” in the future? I understand it must a daunting prospect to support all the different wayland compositors out there, with all their window options, but certainly under Gnome shell, my app now looks like it came straight from KDE!

Erik says:

HiDPI support getting better, yay! \o/

Working wayland mixed dpi desktops are urgently needed, nice to see some progress. Keep it up.

Commenting closed.

Get started today with Qt Download now