Skip to content

wlr: expose popup unconstraining, fd event sources, the xwayland seat and seat selections - #10

Merged
DeedleFake merged 5 commits into
masterfrom
xdg-popup-unconstrain
Oct 1, 2026
Merged

DeedleFake merged 5 commits into
masterfrom
xdg-popup-unconstrain

Conversation

@DeedleFake

Copy link
Copy Markdown
Owner

Plain bindings that kawa needs for three fixes in DeedleFake/kawa#16. Each one is its own commit and wraps a single wlroots or libwayland call or event, with nothing added on top.

  • XDGPopup.UnconstrainFromBox wraps wlr_xdg_popup_unconstrain_from_box. The box is in the coordinates of the popup's root toplevel surface, as wlroots expects. kawa calls it on a popup's initial commit so menus near a screen edge flip or slide back onto the screen instead of spilling off it.
  • EventLoop.AddFd and EventSource.Remove wrap wl_event_loop_add_fd and wl_event_source_remove, plus the WL_EVENT_* mask constants. kawa uses them to get a pid from the goroutine that waits on a program started from New back onto the event loop thread through a pipe. It then removes that program's New box when the program exits without ever opening a window.
  • Xwayland.SetSeat wraps wlr_xwayland_set_seat. Without a seat, wlroots logs not handling selection events: no seat assigned to xwayland and X clients get no clipboard. wlroots keeps the seat until Xwayland is ready, so kawa calls it right after creating Xwayland.
  • Seat.OnRequestSetSelection, Seat.SetSelection, Seat.OnRequestSetPrimarySelection and Seat.SetPrimarySelection, plus DataSource and PrimarySelectionSource handles, wrap the seat's request_set_selection and request_set_primary_selection events and wlr_seat_set_selection and wlr_seat_set_primary_selection. Clients, Xwayland included, can only ask for a selection, and nothing changes until the compositor sets it. kawa never handled those requests, so no client could set the clipboard at all.

Verified with go build ./... and go vet ./... against wlroots 0.20.2, and by running kawa built against this branch in a nested session:

  • popups near the right and bottom edges, and their submenus, now flip or slide back onto the screen;
  • a New box disappears once the program exits;
  • copying and pasting works between X and Wayland in both directions, for both the clipboard and the primary selection.

@DeedleFake
DeedleFake merged commit 1a3ef14 into master Oct 1, 2026
2 checks passed
@DeedleFake
DeedleFake deleted the xdg-popup-unconstrain branch October 1, 2026 16:09
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