core: Guard MetaGroup usage
For now, we just guard part of the group header as it is consumed by gnome-shell. Ideally, we would drop that use case and make the whole header private. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
This commit is contained in:
parent
43351b483f
commit
f0c22cb3bc
8 changed files with 61 additions and 36 deletions
|
@ -1986,14 +1986,11 @@ in_tab_chain (MetaWindow *window,
|
|||
gboolean in_normal_tab_chain_type;
|
||||
gboolean in_normal_tab_chain;
|
||||
gboolean in_dock_tab_chain;
|
||||
gboolean in_group_tab_chain;
|
||||
gboolean in_group_tab_chain = FALSE;
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaGroup *focus_group = NULL;
|
||||
MetaGroup *window_group = NULL;
|
||||
|
||||
in_normal_tab_chain_type = window->type != META_WINDOW_DOCK && window->type != META_WINDOW_DESKTOP;
|
||||
in_normal_tab_chain = meta_window_is_focusable (window) && in_normal_tab_chain_type && !window->skip_taskbar;
|
||||
in_dock_tab_chain = meta_window_is_focusable (window) && (!in_normal_tab_chain_type || window->skip_taskbar);
|
||||
|
||||
if (window->display->focus_window &&
|
||||
window->display->focus_window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
focus_group = meta_window_get_group (window->display->focus_window);
|
||||
|
@ -2002,6 +1999,11 @@ in_tab_chain (MetaWindow *window,
|
|||
window_group = meta_window_get_group (window);
|
||||
|
||||
in_group_tab_chain = meta_window_is_focusable (window) && (!focus_group || window_group == focus_group);
|
||||
#endif
|
||||
|
||||
in_normal_tab_chain_type = window->type != META_WINDOW_DOCK && window->type != META_WINDOW_DESKTOP;
|
||||
in_normal_tab_chain = meta_window_is_focusable (window) && in_normal_tab_chain_type && !window->skip_taskbar;
|
||||
in_dock_tab_chain = meta_window_is_focusable (window) && (!in_normal_tab_chain_type || window->skip_taskbar);
|
||||
|
||||
return (type == META_TAB_LIST_NORMAL && in_normal_tab_chain)
|
||||
|| (type == META_TAB_LIST_DOCKS && in_dock_tab_chain)
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
#include "meta/prefs.h"
|
||||
#include "meta/workspace.h"
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
#include "x11/window-x11-private.h"
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_LEFT,
|
||||
|
@ -410,7 +414,9 @@ avoid_being_obscured_as_second_modal_dialog (MetaWindow *window,
|
|||
|
||||
if (window->denied_focus_and_not_transient &&
|
||||
window->type == META_WINDOW_MODAL_DIALOG &&
|
||||
meta_window_same_application (window, focus_window) &&
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
meta_window_x11_same_application (window, focus_window) &&
|
||||
#endif
|
||||
window_overlaps_focus_window (window))
|
||||
{
|
||||
find_most_freespace (window, focus_window, *x, *y, x, y);
|
||||
|
|
|
@ -36,11 +36,14 @@
|
|||
#include "core/meta-workspace-manager-private.h"
|
||||
#include "core/window-private.h"
|
||||
#include "core/workspace-private.h"
|
||||
#include "meta/group.h"
|
||||
#include "meta/prefs.h"
|
||||
#include "meta/workspace.h"
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
#include "meta/group.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
#include "x11/window-x11.h"
|
||||
#endif
|
||||
|
||||
#define WINDOW_TRANSIENT_FOR_WHOLE_GROUP(w) \
|
||||
(meta_window_has_transient_type (w) && w->transient_for == NULL)
|
||||
|
@ -502,6 +505,7 @@ create_constraints (Constraint **constraints,
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (WINDOW_TRANSIENT_FOR_WHOLE_GROUP (w))
|
||||
{
|
||||
GSList *group_windows;
|
||||
|
@ -550,7 +554,9 @@ create_constraints (Constraint **constraints,
|
|||
|
||||
g_slist_free (group_windows);
|
||||
}
|
||||
else if (w->transient_for != NULL)
|
||||
else
|
||||
#endif
|
||||
if (w->transient_for != NULL)
|
||||
{
|
||||
MetaWindow *parent;
|
||||
|
||||
|
|
|
@ -717,10 +717,6 @@ void meta_window_get_tile_area (MetaWindow *window,
|
|||
MetaTileMode mode,
|
||||
MtkRectangle *tile_area);
|
||||
|
||||
|
||||
gboolean meta_window_same_application (MetaWindow *window,
|
||||
MetaWindow *other_window);
|
||||
|
||||
void meta_window_free_delete_dialog (MetaWindow *window);
|
||||
|
||||
MetaStackLayer meta_window_get_default_layer (MetaWindow *window);
|
||||
|
|
|
@ -79,13 +79,13 @@
|
|||
#include "core/util-private.h"
|
||||
#include "core/workspace-private.h"
|
||||
#include "meta/compositor-mutter.h"
|
||||
#include "meta/group.h"
|
||||
#include "meta/meta-cursor-tracker.h"
|
||||
#include "meta/meta-enum-types.h"
|
||||
#include "meta/prefs.h"
|
||||
#include "mtk/mtk-x11.h"
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
#include "meta/group.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
#include "x11/window-props.h"
|
||||
#include "x11/window-x11-private.h"
|
||||
|
@ -1444,10 +1444,10 @@ meta_window_unmanage (MetaWindow *window,
|
|||
if (meta_prefs_get_workspaces_only_on_primary ())
|
||||
meta_window_on_all_workspaces_changed (window);
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->fullscreen)
|
||||
{
|
||||
MetaGroup *group;
|
||||
|
||||
MetaGroup *group = NULL;
|
||||
/* If the window is fullscreen, it may be forcing
|
||||
* other windows in its group to a higher layer
|
||||
*/
|
||||
|
@ -1459,16 +1459,18 @@ meta_window_unmanage (MetaWindow *window,
|
|||
if (group)
|
||||
meta_group_update_layers (group);
|
||||
}
|
||||
|
||||
meta_stack_thaw (window->display->stack);
|
||||
}
|
||||
#endif
|
||||
|
||||
meta_display_remove_pending_pings_for_window (window->display, window);
|
||||
|
||||
/* safe to do this early as group.c won't re-add to the
|
||||
* group if window->unmanaging */
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
meta_window_shutdown_group (window);
|
||||
#endif
|
||||
|
||||
/* If we have the focus, focus some other window.
|
||||
* This is done first, so that if the unmap causes
|
||||
|
@ -4463,6 +4465,7 @@ meta_window_get_titlebar_rect (MetaWindow *window,
|
|||
const char*
|
||||
meta_window_get_startup_id (MetaWindow *window)
|
||||
{
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->startup_id == NULL && window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
MetaGroup *group;
|
||||
|
@ -4472,6 +4475,7 @@ meta_window_get_startup_id (MetaWindow *window)
|
|||
if (group != NULL)
|
||||
return meta_group_get_startup_id (group);
|
||||
}
|
||||
#endif
|
||||
|
||||
return window->startup_id;
|
||||
}
|
||||
|
@ -5928,19 +5932,6 @@ meta_window_get_tile_area (MetaWindow *window,
|
|||
tile_area->x += work_area.width - tile_area->width;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_same_application (MetaWindow *window,
|
||||
MetaWindow *other_window)
|
||||
{
|
||||
MetaGroup *group = meta_window_get_group (window);
|
||||
MetaGroup *other_group = meta_window_get_group (other_window);
|
||||
|
||||
return
|
||||
group!=NULL &&
|
||||
other_group!=NULL &&
|
||||
group==other_group;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_is_client_decorated:
|
||||
*
|
||||
|
@ -6119,18 +6110,23 @@ meta_window_get_default_layer (MetaWindow *window)
|
|||
void
|
||||
meta_window_update_layer (MetaWindow *window)
|
||||
{
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaGroup *group = NULL;
|
||||
|
||||
meta_stack_freeze (window->display->stack);
|
||||
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
group = meta_window_get_group (window);
|
||||
|
||||
meta_stack_freeze (window->display->stack);
|
||||
if (group)
|
||||
meta_group_update_layers (group);
|
||||
else
|
||||
meta_stack_update_layer (window->display->stack, window);
|
||||
meta_stack_thaw (window->display->stack);
|
||||
#else
|
||||
meta_stack_freeze (window->display->stack);
|
||||
meta_stack_update_layer (window->display->stack, window);
|
||||
meta_stack_thaw (window->display->stack);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ensure_mru_position_after ensures that window appears after
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
#include <glib.h>
|
||||
|
||||
#include "meta/common.h"
|
||||
|
@ -40,14 +42,15 @@ void meta_window_shutdown_group (MetaWindow *window);
|
|||
META_EXPORT
|
||||
void meta_window_group_leader_changed (MetaWindow *window);
|
||||
|
||||
META_EXPORT
|
||||
GSList* meta_group_list_windows (MetaGroup *group);
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
/* note, can return NULL */
|
||||
META_EXPORT
|
||||
MetaGroup *meta_x11_display_lookup_group (MetaX11Display *x11_display,
|
||||
Window group_leader);
|
||||
|
||||
META_EXPORT
|
||||
GSList* meta_group_list_windows (MetaGroup *group);
|
||||
|
||||
META_EXPORT
|
||||
void meta_group_update_layers (MetaGroup *group);
|
||||
|
||||
|
@ -60,3 +63,4 @@ int meta_group_get_size (MetaGroup *group);
|
|||
META_EXPORT
|
||||
gboolean meta_group_property_notify (MetaGroup *group,
|
||||
XEvent *event);
|
||||
#endif
|
||||
|
|
|
@ -105,4 +105,7 @@ Window meta_window_x11_get_xtransient_for (MetaWindow *window);
|
|||
|
||||
gboolean meta_window_x11_has_pointer (MetaWindow *window);
|
||||
|
||||
gboolean meta_window_x11_same_application (MetaWindow *window,
|
||||
MetaWindow *other_window);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -2564,7 +2564,7 @@ meta_window_x11_update_shape_region (MetaWindow *window)
|
|||
meta_window_set_shape_region (window, region);
|
||||
}
|
||||
|
||||
/* Generally meta_window_same_application() is a better idea
|
||||
/* Generally meta_window_x11_same_application() is a better idea
|
||||
* of "sameness", since it handles the case where multiple apps
|
||||
* want to look like the same app or the same app wants to look
|
||||
* like multiple apps, but in the case of workarounds for legacy
|
||||
|
@ -2841,7 +2841,7 @@ meta_window_x11_configure_request (MetaWindow *window,
|
|||
window->desc);
|
||||
}
|
||||
else if (active_window &&
|
||||
!meta_window_same_application (window, active_window) &&
|
||||
!meta_window_x11_same_application (window, active_window) &&
|
||||
!meta_window_same_client (window, active_window) &&
|
||||
XSERVER_TIME_IS_BEFORE (window->net_wm_user_time,
|
||||
active_window->net_wm_user_time))
|
||||
|
@ -4486,3 +4486,15 @@ meta_window_x11_has_pointer (MetaWindow *window)
|
|||
|
||||
return meta_x11_display_lookup_x_window (x11_display, child) == window;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_x11_same_application (MetaWindow *window,
|
||||
MetaWindow *other_window)
|
||||
{
|
||||
MetaGroup *group = meta_window_get_group (window);
|
||||
MetaGroup *other_group = meta_window_get_group (other_window);
|
||||
|
||||
return (group != NULL &&
|
||||
other_group != NULL &&
|
||||
group == other_group);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue