Wayland logo

X Clients under Wayland (Xwayland)

Wayland is a complete window system in itself, but even so, if we're migrating away from X, it makes sense to have a good backwards compatibility story. With a few changes, the Xorg server can be modified to use wayland input devices for input and forward either the root window or individual top-level windows as wayland surfaces. The server still runs the same 2D driver with the same acceleration code as it does when it runs natively. The main difference is that wayland handles presentation of the windows instead of KMS.

X on Wayland architecture diagram

Building Xwayland

Follow the main Wayland build instructions first.

libepoxy

The Xwayland server depends on libepoxy.

$ git clone https://github.com/anholt/libepoxy.git
$ cd libepoxy
$ meson -Dprefix=$WLD build
$ ninja -C build/ install
$ cd ..

X Server

Xwayland support has been merged in the master X.Org branch on April 4th, 2014, and is first released with xserver 1.16. The separate X.Org video DDXes are not needed anymore. With this config it will only install the Xwayland binary and few other files:

$ git clone https://gitlab.freedesktop.org/xorg/xserver.git
$ cd xserver
$ meson -Dprefix=$WLD -Dxorg=false -Dxwayland=true -Dxvfb=false \
	-Dxnest=false -Dxquartz=false -Dxwin=false -Ddocs=false build
$ ninja -C build/ install
$ cd ..

Paths

Without this you will get the error "XKB: Failed to compile keymap". Weston uses xkeyboard-config to find these files, but the XServer needs these links:

$ mkdir -p $WLD/share/X11/xkb/rules
$ ln -s /usr/share/X11/xkb/rules/evdev $WLD/share/X11/xkb/rules/
$ ln -s /usr/bin/xkbcomp $WLD/bin/

weston.ini

Add this to ~/.config/weston.ini (or use the --xwayland command line argument):

[core]
xwayland=true

If the default search path for Xwayland in Weston is not correct, you need to fix it either by a Weston build option xwayland-path or adding this to ~/.config/weston.ini:

[xwayland]
path=/path/to/bin/Xwayland

Running

Run weston under X, or weston-launch on KMS / DRM / outside of X, just like explained on main Wayland build instructions.

The weston log output will include "xserver listening on display :1". Within weston-terminal you will find $DISPLAY has already been set. Run any X client.

Weston listens on the X socket until a client attempts to connect, then launches the X server.