Skip to content

Run Linux windows through XWayland under Wayland, and track button presses - #14

Merged
3vcloud merged 1 commit into
mainfrom
linux-wayland-xwayland
Nov 16, 2026
Merged

3vcloud merged 1 commit into
mainfrom
linux-wayland-xwayland

Conversation

@3vcloud

@3vcloud 3vcloud commented Nov 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Under a Wayland session, the library now runs its windows through XWayland (GTK's X11 backend) when XWayland is running. A Wayland client can't place or read its own window, so programmatic position and size didn't work there. The choice is made before GTK initialises, in preferXWayland(), and respects an existing GDK_BACKEND.
  • serverTime checks that the window's display is X11 before calling gdk_x11_get_server_time. The symbol exists under Wayland too, and calling it there segfaulted (gdk_x11_atom_to_xatom_for_display on a null display).
  • Button presses and releases are tracked on the window, because a compositor may not report the button as held when a drag starts. The drag code treats a held button as either the X server's report or this flag.
  • tests/linux_common.sh: on Wayland the window check asks the example for its visible flag, since xdotool can't see native Wayland windows.

Testing

Run in a Kubuntu 26.04 VM, Plasma (KWin 6.6) Wayland session, with no explicit GDK_BACKEND:

  • Pass: example, cooldown, download, permission, move snapping.
  • Still failing under KWin: south-east resize snapping, work-area confinement, click-through control. A full-screen unnamed X window (0x200001) sits above the example's window and takes the pointer press, so GTK never receives it. I haven't identified what owns that window.

Under plain X11 (Xvfb, no window manager) the move and resize snapping tests pass.

Notes

  • Upstream renamed Rect to ScreenRect in 93c8171. This branch is based on main and builds against it.
  • Native Wayland compositors without XWayland still have no absolute positioning. This PR doesn't add a native Wayland backend.

🤖 Generated with Claude Code

…esses

A Wayland client can't place or read its own window, so under Wayland the windows
use GTK's X11 backend when XWayland is running. serverTime now checks that the
window's display is X11, since gdk_x11_get_server_time crashes on Wayland.
Button presses are tracked on the window, because a compositor may not report the
button as held. The test helper asks the example for its visible flag on Wayland.
@3vcloud
3vcloud merged commit a1cec42 into main Nov 16, 2026
2 checks passed
@3vcloud
3vcloud deleted the linux-wayland-xwayland branch November 19, 2026 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant