]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xdg,xwayland: raise sub-view correctly relative to other sub-views
authorJohn Lindgren <john@jlindgren.net>
Tue, 17 Oct 2023 05:28:36 +0000 (01:28 -0400)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 17 Oct 2023 16:41:43 +0000 (18:41 +0200)
When a parent view has multiple sub-views (dialogs) visible, focusing
one sub-view ought to raise it above the others. This doesn't currently
happen -- focusing a sub-view raises the whole group of views together,
but has no effect on the relative stacking order between them.

This seems like a simple oversight in xdg/xwayland_view_move_to_front()
that's pretty easy to fix.

Add FIXMEs to deduplicate this logic in future.

Tested with HomeBank: the Import dialog pops up an additional Open File
dialog, which before this change appears behind the Import dialog (and
clicking on it does not raise it to the front). After this change, the
Open File dialog appears in front as expected.

src/xdg.c
src/xwayland.c

index 61130101601e94ce3ce8aa89f0f4d6088e7b578d..c913cb930c225b6006ce34c6081ec963d4d27830 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -349,14 +349,20 @@ static void
 xdg_toplevel_view_move_to_front(struct view *view)
 {
        struct view *root = xdg_toplevel_view_get_root(view);
+       /* FIXME: this exact code is repeated in xwayland.c */
        view_impl_move_to_front(root);
        view_impl_move_sub_views(root, LAB_TO_FRONT);
+       /* make sure view is in front of other sub-views */
+       if (view != root) {
+               view_impl_move_to_front(view);
+       }
 }
 
 static void
 xdg_toplevel_view_move_to_back(struct view *view)
 {
        struct view *root = xdg_toplevel_view_get_root(view);
+       /* FIXME: this exact code is repeated in xwayland.c */
        view_impl_move_sub_views(root, LAB_TO_BACK);
        view_impl_move_to_back(root);
 }
index 4b1fc7ee1e6802c8f51fc20a57914664d23ddfd9..ca1304dd06d658b789a75d60da0d0aef1f888170 100644 (file)
@@ -614,14 +614,20 @@ static void
 xwayland_view_move_to_front(struct view *view)
 {
        struct view *root = xwayland_view_get_root(view);
+       /* FIXME: this exact code is repeated in xdg.c */
        view_impl_move_to_front(root);
        view_impl_move_sub_views(root, LAB_TO_FRONT);
+       /* make sure view is in front of other sub-views */
+       if (view != root) {
+               view_impl_move_to_front(view);
+       }
 }
 
 static void
 xwayland_view_move_to_back(struct view *view)
 {
        struct view *root = xwayland_view_get_root(view);
+       /* FIXME: this exact code is repeated in xdg.c */
        view_impl_move_sub_views(root, LAB_TO_BACK);
        view_impl_move_to_back(root);
 }