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
$ ./autogen.sh --prefix=$WLD
$ make && make 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 git://anongit.freedesktop.org/xorg/xserver
$ cd xserver
$ ./autogen.sh --prefix=$WLD --disable-docs --disable-devel-docs \
  --enable-xwayland --disable-xorg --disable-xvfb --disable-xnest \
  --disable-xquartz --disable-xwin
$ make && make 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 --modules=xwayland.so command line argument):

[core]
    modules=xwayland.so

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.