[mutter] window: Add meta_window_lower_with_transients()
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window: Add meta_window_lower_with_transients()
- Date: Wed, 4 Aug 2021 15:07:30 +0000 (UTC)
commit eed1db43795f02aae5c71a388febbad2aa8cdbd3
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 29 02:37:26 2021 +0200
window: Add meta_window_lower_with_transients()
The only thing x11-specific about the existing code is that it is only
used to implement titlebar actions on server-side decorations.
We are about to bring that functionality to wayland, so move the code
into MetaWayland.
https://gitlab.gnome.org/GNOME/mutter/-/issues/602
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1944>
src/core/window.c | 56 +++++++++++++++++++++++++++++++++++++++
src/meta/window.h | 4 +++
src/x11/meta-x11-window-control.c | 50 +---------------------------------
3 files changed, 61 insertions(+), 49 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index ea56f33283..3d6241e387 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5176,6 +5176,62 @@ meta_window_lower (MetaWindow *window)
meta_stack_lower (window->display->stack, window);
}
+static gboolean
+lower_window_and_transients (MetaWindow *window,
+ gpointer user_data)
+{
+ MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
+
+ meta_window_lower (window);
+
+ meta_window_foreach_transient (window, lower_window_and_transients, NULL);
+
+ if (meta_prefs_get_raise_on_click ())
+ {
+ /* Move window to the back of the focusing workspace's MRU list.
+ * Do extra sanity checks to avoid possible race conditions.
+ * (Borrowed from window.c.)
+ */
+ if (workspace_manager->active_workspace &&
+ meta_window_located_on_workspace (window,
+ workspace_manager->active_workspace))
+ {
+ GList *link;
+ link = g_list_find (workspace_manager->active_workspace->mru_list,
+ window);
+ g_assert (link);
+
+ workspace_manager->active_workspace->mru_list =
+ g_list_remove_link (workspace_manager->active_workspace->mru_list,
+ link);
+ g_list_free (link);
+
+ workspace_manager->active_workspace->mru_list =
+ g_list_append (workspace_manager->active_workspace->mru_list,
+ window);
+ }
+ }
+
+ return FALSE;
+}
+
+void
+meta_window_lower_with_transients (MetaWindow *window,
+ uint32_t timestamp)
+{
+ MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
+
+ lower_window_and_transients (window, NULL);
+
+ /* Rather than try to figure that out whether we just lowered
+ * the focus window, assume that's always the case. (Typically,
+ * this will be invoked via keyboard action or by a mouse action;
+ * in either case the window or a modal child will have been focused.) */
+ meta_workspace_focus_default_window (workspace_manager->active_workspace,
+ NULL,
+ timestamp);
+}
+
/*
* Move window to the requested workspace; append controls whether new WS
* should be created if one does not exist.
diff --git a/src/meta/window.h b/src/meta/window.h
index 3157d44ee4..2b69269d13 100644
--- a/src/meta/window.h
+++ b/src/meta/window.h
@@ -311,6 +311,10 @@ void meta_window_raise (MetaWindow *window);
META_EXPORT
void meta_window_lower (MetaWindow *window);
+META_EXPORT
+void meta_window_lower_with_transients (MetaWindow *window,
+ uint32_t timestamp);
+
META_EXPORT
const char *meta_window_get_title (MetaWindow *window);
diff --git a/src/x11/meta-x11-window-control.c b/src/x11/meta-x11-window-control.c
index 3af43ce0cb..4754be5498 100644
--- a/src/x11/meta-x11-window-control.c
+++ b/src/x11/meta-x11-window-control.c
@@ -61,62 +61,14 @@ meta_x11_wm_queue_frame_resize (MetaX11Display *x11_display,
meta_window_frame_size_changed (window);
}
-static gboolean
-lower_window_and_transients (MetaWindow *window,
- gpointer data)
-{
- MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
-
- meta_window_lower (window);
-
- meta_window_foreach_transient (window, lower_window_and_transients, NULL);
-
- if (meta_prefs_get_raise_on_click ())
- {
- /* Move window to the back of the focusing workspace's MRU list.
- * Do extra sanity checks to avoid possible race conditions.
- * (Borrowed from window.c.)
- */
- if (workspace_manager->active_workspace &&
- meta_window_located_on_workspace (window,
- workspace_manager->active_workspace))
- {
- GList* link;
- link = g_list_find (workspace_manager->active_workspace->mru_list,
- window);
- g_assert (link);
-
- workspace_manager->active_workspace->mru_list =
- g_list_remove_link (workspace_manager->active_workspace->mru_list,
- link);
- g_list_free (link);
-
- workspace_manager->active_workspace->mru_list =
- g_list_append (workspace_manager->active_workspace->mru_list,
- window);
- }
- }
-
- return FALSE;
-}
-
void
meta_x11_wm_user_lower_and_unfocus (MetaX11Display *x11_display,
Window frame_xwindow,
uint32_t timestamp)
{
MetaWindow *window = window_from_frame (x11_display, frame_xwindow);
- MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
-
- lower_window_and_transients (window, NULL);
- /* Rather than try to figure that out whether we just lowered
- * the focus window, assume that's always the case. (Typically,
- * this will be invoked via keyboard action or by a mouse action;
- * in either case the window or a modal child will have been focused.) */
- meta_workspace_focus_default_window (workspace_manager->active_workspace,
- NULL,
- timestamp);
+ meta_window_lower_with_transients (window, timestamp);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]