mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
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>
This commit is contained in:
parent
3baf750e42
commit
eed1db4379
@ -5176,6 +5176,62 @@ meta_window_lower (MetaWindow *window)
|
|||||||
meta_stack_lower (window->display->stack, 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
|
* Move window to the requested workspace; append controls whether new WS
|
||||||
* should be created if one does not exist.
|
* should be created if one does not exist.
|
||||||
|
@ -311,6 +311,10 @@ void meta_window_raise (MetaWindow *window);
|
|||||||
META_EXPORT
|
META_EXPORT
|
||||||
void meta_window_lower (MetaWindow *window);
|
void meta_window_lower (MetaWindow *window);
|
||||||
|
|
||||||
|
META_EXPORT
|
||||||
|
void meta_window_lower_with_transients (MetaWindow *window,
|
||||||
|
uint32_t timestamp);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
const char *meta_window_get_title (MetaWindow *window);
|
const char *meta_window_get_title (MetaWindow *window);
|
||||||
|
|
||||||
|
@ -61,62 +61,14 @@ meta_x11_wm_queue_frame_resize (MetaX11Display *x11_display,
|
|||||||
meta_window_frame_size_changed (window);
|
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
|
void
|
||||||
meta_x11_wm_user_lower_and_unfocus (MetaX11Display *x11_display,
|
meta_x11_wm_user_lower_and_unfocus (MetaX11Display *x11_display,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
uint32_t timestamp)
|
uint32_t timestamp)
|
||||||
{
|
{
|
||||||
MetaWindow *window = window_from_frame (x11_display, frame_xwindow);
|
MetaWindow *window = window_from_frame (x11_display, frame_xwindow);
|
||||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
|
||||||
|
|
||||||
lower_window_and_transients (window, NULL);
|
meta_window_lower_with_transients (window, timestamp);
|
||||||
|
|
||||||
/* 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user