1
0
Fork 0

window: Move has_custom_frame_extents to WindowX11

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
This commit is contained in:
Bilal Elmoussaoui 2024-01-11 15:31:54 +01:00 committed by Marge Bot
parent b4b896d4db
commit acbb14f34b
7 changed files with 15 additions and 39 deletions

View file

@ -384,6 +384,9 @@ has_shadow (MetaWindowActorX11 *actor_x11)
{
MetaWindow *window =
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
MetaWindowX11 *x11_window = META_WINDOW_X11 (window);
MetaWindowX11Private *priv =
meta_window_x11_get_private (x11_window);
if (actor_x11->shadow_mode == META_SHADOW_MODE_FORCED_OFF)
return FALSE;
@ -422,7 +425,7 @@ has_shadow (MetaWindowActorX11 *actor_x11)
* If a window specifies that it has custom frame extents, that likely
* means that it is drawing a shadow itself. Don't draw our own.
*/
if (window->has_custom_frame_extents)
if (priv->has_custom_frame_extents)
return FALSE;
/*

View file

@ -302,7 +302,6 @@ struct _MetaWindow
know about for this window */
guint32 net_wm_user_time;
gboolean has_custom_frame_extents;
MetaFrameBorder custom_frame_extents;
/* The rectangles here are in "frame rect" coordinates. See the

View file

@ -6010,35 +6010,6 @@ meta_window_get_tile_area (MetaWindow *window,
tile_area->x += work_area.width - tile_area->width;
}
/**
* meta_window_is_client_decorated:
*
* Check if if the window has decorations drawn by the client.
*
* `window->decorated` refers only to whether we should add decorations.
*/
gboolean
meta_window_is_client_decorated (MetaWindow *window)
{
if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
{
/* Assume all Wayland clients draw decorations - not strictly
* true but good enough for current purposes.
*/
return TRUE;
}
else
{
/* Currently the implementation here is hackish -
* has_custom_frame_extents() is set if _GTK_FRAME_EXTENTS is set
* to any value even 0. GTK+ always sets _GTK_FRAME_EXTENTS for
* client-side-decorated window, even if the value is 0 because
* the window is maxized and has no invisible borders or shadows.
*/
return window->has_custom_frame_extents;
}
}
/**
* meta_window_foreach_transient:
* @window: a #MetaWindow

View file

@ -423,9 +423,6 @@ gboolean meta_window_allows_move (MetaWindow *window);
META_EXPORT
gboolean meta_window_allows_resize (MetaWindow *window);
META_EXPORT
gboolean meta_window_is_client_decorated (MetaWindow *window);
META_EXPORT
gboolean meta_window_titlebar_is_onscreen (MetaWindow *window);

View file

@ -324,13 +324,16 @@ meta_window_set_custom_frame_extents (MetaWindow *window,
MetaFrameBorder *extents,
gboolean is_initial)
{
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv =
meta_window_x11_get_private (window_x11);
if (extents)
{
if (window->has_custom_frame_extents &&
if (priv->has_custom_frame_extents &&
memcmp (&window->custom_frame_extents, extents, sizeof (MetaFrameBorder)) == 0)
return;
window->has_custom_frame_extents = TRUE;
priv->has_custom_frame_extents = TRUE;
window->custom_frame_extents = *extents;
/* If we're setting the frame extents on map, then this is telling
@ -346,10 +349,10 @@ meta_window_set_custom_frame_extents (MetaWindow *window,
}
else
{
if (!window->has_custom_frame_extents)
if (!priv->has_custom_frame_extents)
return;
window->has_custom_frame_extents = FALSE;
priv->has_custom_frame_extents = FALSE;
memset (&window->custom_frame_extents, 0, sizeof (window->custom_frame_extents));
}

View file

@ -100,6 +100,7 @@ struct _MetaWindowX11Private
/* maintained by group.c */
MetaGroup *group;
gboolean has_custom_frame_extents;
MetaSyncCounter sync_counter;
/* Used by keybindings.c */

View file

@ -2607,6 +2607,8 @@ meta_window_move_resize_request (MetaWindow *window,
int new_width,
int new_height)
{
MetaWindowX11Private *priv =
meta_window_x11_get_private (META_WINDOW_X11 (window));
int x, y, width, height;
gboolean allow_position_change;
gboolean in_grab_op;
@ -2763,7 +2765,7 @@ meta_window_move_resize_request (MetaWindow *window,
* the monitor.
*/
if (meta_prefs_get_force_fullscreen() &&
(window->decorated || !meta_window_is_client_decorated (window)) &&
(window->decorated || !priv->has_custom_frame_extents) &&
mtk_rectangle_equal (&rect, &monitor_rect) &&
window->has_fullscreen_func &&
!window->fullscreen)