Skip to content

Fix a variety of focus and redraw issues

Brian Tarricone requested to merge fix-socket-drawing-issues into main

This should hopefully fix the embedded area not being redrawn after being hidden. The issue was that GDK only redraws when it gets a wl_callback.done in response to a callback created via wl_surface.frame. Now, if there are outstanding callbacks when the embedded view is hidden, we destroy their remote callback instances, and then when the embedded view gets shown again, we synthesize wl_callback.done events for them. (I was technically doing that before, but only for callbacks created while the view was hidden; now I also do it for callbacks created before the view was hidden, as long as they haven't gotten a done event from the parent compositor yet.)

There was also an issue where if the embedded view disconnected, the socket widget would keep focus and never give it up. Now I synthesize a wl_pointer.leave event when the socket's plug goes away.

I also decided to create the proper separation between the socket widget, the widget that we're using the window as a parent for our subsurface, and the toplevel widget. Previously it was sorta assumed that the parent and the toplevel will the same widget, but that doesn't have to be true (even though it will be most of the time). Now they are tracked separately.

There were also annoying issues around the order of mapping GdkWindows. GtkWindow will do something pretty annoying in its map method: it marks itself as mapped, then maps all its children, recursively, and then maps itself. So when we're in the socket's map method, the toplevel is usually not mapped yet, which doesn't help us. At any rate, we mainly just need to know when our parent widget is mapped (which, of course, may be the same as the toplevel), unmapped, or destroyed. Now things are separated out nicely: we do need to know some things about the toplevel, so we still track those, but we keep the specific actions needed for the toplevel vs. the parent widget separate.

Finally, the socket wasn't positioning its subsurface properly in some circumstances, so I've rewritten the code that finds the offset in a better way.

Closes #27 (closed) Closes #28 (closed)

Merge request reports