Skip to content

Wayland popup moving

Jonas Ådahl requested to merge jadahl/gtk:wip/xdg-popup-move into master

This adds support for synchronized popup moving. It depends on in-progress xdg-shell protocol additions.

It currently relies on adding a "layout" phase that more or less does a layout step on the server. In the mean time, the client side state is frozen.

This allows us to do synchronized popup moving while still using the constraining mechanisms from xdg_popup.

Please ignore every commit before and including gdk: Remove gdk_surface_move_resize() API. See !1016 (merged) for that.

It currently has one known unresolved relatively major issue: when moving a popup together with updating the parent, we'll get half the frame rate. This is due to the fact that the popup is moved during a frame clock "tick", meaning we will most definitely miss this frame for drawing the popup, meaning both will be updated later. The dumb way to resolve this is adding a round trip just after queueing a popup layout (as the server will reply immediately), meaning we'll queue a new frame for the popup during early of the frame tick of the updated parent frame. A better way would probably be to see that we layout just after a previous frame so that we have enough time to get a response from the server before drawing the next time. IMHO that issue alone should not stop this from being merged.

This needs https://gitlab.freedesktop.org/jadahl/wayland-protocols/commits/wip/xdg-popup-move for the protocol additions.

Currently the mutter implementation is in need for some cleaning before being published. I'll post here when it's available.

Some interactive testing instructions for when the mutter branch is made available:

Open testpopover, uncheck the autohide box, and open some popover.

  • Resize the window from either edges. The popover should move perfectly with the widget on screen.
  • Make the popover open upwards. Enter some submenu causing the popover to be resized. This should result in the popup being resized, but stay "stuck" to the widget it's aligned to.
  • Move the parent window around. The popup should stay attached to its parent, but also trigger popup moving making it stay within the screen, if it is moved in a way making the popover partly go off-screen.
Edited by Jonas Ådahl

Merge request reports