If, and only if, you’re using the X11 backend of GDK. If you’re using the native Wayland backend, then the windowing system surface represented by a GdkSurface
will not be an X11 Window
, but a Wayland object, which means you cannot use Xlib API with it.
The “X11 compatibility” only exists at the Wayland compositor level: clients either connect to the Wayland compositor using the Wayland API; or they connect to the XWayland server that is spawned by the Wayland compositor, and use the X11 API.
By default, GTK applications will try to connect to the Wayland compositor, and only fall back to checking an X11 display server if that fails. You can force them to use X11 by exporting the GDK_BACKEND=x11
variable in your environment.
As I said in my first reply, though, you should not be moving windows programmatically—unless they are “child” of top level windows, in which case you can use the GdkPopup
API.