From: John Lindgren Date: Tue, 17 Oct 2023 05:28:36 +0000 (-0400) Subject: xdg,xwayland: raise sub-view correctly relative to other sub-views X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=a047e4a4e309c04300d3d3a7fb12e78bf3139e88;p=proto%2Flabwc.git xdg,xwayland: raise sub-view correctly relative to other sub-views 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. --- diff --git a/src/xdg.c b/src/xdg.c index 61130101..c913cb93 100644 --- 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); } diff --git a/src/xwayland.c b/src/xwayland.c index 4b1fc7ee..ca1304dd 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -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); }