Skip to content

Draft: gdk/wayland/surface: Add `GdkWaylandCustomSurface`

Ian Douglas Scott requested to merge ids1024/gtk:gdk-wayland-custom-surface into main

A prototype implementation of the GdkWaylandCustomSurface type suggested in #2132 for uses like layer-shell.

xdg_surface:request:get_popup documents that "If null is passed as a parent, a parent surface must be specified using some other protocol, before committing the initial state". So the way layer-shell handles this matches how xdg-shell expects extension protocols to work, and supporting a callback here could be useful for other such extensions. I don't know if any other protocol currently works this way.

I'm not entirely sure how best to handle present and compute_size for a custom surface. I copied the simple implementations from GdkDragSurface.

The harder problem is actually using this from GTK. It isn't possible to use GtkWindow with a custom surface, and just adding a way to do that would be problematic if that surface isn't a GdkToplevel. Otherwise, it's necessary be able to implement GtkRoot and GtkNative, but as noted in #2132 (comment 1341726), I found that requires various other private APIs, and the event handling logic assumes root is a GtkWindow.

Includes the commit from !4203 (merged), since that is needed for correct behavior. Does not include the refactoring from !4227 (merged), since that doesn't impact behavior here; it works with or without that.

Merge request reports