1
0
Fork 0

window/x11: Add a is_ssd helper

Would be useful for moving frame field to WindowX11 in the upcoming commits

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
This commit is contained in:
Bilal Elmoussaoui 2024-05-21 23:40:39 +02:00 committed by Marge Bot
parent fff528cbf1
commit 751ef5abd2
5 changed files with 38 additions and 9 deletions

View file

@ -91,7 +91,7 @@ constrain_whatever (MetaWindow *window,
// we know we can return TRUE here because we exited early
// if the constraint could not be satisfied; not that the
// return value is heeded in this case...
return TRUE;
return TRUE;
}
```
*/
@ -709,9 +709,14 @@ update_onscreen_requirements (MetaWindow *window,
/* Update whether we want future constraint runs to require the
* titlebar to be visible.
*/
if (window->frame && window->decorated)
#ifdef HAVE_X11_CLIENT
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 && window->decorated)
{
MtkRectangle titlebar_rect, frame_rect;
MetaFrame *frame = meta_window_x11_get_frame (window);
if (!frame)
return;
meta_window_get_titlebar_rect (window, &titlebar_rect);
meta_window_get_frame_rect (window, &frame_rect);
@ -730,6 +735,7 @@ update_onscreen_requirements (MetaWindow *window,
window->desc,
window->require_titlebar_visible ? "TRUE" : "FALSE");
}
#endif
}
static inline void
@ -1703,12 +1709,21 @@ constrain_to_single_monitor (MetaWindow *window,
ConstraintPriority priority,
gboolean check_only)
{
/* a quirk for x11 clients that tries to move their windows
* by themselves when doing interactive moves.
*/
gboolean client_driven_interactive_move = TRUE;
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (info->backend);
if (priority > PRIORITY_ENTIRELY_VISIBLE_ON_SINGLE_MONITOR)
return TRUE;
#ifdef HAVE_X11_CLIENT
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
client_driven_interactive_move = meta_window_x11_get_frame (window) == NULL;
#endif
/* Exit early if we know the constraint won't apply--note that this constraint
* is only meant for normal windows (e.g. we don't want docks to be shoved
* "onscreen" by their own strut) and we can't apply it to frameless windows
@ -1718,7 +1733,7 @@ constrain_to_single_monitor (MetaWindow *window,
window->type == META_WINDOW_DOCK ||
meta_monitor_manager_get_num_logical_monitors (monitor_manager) == 1 ||
!window->require_on_single_monitor ||
!window->frame ||
client_driven_interactive_move ||
info->is_user_action ||
meta_window_get_placement_rule (window))
return TRUE;

View file

@ -808,9 +808,11 @@ client_window_should_be_mapped (MetaWindow *window)
}
#endif
#ifdef HAVE_X11_CLIENT
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
window->decorated && !window->frame)
window->decorated && !meta_window_x11_is_ssd (window))
return FALSE;
#endif
return TRUE;
}
@ -1701,9 +1703,11 @@ meta_window_is_showable (MetaWindow *window)
return FALSE;
#endif
#ifdef HAVE_X11_CLIENT
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
window->decorated && !window->frame)
window->decorated && !meta_window_x11_is_ssd (window))
return FALSE;
#endif
return TRUE;
}

View file

@ -1483,7 +1483,7 @@ handle_other_xevent (MetaX11Display *x11_display,
window = meta_x11_display_lookup_x_window (x11_display,
client_window);
if (window != NULL && window->decorated && !window->frame)
if (window != NULL && window->decorated && !meta_window_x11_is_ssd (window))
{
meta_window_x11_set_frame_xwindow (window,
event->xmaprequest.window);

View file

@ -133,4 +133,7 @@ void meta_window_x11_group_leader_changed (MetaWindow *window);
void meta_window_x11_set_frame_xwindow (MetaWindow *window,
Window xframe);
gboolean meta_window_x11_is_ssd (MetaWindow *window);
G_END_DECLS

View file

@ -2035,6 +2035,13 @@ meta_window_x11_set_transient_for (MetaWindow *window,
return TRUE;
}
gboolean
meta_window_x11_is_ssd (MetaWindow *window)
{
/* Will be updated in the next commits once frame field is moved to WindowX11 */
return window->frame != NULL;
}
static void
meta_window_x11_constructed (GObject *object)
{
@ -2404,7 +2411,7 @@ meta_window_x11_update_input_region (MetaWindow *window)
if (window->decorated)
{
if (!window->frame)
if (!meta_window_x11_is_ssd (window))
{
if (priv->input_region)
meta_window_set_input_region (window, NULL);
@ -2689,7 +2696,7 @@ meta_window_move_resize_request (MetaWindow *window,
window->type);
}
if (window->decorated && !window->frame)
if (window->decorated && !meta_window_x11_is_ssd (window))
{
width = new_width;
height = new_height;
@ -3921,7 +3928,7 @@ meta_window_x11_new (MetaDisplay *display,
"effect", effect,
"attributes", &attrs,
"xwindow", xwindow,
NULL);
NULL);
}
else
#endif