types: implement xdg-toplevel-drag-v1 protocol

This protocol allows clients to attach a toplevel window to an ongoing
drag-and-drop operation, enabling features like browser tab tear-off.

The attached toplevel follows the cursor during the drag, moving as if
xdg_toplevel.move was called. The window is automatically detached when
unmapped or when its surface is destroyed.

Implementation details:

- Listen to both unmap and destroy events on the toplevel surface to
  properly clean up when the surface is destroyed while still mapped

- Emit new_toplevel_drag event when a drag is created, allowing
  compositors to track attached toplevels

- The toplevel pointer becomes NULL when detached, which compositors
  must handle during motion events.
This commit is contained in:
Ryan Walklin 2025-12-12 16:46:19 +13:00
parent 0e9c6ddefa
commit 44475dc062
4 changed files with 388 additions and 0 deletions

View file

@ -104,6 +104,7 @@ wlr_files += files(
'wlr_xdg_foreign_registry.c',
'wlr_xdg_output_v1.c',
'wlr_xdg_system_bell_v1.c',
'wlr_xdg_toplevel_drag_v1.c',
'wlr_xdg_toplevel_icon_v1.c',
'wlr_xdg_toplevel_tag_v1.c',
)