Robot's API createScreenCapture() question

Olivier Fourdan ofourdan at
Wed Sep 22 09:41:25 UTC 2021

Hi all,

In a Wayland desktop, Xwayland cannot capture the content of the Wayland
native windows (as those are handled by the Wayland compositor and not
Xwayland), but X11's GetImage works on X11 toplevel windows in Xwayland,
except for the root window which in Xwayland has no storage (when Xwayland
is run rootless).


$ xterm &
$ xwd -id $WINDOWID | xwud

Works fine in Xwayland, but:

$ xwd -root | xwud

Fails with a BadMatch for the reason mentioned above.

Now I was wondering if we could make that work in Xwayland, but then I had
some doubts as to how it currently works with Robot's API

Typically, in a composited environment on Xorg, capturing the content of
the root window will not fetch the content of all the other windows, just
the bare content of the root window itself.

xwd works around that by fetching the image of each toplevel window visible
on screen and rebuilding a global image by copying those, basically, trying
to replicate what the X11 compositor does.

How does Robot's API createScreenCapture() deal with such composited setups
even on plain Xorg?

Corollary question, what actually fails when trying to use the
createScreenCapture() API in Xwayland?

I believe if we could make that work in Xwayland it would probably help the
Robot API in Xwayland (even though it would be limited to X11 windows in
Xwayland, it would work at least for Java own windows).


More information about the wakefield-dev mailing list