window: Move frame field to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
This commit is contained in:
parent
503c70e284
commit
bcb069f454
20 changed files with 356 additions and 231 deletions
|
@ -125,13 +125,14 @@ send_frame_messages_timeout (gpointer data)
|
|||
MetaWindow *window =
|
||||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||
MetaSyncCounter *sync_counter;
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
|
||||
sync_counter = meta_window_x11_get_sync_counter (window);
|
||||
meta_sync_counter_finish_incomplete (sync_counter);
|
||||
|
||||
if (window->frame)
|
||||
if (frame)
|
||||
{
|
||||
sync_counter = meta_frame_get_sync_counter (window->frame);
|
||||
sync_counter = meta_frame_get_sync_counter (frame);
|
||||
meta_sync_counter_finish_incomplete (sync_counter);
|
||||
}
|
||||
|
||||
|
@ -200,6 +201,7 @@ assign_frame_counter_to_frames (MetaWindowActorX11 *actor_x11)
|
|||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||
MetaCompositor *compositor = window->display->compositor;
|
||||
ClutterStage *stage = meta_compositor_get_stage (compositor);
|
||||
MetaFrame *frame;
|
||||
MetaSyncCounter *sync_counter;
|
||||
|
||||
/* If the window is obscured, then we're expecting to deal with sending
|
||||
|
@ -211,10 +213,10 @@ assign_frame_counter_to_frames (MetaWindowActorX11 *actor_x11)
|
|||
sync_counter = meta_window_x11_get_sync_counter (window);
|
||||
meta_sync_counter_assign_counter_to_frames (sync_counter,
|
||||
clutter_stage_get_frame_counter (stage));
|
||||
|
||||
if (window->frame)
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
if (frame)
|
||||
{
|
||||
sync_counter = meta_frame_get_sync_counter (window->frame);
|
||||
sync_counter = meta_frame_get_sync_counter (frame);
|
||||
meta_sync_counter_assign_counter_to_frames (sync_counter,
|
||||
clutter_stage_get_frame_counter (stage));
|
||||
}
|
||||
|
@ -226,6 +228,7 @@ meta_window_actor_x11_frame_complete (MetaWindowActor *actor,
|
|||
int64_t presentation_time)
|
||||
{
|
||||
MetaWindow *window = meta_window_actor_get_meta_window (actor);
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
MetaSyncCounter *sync_counter;
|
||||
|
||||
if (meta_window_actor_is_destroyed (actor))
|
||||
|
@ -236,9 +239,9 @@ meta_window_actor_x11_frame_complete (MetaWindowActor *actor,
|
|||
frame_info,
|
||||
presentation_time);
|
||||
|
||||
if (window->frame)
|
||||
if (frame)
|
||||
{
|
||||
sync_counter = meta_frame_get_sync_counter (window->frame);
|
||||
sync_counter = meta_frame_get_sync_counter (frame);
|
||||
meta_sync_counter_complete_frame (sync_counter,
|
||||
frame_info,
|
||||
presentation_time);
|
||||
|
@ -411,7 +414,7 @@ has_shadow (MetaWindowActorX11 *actor_x11)
|
|||
* Let the frames client put a shadow around frames - This should override
|
||||
* the restriction about not putting a shadow around ARGB windows.
|
||||
*/
|
||||
if (meta_window_get_frame (window))
|
||||
if (meta_window_x11_get_frame (window))
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
|
@ -568,7 +571,7 @@ clip_shadow_under_window (MetaWindowActorX11 *actor_x11)
|
|||
MetaWindow *window =
|
||||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||
|
||||
if (window->frame)
|
||||
if (meta_window_x11_get_frame (window))
|
||||
return TRUE;
|
||||
|
||||
return meta_window_actor_is_opaque (META_WINDOW_ACTOR (actor_x11));
|
||||
|
@ -798,6 +801,7 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
|||
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
||||
MetaSurfaceActor *surface =
|
||||
meta_window_actor_get_surface (META_WINDOW_ACTOR (actor_x11));
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
uint8_t *mask_data;
|
||||
unsigned int tex_width, tex_height;
|
||||
MetaShapedTexture *stex;
|
||||
|
@ -830,7 +834,7 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
|||
region_to_cairo_path (shape_region, cr);
|
||||
cairo_fill (cr);
|
||||
|
||||
if (window->frame)
|
||||
if (frame)
|
||||
{
|
||||
g_autoptr (MtkRegion) frame_paint_region = NULL;
|
||||
g_autoptr (MtkRegion) scanned_region = NULL;
|
||||
|
@ -864,8 +868,8 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
|||
|
||||
cairo_rectangle (cr,
|
||||
0, 0,
|
||||
window->frame->rect.width,
|
||||
window->frame->rect.height);
|
||||
frame->rect.width,
|
||||
frame->rect.height);
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_fill (cr);
|
||||
|
||||
|
@ -921,10 +925,11 @@ update_shape_region (MetaWindowActorX11 *actor_x11)
|
|||
MetaWindowX11Private *priv = meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
MtkRegion *region = NULL;
|
||||
MtkRectangle client_area;
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
|
||||
get_client_area_rect (actor_x11, &client_area);
|
||||
|
||||
if (window->frame && priv->shape_region)
|
||||
if (frame && priv->shape_region)
|
||||
{
|
||||
region = mtk_region_copy (priv->shape_region);
|
||||
mtk_region_translate (region, client_area.x, client_area.y);
|
||||
|
@ -941,7 +946,7 @@ update_shape_region (MetaWindowActorX11 *actor_x11)
|
|||
region = mtk_region_create_rectangle (&client_area);
|
||||
}
|
||||
|
||||
if (priv->shape_region || window->frame)
|
||||
if (priv->shape_region || frame)
|
||||
build_and_scan_frame_mask (actor_x11, region);
|
||||
|
||||
g_clear_pointer (&actor_x11->shape_region, mtk_region_unref);
|
||||
|
@ -1029,16 +1034,16 @@ update_opaque_region (MetaWindowActorX11 *actor_x11)
|
|||
gboolean is_maybe_transparent;
|
||||
g_autoptr (MtkRegion) opaque_region = NULL;
|
||||
MetaSurfaceActor *surface;
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
|
||||
is_maybe_transparent = is_actor_maybe_transparent (actor_x11);
|
||||
if (is_maybe_transparent &&
|
||||
(priv->opaque_region ||
|
||||
(window->frame && window->frame->opaque_region)))
|
||||
(priv->opaque_region || (frame && frame->opaque_region)))
|
||||
{
|
||||
MtkRectangle client_area;
|
||||
|
||||
if (window->frame && window->frame->opaque_region)
|
||||
opaque_region = mtk_region_copy (window->frame->opaque_region);
|
||||
if (frame && frame->opaque_region)
|
||||
opaque_region = mtk_region_copy (frame->opaque_region);
|
||||
|
||||
get_client_area_rect (actor_x11, &client_area);
|
||||
|
||||
|
@ -1279,6 +1284,7 @@ meta_window_actor_x11_after_paint (MetaWindowActor *actor,
|
|||
MetaSyncCounter *sync_counter;
|
||||
MetaWindowDrag *window_drag;
|
||||
MetaWindow *window;
|
||||
MetaFrame *frame;
|
||||
|
||||
actor_x11->repaint_scheduled = FALSE;
|
||||
|
||||
|
@ -1295,10 +1301,10 @@ meta_window_actor_x11_after_paint (MetaWindowActor *actor,
|
|||
{
|
||||
sync_counter = meta_window_x11_get_sync_counter (window);
|
||||
meta_sync_counter_send_frame_drawn (sync_counter);
|
||||
|
||||
if (window->frame)
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
if (frame)
|
||||
{
|
||||
sync_counter = meta_frame_get_sync_counter (window->frame);
|
||||
sync_counter = meta_frame_get_sync_counter (frame);
|
||||
meta_sync_counter_send_frame_drawn (sync_counter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1299,6 +1299,9 @@ update_move (MetaWindowDrag *window_drag,
|
|||
const MetaLogicalMonitor *wmonitor;
|
||||
MtkRectangle work_area;
|
||||
int monitor;
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrame *frame;
|
||||
#endif
|
||||
|
||||
window->tile_mode = META_TILE_NONE;
|
||||
wmonitor = window->monitor;
|
||||
|
@ -1323,12 +1326,14 @@ update_move (MetaWindowDrag *window_drag,
|
|||
window->saved_rect.x = work_area.x;
|
||||
window->saved_rect.y = work_area.y;
|
||||
|
||||
if (window->frame)
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
frame = META_IS_WINDOW_X11 (window) ? meta_window_x11_get_frame (window) : NULL;
|
||||
if (frame)
|
||||
{
|
||||
window->saved_rect.x += window->frame->child_x;
|
||||
window->saved_rect.y += window->frame->child_y;
|
||||
window->saved_rect.x += frame->child_x;
|
||||
window->saved_rect.y += frame->child_y;
|
||||
}
|
||||
|
||||
#endif
|
||||
window->unconstrained_rect.x = window->saved_rect.x;
|
||||
window->unconstrained_rect.y = window->saved_rect.y;
|
||||
|
||||
|
|
|
@ -37,7 +37,11 @@
|
|||
#include "core/place.h"
|
||||
#include "core/workspace-private.h"
|
||||
#include "meta/prefs.h"
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
#include "x11/meta-x11-frame.h"
|
||||
#include "x11/window-x11-private.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
This is the short and sweet version of how to hack on this file; see
|
||||
|
@ -1782,6 +1786,9 @@ constrain_titlebar_visible (MetaWindow *window,
|
|||
int horiz_amount_offscreen, vert_amount_offscreen;
|
||||
int horiz_amount_onscreen, vert_amount_onscreen;
|
||||
MetaWindowDrag *window_drag;
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrameBorders borders;
|
||||
#endif
|
||||
|
||||
if (priority > PRIORITY_TITLEBAR_VISIBLE)
|
||||
return TRUE;
|
||||
|
@ -1824,19 +1831,18 @@ constrain_titlebar_visible (MetaWindow *window,
|
|||
vert_amount_offscreen = info->current.height - vert_amount_onscreen;
|
||||
horiz_amount_offscreen = MAX (horiz_amount_offscreen, 0);
|
||||
vert_amount_offscreen = MAX (vert_amount_offscreen, 0);
|
||||
bottom_amount = vert_amount_offscreen;
|
||||
/* Allow the titlebar to touch the bottom panel; If there is no titlebar,
|
||||
* require vert_amount to remain on the screen.
|
||||
*/
|
||||
if (window->frame)
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
|
||||
meta_window_x11_get_frame_borders (window, &borders))
|
||||
{
|
||||
MetaFrameBorders borders;
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
|
||||
bottom_amount = info->current.height - borders.visible.top;
|
||||
vert_amount_onscreen = borders.visible.top;
|
||||
}
|
||||
else
|
||||
bottom_amount = vert_amount_offscreen;
|
||||
#endif
|
||||
|
||||
/* Extend the region, have a helper function handle the constraint,
|
||||
* then return the region to its original size.
|
||||
|
@ -1874,6 +1880,9 @@ constrain_partially_onscreen (MetaWindow *window,
|
|||
int top_amount, bottom_amount;
|
||||
int horiz_amount_offscreen, vert_amount_offscreen;
|
||||
int horiz_amount_onscreen, vert_amount_onscreen;
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrameBorders borders;
|
||||
#endif
|
||||
|
||||
if (priority > PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA)
|
||||
return TRUE;
|
||||
|
@ -1903,19 +1912,18 @@ constrain_partially_onscreen (MetaWindow *window,
|
|||
horiz_amount_offscreen = MAX (horiz_amount_offscreen, 0);
|
||||
vert_amount_offscreen = MAX (vert_amount_offscreen, 0);
|
||||
top_amount = vert_amount_offscreen;
|
||||
bottom_amount = vert_amount_offscreen;
|
||||
/* Allow the titlebar to touch the bottom panel; If there is no titlebar,
|
||||
* require vert_amount to remain on the screen.
|
||||
*/
|
||||
if (window->frame)
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
|
||||
meta_window_x11_get_frame_borders (window, &borders))
|
||||
{
|
||||
MetaFrameBorders borders;
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
|
||||
bottom_amount = info->current.height - borders.visible.top;
|
||||
vert_amount_onscreen = borders.visible.top;
|
||||
}
|
||||
else
|
||||
bottom_amount = vert_amount_offscreen;
|
||||
#endif
|
||||
|
||||
/* Extend the region, have a helper function handle the constraint,
|
||||
* then return the region to its original size.
|
||||
|
|
|
@ -1220,6 +1220,7 @@ meta_change_button_grab (MetaKeyBindingManager *keys,
|
|||
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
|
||||
Window xwindow;
|
||||
GArray *mods;
|
||||
MetaFrame *frame;
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
return;
|
||||
|
@ -1236,9 +1237,9 @@ meta_change_button_grab (MetaKeyBindingManager *keys,
|
|||
mods = calc_grab_modifiers (keys, modmask);
|
||||
|
||||
mtk_x11_error_trap_push (xdisplay);
|
||||
|
||||
if (window->frame)
|
||||
xwindow = window->frame->xwindow;
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
if (frame)
|
||||
xwindow = frame->xwindow;
|
||||
else
|
||||
xwindow = meta_window_x11_get_xwindow (window);
|
||||
|
||||
|
@ -1646,9 +1647,9 @@ meta_window_grab_keys (MetaWindow *window)
|
|||
|
||||
if (priv->keys_grabbed)
|
||||
{
|
||||
if (window->frame && !priv->grab_on_frame)
|
||||
if (priv->frame && !priv->grab_on_frame)
|
||||
change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE);
|
||||
else if (window->frame == NULL &&
|
||||
else if (priv->frame == NULL &&
|
||||
priv->grab_on_frame)
|
||||
; /* continue to regrab on client window */
|
||||
else
|
||||
|
@ -1660,7 +1661,7 @@ meta_window_grab_keys (MetaWindow *window)
|
|||
TRUE);
|
||||
|
||||
priv->keys_grabbed = TRUE;
|
||||
priv->grab_on_frame = window->frame != NULL;
|
||||
priv->grab_on_frame = priv->frame != NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1677,10 +1678,10 @@ meta_window_ungrab_keys (MetaWindow *window)
|
|||
{
|
||||
MetaDisplay *display = window->display;
|
||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
|
||||
if (priv->grab_on_frame &&
|
||||
window->frame != NULL)
|
||||
change_window_keygrabs (keys, window->frame->xwindow, FALSE);
|
||||
if (priv->grab_on_frame && frame != NULL)
|
||||
change_window_keygrabs (keys, frame->xwindow, FALSE);
|
||||
else if (!priv->grab_on_frame)
|
||||
change_window_keygrabs (keys, meta_window_x11_get_xwindow (window), FALSE);
|
||||
|
||||
|
|
|
@ -571,6 +571,9 @@ on_stack_changed (MetaStack *stack,
|
|||
GList *l;
|
||||
GArray *hidden_stack_ids;
|
||||
GList *sorted;
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrame *frame;
|
||||
#endif
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (StackChanged, "Meta::StackTracker::on_stack_changed()");
|
||||
|
||||
|
@ -586,34 +589,33 @@ on_stack_changed (MetaStack *stack,
|
|||
for (l = sorted; l; l = l->next)
|
||||
{
|
||||
MetaWindow *w = l->data;
|
||||
uint64_t stack_id;
|
||||
uint64_t stack_id = w->stamp;
|
||||
|
||||
if (w->unmanaging)
|
||||
continue;
|
||||
|
||||
meta_topic (META_DEBUG_STACK, " %u:%d - %s ",
|
||||
w->layer, w->stack_position, w->desc);
|
||||
w->layer, w->stack_position, w->desc);
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
if (w->frame)
|
||||
stack_id = w->frame->xwindow;
|
||||
frame = meta_window_x11_get_frame (w);
|
||||
if (frame)
|
||||
stack_id = frame->xwindow;
|
||||
else
|
||||
stack_id = meta_window_x11_get_xwindow (w);
|
||||
stack_id = meta_window_x11_get_xwindow (w);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
stack_id = w->stamp;
|
||||
|
||||
/* We don't restack hidden windows along with the rest, though they are
|
||||
* reflected in the _NET hints. Hidden windows all get pushed below
|
||||
* the screens fullscreen guard_window. */
|
||||
if (w->hidden)
|
||||
{
|
||||
{
|
||||
g_array_append_val (hidden_stack_ids, stack_id);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
g_array_append_val (all_root_children_stacked, stack_id);
|
||||
}
|
||||
|
@ -1031,6 +1033,9 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
|
|||
GList *meta_windows;
|
||||
int n_windows;
|
||||
int i;
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrame *frame;
|
||||
#endif
|
||||
|
||||
if (tracker->sync_stack_later)
|
||||
{
|
||||
|
@ -1065,9 +1070,10 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
|
|||
* XID => window table. (Wine uses a toplevel for _NET_WM_USER_TIME_WINDOW;
|
||||
* see window-prop.c:reload_net_wm_user_time_window() for registration.)
|
||||
*/
|
||||
frame = meta_window ? meta_window_x11_get_frame (meta_window) : NULL;
|
||||
if (meta_window &&
|
||||
((Window)window == meta_window_x11_get_xwindow (meta_window) ||
|
||||
(meta_window->frame && (Window)window == meta_window->frame->xwindow)))
|
||||
(frame && (Window)window == frame->xwindow)))
|
||||
meta_windows = g_list_prepend (meta_windows, meta_window);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -786,8 +786,8 @@ void meta_window_set_opacity (MetaWindow *window,
|
|||
gboolean meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||
const ClutterEvent *event);
|
||||
|
||||
void meta_window_get_client_area_rect (const MetaWindow *window,
|
||||
MtkRectangle *rect);
|
||||
void meta_window_get_client_area_rect (MetaWindow *window,
|
||||
MtkRectangle *rect);
|
||||
|
||||
void meta_window_activate_full (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
|
|
|
@ -1027,7 +1027,6 @@ meta_window_constructed (GObject *object)
|
|||
|
||||
window->title = NULL;
|
||||
|
||||
window->frame = NULL;
|
||||
window->has_focus = FALSE;
|
||||
window->attached_focus_window = NULL;
|
||||
|
||||
|
@ -4302,6 +4301,10 @@ meta_window_client_rect_to_frame_rect (MetaWindow *window,
|
|||
MtkRectangle *client_rect,
|
||||
MtkRectangle *frame_rect)
|
||||
{
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrameBorders borders;
|
||||
#endif
|
||||
|
||||
if (!frame_rect)
|
||||
return;
|
||||
|
||||
|
@ -4311,28 +4314,29 @@ meta_window_client_rect_to_frame_rect (MetaWindow *window,
|
|||
* constraints.c:get_size_limits() and not something that we provide
|
||||
* in other locations or document.
|
||||
*/
|
||||
if (window->frame)
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
|
||||
meta_window_x11_get_frame_borders (window, &borders))
|
||||
{
|
||||
MetaFrameBorders borders;
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
|
||||
frame_rect->x -= borders.visible.left;
|
||||
frame_rect->y -= borders.visible.top;
|
||||
if (frame_rect->width != G_MAXINT)
|
||||
frame_rect->width += borders.visible.left + borders.visible.right;
|
||||
if (frame_rect->height != G_MAXINT)
|
||||
frame_rect->height += borders.visible.top + borders.visible.bottom;
|
||||
frame_rect->height += borders.visible.top + borders.visible.bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
const MetaFrameBorder *extents = &window->custom_frame_extents;
|
||||
frame_rect->x += extents->left;
|
||||
frame_rect->y += extents->top;
|
||||
if (frame_rect->width != G_MAXINT)
|
||||
frame_rect->width -= extents->left + extents->right;
|
||||
if (frame_rect->height != G_MAXINT)
|
||||
frame_rect->height -= extents->top + extents->bottom;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
const MetaFrameBorder *extents = &window->custom_frame_extents;
|
||||
|
||||
frame_rect->x += extents->left;
|
||||
frame_rect->y += extents->top;
|
||||
if (frame_rect->width != G_MAXINT)
|
||||
frame_rect->width -= extents->left + extents->right;
|
||||
if (frame_rect->height != G_MAXINT)
|
||||
frame_rect->height -= extents->top + extents->bottom;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4349,29 +4353,34 @@ meta_window_frame_rect_to_client_rect (MetaWindow *window,
|
|||
MtkRectangle *frame_rect,
|
||||
MtkRectangle *client_rect)
|
||||
{
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrameBorders borders;
|
||||
#endif
|
||||
|
||||
if (!client_rect)
|
||||
return;
|
||||
|
||||
*client_rect = *frame_rect;
|
||||
|
||||
if (window->frame)
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
|
||||
meta_window_x11_get_frame_borders (window, &borders))
|
||||
{
|
||||
MetaFrameBorders borders;
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
|
||||
client_rect->x += borders.visible.left;
|
||||
client_rect->y += borders.visible.top;
|
||||
client_rect->width -= borders.visible.left + borders.visible.right;
|
||||
client_rect->height -= borders.visible.top + borders.visible.bottom;
|
||||
client_rect->width -= borders.visible.left + borders.visible.right;
|
||||
client_rect->height -= borders.visible.top + borders.visible.bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
const MetaFrameBorder *extents = &window->custom_frame_extents;
|
||||
client_rect->x -= extents->left;
|
||||
client_rect->y -= extents->top;
|
||||
client_rect->width += extents->left + extents->right;
|
||||
client_rect->height += extents->top + extents->bottom;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
const MetaFrameBorder *extents = &window->custom_frame_extents;
|
||||
|
||||
client_rect->x -= extents->left;
|
||||
client_rect->y -= extents->top;
|
||||
client_rect->width += extents->left + extents->right;
|
||||
client_rect->height += extents->top + extents->bottom;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4401,12 +4410,14 @@ meta_window_get_frame_rect (const MetaWindow *window,
|
|||
* to the buffer rect.
|
||||
*/
|
||||
void
|
||||
meta_window_get_client_area_rect (const MetaWindow *window,
|
||||
MtkRectangle *rect)
|
||||
meta_window_get_client_area_rect (MetaWindow *window,
|
||||
MtkRectangle *rect)
|
||||
{
|
||||
MetaFrameBorders borders;
|
||||
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
MetaFrameBorders borders = { 0, };
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
meta_window_x11_get_frame_borders (window, &borders);
|
||||
#endif
|
||||
|
||||
rect->x = borders.total.left;
|
||||
rect->y = borders.total.top;
|
||||
|
@ -5363,11 +5374,16 @@ meta_window_type_changed (MetaWindow *window)
|
|||
if (!window->override_redirect)
|
||||
set_net_wm_state (window);
|
||||
|
||||
/* Update frame */
|
||||
if (window->decorated)
|
||||
meta_window_ensure_frame (window);
|
||||
else
|
||||
meta_window_destroy_frame (window);
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
/* Update frame */
|
||||
if (window->decorated)
|
||||
meta_window_ensure_frame (window);
|
||||
else
|
||||
meta_window_destroy_frame (window);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* update stacking constraints */
|
||||
meta_window_update_layer (window);
|
||||
|
@ -5398,8 +5414,16 @@ meta_window_set_type (MetaWindow *window,
|
|||
void
|
||||
meta_window_frame_size_changed (MetaWindow *window)
|
||||
{
|
||||
if (window->frame)
|
||||
meta_frame_clear_cached_borders (window->frame);
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrame *frame;
|
||||
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
if (frame)
|
||||
meta_frame_clear_cached_borders (frame);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -6240,17 +6264,6 @@ meta_window_unset_demands_attention (MetaWindow *window)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_frame: (skip)
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
*/
|
||||
MetaFrame *
|
||||
meta_window_get_frame (MetaWindow *window)
|
||||
{
|
||||
return window->frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_appears_focused:
|
||||
* @window: a #MetaWindow
|
||||
|
@ -6793,8 +6806,14 @@ meta_window_get_frame_bounds (MetaWindow *window)
|
|||
{
|
||||
if (!window->frame_bounds)
|
||||
{
|
||||
if (window->frame)
|
||||
window->frame_bounds = meta_frame_get_frame_bounds (window->frame);
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
#else
|
||||
/* Only for now, as this method would be moved to a window-x11 in the upcoming commits */
|
||||
MetaFrame *frame = NULL;
|
||||
#endif
|
||||
if (frame)
|
||||
window->frame_bounds = meta_frame_get_frame_bounds (frame);
|
||||
}
|
||||
|
||||
return window->frame_bounds;
|
||||
|
|
|
@ -103,9 +103,6 @@ typedef struct _MetaWindowClass MetaWindowClass;
|
|||
META_EXPORT
|
||||
GType meta_window_get_type (void);
|
||||
|
||||
META_EXPORT
|
||||
MetaFrame *meta_window_get_frame (MetaWindow *window);
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_window_has_focus (MetaWindow *window);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "wayland/meta-wayland.h"
|
||||
#include "wayland/meta-window-wayland.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
#include "x11/window-x11.h"
|
||||
|
||||
typedef struct {
|
||||
MetaContext *context;
|
||||
|
@ -1392,7 +1393,7 @@ test_case_do (TestCase *test,
|
|||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
if (meta_window_get_frame (window))
|
||||
if (META_IS_WINDOW_X11 (window) && meta_window_x11_get_frame (window))
|
||||
{
|
||||
g_set_error (error,
|
||||
META_TEST_CLIENT_ERROR,
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "backends/meta-pointer-constraint.h"
|
||||
#include "core/window-private.h"
|
||||
#include "meta/meta-backend.h"
|
||||
#include "x11/meta-x11-frame.h"
|
||||
#include "wayland/meta-pointer-confinement-wayland.h"
|
||||
#include "wayland/meta-pointer-lock-wayland.h"
|
||||
#include "wayland/meta-wayland-pointer.h"
|
||||
|
@ -42,6 +41,8 @@
|
|||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland.h"
|
||||
#include "x11/meta-x11-frame.h"
|
||||
#include "x11/window-x11.h"
|
||||
#endif
|
||||
|
||||
#include "pointer-constraints-unstable-v1-server-protocol.h"
|
||||
|
@ -627,32 +628,40 @@ MtkRegion *
|
|||
meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerConstraint *constraint)
|
||||
{
|
||||
MtkRegion *region;
|
||||
#ifdef HAVE_XWAYLAND
|
||||
MetaWindow *window;
|
||||
MetaFrame *frame;
|
||||
#endif
|
||||
|
||||
region = meta_wayland_surface_calculate_input_region (constraint->surface);
|
||||
if (constraint->region)
|
||||
mtk_region_intersect (region, constraint->region);
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
window = meta_wayland_surface_get_window (constraint->surface);
|
||||
if (window && window->frame)
|
||||
if (window && window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
MetaFrame *frame = window->frame;
|
||||
int actual_width, actual_height;
|
||||
|
||||
g_assert (meta_wayland_surface_is_xwayland (constraint->surface));
|
||||
|
||||
actual_width = window->buffer_rect.width - (frame->child_x +
|
||||
frame->right_width);
|
||||
actual_height = window->buffer_rect.height - (frame->child_y +
|
||||
frame->bottom_height);
|
||||
if (actual_width > 0 && actual_height > 0)
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
if (frame)
|
||||
{
|
||||
mtk_region_intersect_rectangle (region, &MTK_RECTANGLE_INIT (frame->child_x,
|
||||
frame->child_y,
|
||||
actual_width,
|
||||
actual_height));
|
||||
int actual_width, actual_height;
|
||||
|
||||
g_assert (meta_wayland_surface_is_xwayland (constraint->surface));
|
||||
|
||||
actual_width = window->buffer_rect.width - (frame->child_x +
|
||||
frame->right_width);
|
||||
actual_height = window->buffer_rect.height - (frame->child_y +
|
||||
frame->bottom_height);
|
||||
if (actual_width > 0 && actual_height > 0)
|
||||
{
|
||||
mtk_region_intersect_rectangle (region, &MTK_RECTANGLE_INIT (frame->child_x,
|
||||
frame->child_y,
|
||||
actual_width,
|
||||
actual_height));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return region;
|
||||
}
|
||||
|
|
|
@ -269,8 +269,6 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
|||
int new_buffer_x;
|
||||
int new_buffer_y;
|
||||
|
||||
g_assert (window->frame == NULL);
|
||||
|
||||
/* don't do anything if we're dropping the window, see #751847 */
|
||||
if (window->unmanaging)
|
||||
return;
|
||||
|
|
|
@ -197,7 +197,7 @@ apply_allow_commits_x11_property (MetaWindowXwayland *xwayland_window,
|
|||
if (!x11_display)
|
||||
return;
|
||||
|
||||
frame = meta_window_get_frame (window);
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
if (!frame)
|
||||
xwin = meta_window_x11_get_xwindow (window);
|
||||
else
|
||||
|
|
|
@ -804,15 +804,18 @@ handle_window_focus_event (MetaX11Display *x11_display,
|
|||
MetaWindow *focus_window;
|
||||
#ifdef WITH_VERBOSE_MODE
|
||||
const char *window_type;
|
||||
MetaFrame *frame;
|
||||
|
||||
/* Note the event can be on either the window or the frame,
|
||||
* we focus the frame for output-only windows
|
||||
*/
|
||||
if (window)
|
||||
{
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
|
||||
if (event->event == meta_window_x11_get_xwindow (window))
|
||||
window_type = "client window";
|
||||
else if (window->frame && event->event == window->frame->xwindow)
|
||||
else if (frame && event->event == frame->xwindow)
|
||||
window_type = "frame window";
|
||||
else
|
||||
window_type = "unknown client window";
|
||||
|
@ -1249,12 +1252,16 @@ notify_bell (MetaX11Display *x11_display,
|
|||
MetaDisplay *display = x11_display->display;
|
||||
XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev;
|
||||
MetaWindow *window;
|
||||
MetaFrame *frame;
|
||||
|
||||
window = meta_x11_display_lookup_x_window (x11_display,
|
||||
xkb_bell_event->window);
|
||||
if (!window && display->focus_window && display->focus_window->frame)
|
||||
window = display->focus_window;
|
||||
|
||||
if (!window && display->focus_window)
|
||||
{
|
||||
frame = meta_window_x11_get_frame (display->focus_window);
|
||||
if (frame)
|
||||
window = display->focus_window;
|
||||
}
|
||||
x11_display->last_bell_time = xkb_ev->time;
|
||||
if (!meta_bell_notify (display, window) &&
|
||||
meta_prefs_bell_is_audible ())
|
||||
|
@ -1278,10 +1285,13 @@ handle_other_xevent (MetaX11Display *x11_display,
|
|||
MetaWindow *window;
|
||||
MetaWindow *property_for_window;
|
||||
gboolean frame_was_receiver;
|
||||
MetaFrame *frame = NULL;
|
||||
|
||||
modified = event_get_modified_window (x11_display, event);
|
||||
window = modified != None ? meta_x11_display_lookup_x_window (x11_display, modified) : NULL;
|
||||
frame_was_receiver = (window && window->frame && modified == window->frame->xwindow);
|
||||
if (window)
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
frame_was_receiver = frame && modified == frame->xwindow;
|
||||
|
||||
/* We only want to respond to _NET_WM_USER_TIME property notify
|
||||
* events on _NET_WM_USER_TIME_WINDOW windows; in particular,
|
||||
|
@ -1388,7 +1398,7 @@ handle_other_xevent (MetaX11Display *x11_display,
|
|||
if (frame_was_receiver)
|
||||
{
|
||||
mtk_x11_error_trap_push (x11_display->xdisplay);
|
||||
meta_window_destroy_frame (window->frame->window);
|
||||
meta_window_destroy_frame (frame->window);
|
||||
mtk_x11_error_trap_pop (x11_display->xdisplay);
|
||||
}
|
||||
else
|
||||
|
@ -1570,9 +1580,9 @@ handle_other_xevent (MetaX11Display *x11_display,
|
|||
{
|
||||
meta_window_x11_configure_request (window, event);
|
||||
}
|
||||
else if (frame_was_receiver && window->frame)
|
||||
else if (frame_was_receiver && frame)
|
||||
{
|
||||
meta_frame_handle_xevent (window->frame, event);
|
||||
meta_frame_handle_xevent (frame, event);
|
||||
}
|
||||
break;
|
||||
case GravityNotify:
|
||||
|
@ -1592,7 +1602,7 @@ handle_other_xevent (MetaX11Display *x11_display,
|
|||
else if (property_for_window && !frame_was_receiver)
|
||||
meta_window_x11_property_notify (property_for_window, event);
|
||||
else if (frame_was_receiver)
|
||||
meta_frame_handle_xevent (window->frame, event);
|
||||
meta_frame_handle_xevent (frame, event);
|
||||
|
||||
group = meta_x11_display_lookup_group (x11_display,
|
||||
event->xproperty.window);
|
||||
|
@ -1781,10 +1791,13 @@ static gboolean
|
|||
window_has_xwindow (MetaWindow *window,
|
||||
Window xwindow)
|
||||
{
|
||||
MetaFrame *frame;
|
||||
|
||||
if (meta_window_x11_get_xwindow (window) == xwindow)
|
||||
return TRUE;
|
||||
|
||||
if (window->frame && window->frame->xwindow == xwindow)
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
if (frame && frame->xwindow == xwindow)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -2086,6 +2086,7 @@ meta_x11_display_set_input_focus (MetaX11Display *x11_display,
|
|||
{
|
||||
Window xwindow = x11_display->no_focus_window;
|
||||
gulong serial;
|
||||
MetaFrame *frame;
|
||||
#ifdef HAVE_X11
|
||||
MetaDisplay *display = x11_display->display;
|
||||
ClutterStage *stage = CLUTTER_STAGE (meta_get_stage_for_display (display));
|
||||
|
@ -2093,14 +2094,15 @@ meta_x11_display_set_input_focus (MetaX11Display *x11_display,
|
|||
|
||||
if (window && META_IS_WINDOW_X11 (window))
|
||||
{
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
/* For output-only windows, focus the frame.
|
||||
* This seems to result in the client window getting key events
|
||||
* though, so I don't know if it's icccm-compliant.
|
||||
*
|
||||
* Still, we have to do this or keynav breaks for these windows.
|
||||
*/
|
||||
if (window->frame && !meta_window_is_focusable (window))
|
||||
xwindow = window->frame->xwindow;
|
||||
if (frame && !meta_window_is_focusable (window))
|
||||
xwindow = frame->xwindow;
|
||||
else
|
||||
xwindow = meta_window_x11_get_xwindow (window);
|
||||
}
|
||||
|
|
|
@ -65,8 +65,10 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window,
|
|||
XSetWindowAttributes attrs;
|
||||
gulong create_serial = 0;
|
||||
MetaFrame *frame;
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
return;
|
||||
|
||||
frame = g_new0 (MetaFrame, 1);
|
||||
|
@ -84,7 +86,7 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window,
|
|||
|
||||
meta_sync_counter_init (&frame->sync_counter, window, frame->xwindow);
|
||||
|
||||
window->frame = frame;
|
||||
priv->frame = frame;
|
||||
|
||||
meta_verbose ("Frame geometry %d,%d %dx%d",
|
||||
frame->rect.x, frame->rect.y,
|
||||
|
@ -142,7 +144,7 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window,
|
|||
window->restore_focus_on_map = TRUE;
|
||||
|
||||
/* stick frame to the window */
|
||||
window->frame = frame;
|
||||
priv->frame = frame;
|
||||
|
||||
meta_window_reload_property_from_xwindow (window, frame->xwindow,
|
||||
x11_display->atom__NET_WM_SYNC_REQUEST_COUNTER,
|
||||
|
@ -172,14 +174,17 @@ meta_window_destroy_frame (MetaWindow *window)
|
|||
MetaFrameBorders borders;
|
||||
MetaX11Display *x11_display;
|
||||
|
||||
if (window->frame == NULL)
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||
|
||||
if (priv->frame == NULL)
|
||||
return;
|
||||
|
||||
x11_display = window->display->x11_display;
|
||||
|
||||
meta_verbose ("Unframing window %s", window->desc);
|
||||
|
||||
frame = window->frame;
|
||||
frame = priv->frame;
|
||||
|
||||
meta_frame_calc_borders (frame, &borders);
|
||||
|
||||
|
@ -214,8 +219,8 @@ meta_window_destroy_frame (MetaWindow *window)
|
|||
* coordinates here means we'll need to ensure a configure
|
||||
* notify event is sent; see bug 399552.
|
||||
*/
|
||||
window->frame->rect.x + borders.invisible.left,
|
||||
window->frame->rect.y + borders.invisible.top);
|
||||
priv->frame->rect.x + borders.invisible.left,
|
||||
priv->frame->rect.y + borders.invisible.top);
|
||||
window->reparents_pending += 1;
|
||||
}
|
||||
|
||||
|
@ -236,7 +241,7 @@ meta_window_destroy_frame (MetaWindow *window)
|
|||
|
||||
meta_x11_display_unregister_x_window (x11_display, frame->xwindow);
|
||||
|
||||
window->frame = NULL;
|
||||
priv->frame = NULL;
|
||||
g_clear_pointer (&window->frame_bounds, mtk_region_unref);
|
||||
g_clear_pointer (&frame->opaque_region, mtk_region_unref);
|
||||
|
||||
|
|
|
@ -124,17 +124,20 @@ stack_window_removed_cb (MetaStack *stack,
|
|||
MetaWindow *window,
|
||||
MetaX11Stack *x11_stack)
|
||||
{
|
||||
MetaFrame *frame;
|
||||
|
||||
if (window->client_type != META_WINDOW_CLIENT_TYPE_X11)
|
||||
return;
|
||||
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
x11_stack->added = g_list_remove (x11_stack->added, window);
|
||||
|
||||
x11_stack->removed = g_list_prepend (x11_stack->removed,
|
||||
GUINT_TO_POINTER (meta_window_x11_get_xwindow (window)));
|
||||
if (window->frame)
|
||||
if (frame)
|
||||
{
|
||||
x11_stack->removed = g_list_prepend (x11_stack->removed,
|
||||
GUINT_TO_POINTER (window->frame->xwindow));
|
||||
GUINT_TO_POINTER (frame->xwindow));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -652,6 +652,7 @@ reload_opaque_region (MetaWindow *window,
|
|||
gboolean initial)
|
||||
{
|
||||
MtkRegion *opaque_region = NULL;
|
||||
MetaFrame *frame;
|
||||
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
{
|
||||
|
@ -695,10 +696,11 @@ reload_opaque_region (MetaWindow *window,
|
|||
}
|
||||
|
||||
out:
|
||||
frame = meta_window_x11_get_frame (window);
|
||||
if (value->source_xwindow == meta_window_x11_get_xwindow (window))
|
||||
meta_window_set_opaque_region (window, opaque_region);
|
||||
else if (window->frame && value->source_xwindow == window->frame->xwindow)
|
||||
meta_frame_set_opaque_region (window->frame, opaque_region);
|
||||
else if (frame && value->source_xwindow == frame->xwindow)
|
||||
meta_frame_set_opaque_region (frame, opaque_region);
|
||||
|
||||
g_clear_pointer (&opaque_region, mtk_region_unref);
|
||||
}
|
||||
|
@ -1040,11 +1042,12 @@ reload_update_counter (MetaWindow *window,
|
|||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
{
|
||||
MetaSyncCounter *sync_counter;
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
|
||||
if (value->source_xwindow == meta_window_x11_get_xwindow (window))
|
||||
sync_counter = meta_window_x11_get_sync_counter (window);
|
||||
else if (window->frame && value->source_xwindow == window->frame->xwindow)
|
||||
sync_counter = meta_frame_get_sync_counter (window->frame);
|
||||
else if (frame && value->source_xwindow == frame->xwindow)
|
||||
sync_counter = meta_frame_get_sync_counter (frame);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
|
|
|
@ -99,6 +99,8 @@ struct _MetaWindowX11Private
|
|||
|
||||
/* maintained by group.c */
|
||||
MetaGroup *group;
|
||||
/* may be NULL! not all windows get decorated */
|
||||
MetaFrame *frame;
|
||||
|
||||
gboolean has_custom_frame_extents;
|
||||
MetaSyncCounter sync_counter;
|
||||
|
@ -142,5 +144,8 @@ void meta_window_x11_get_session_geometry (MetaWindow *window,
|
|||
int *width,
|
||||
int *height);
|
||||
|
||||
gboolean
|
||||
meta_window_x11_get_frame_borders (MetaWindow *window,
|
||||
MetaFrameBorders *borders);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -256,7 +256,7 @@ send_configure_notify (MetaWindow *window)
|
|||
event.xconfigure.window = priv->xwindow;
|
||||
event.xconfigure.x = priv->client_rect.x - priv->border_width;
|
||||
event.xconfigure.y = priv->client_rect.y - priv->border_width;
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
{
|
||||
if (window->withdrawn)
|
||||
{
|
||||
|
@ -265,16 +265,16 @@ send_configure_notify (MetaWindow *window)
|
|||
* where the visible top-left of the frame window currently is.
|
||||
*/
|
||||
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
meta_frame_calc_borders (priv->frame, &borders);
|
||||
|
||||
event.xconfigure.x = window->frame->rect.x + borders.invisible.left;
|
||||
event.xconfigure.y = window->frame->rect.y + borders.invisible.top;
|
||||
event.xconfigure.x = priv->frame->rect.x + borders.invisible.left;
|
||||
event.xconfigure.y = priv->frame->rect.y + borders.invisible.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Need to be in root window coordinates */
|
||||
event.xconfigure.x += window->frame->rect.x;
|
||||
event.xconfigure.y += window->frame->rect.y;
|
||||
event.xconfigure.x += priv->frame->rect.x;
|
||||
event.xconfigure.y += priv->frame->rect.y;
|
||||
}
|
||||
}
|
||||
event.xconfigure.width = priv->client_rect.width;
|
||||
|
@ -326,7 +326,7 @@ adjust_for_gravity (MetaWindow *window,
|
|||
else
|
||||
bw = 0;
|
||||
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
meta_frame_calc_borders (priv->frame, &borders);
|
||||
|
||||
child_x = borders.visible.left;
|
||||
child_y = borders.visible.top;
|
||||
|
@ -719,7 +719,7 @@ meta_window_x11_unmanage (MetaWindow *window)
|
|||
|
||||
mtk_x11_error_trap_pop (x11_display->xdisplay);
|
||||
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
{
|
||||
/* The XReparentWindow call in meta_window_destroy_frame() moves the
|
||||
* window so we need to send a configure notify; see bug 399552. (We
|
||||
|
@ -998,7 +998,7 @@ meta_window_x11_focus (MetaWindow *window,
|
|||
gboolean is_output_only_with_frame;
|
||||
|
||||
is_output_only_with_frame =
|
||||
window->frame && !meta_window_is_focusable (window);
|
||||
priv->frame && !meta_window_is_focusable (window);
|
||||
|
||||
if (window->input || is_output_only_with_frame)
|
||||
{
|
||||
|
@ -1060,10 +1060,10 @@ meta_window_get_client_root_coords (MetaWindow *window,
|
|||
|
||||
*rect = priv->client_rect;
|
||||
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
{
|
||||
rect->x += window->frame->rect.x;
|
||||
rect->y += window->frame->rect.y;
|
||||
rect->x += priv->frame->rect.x;
|
||||
rect->y += priv->frame->rect.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1136,13 +1136,15 @@ meta_window_x11_grab_op_ended (MetaWindow *window,
|
|||
static void
|
||||
update_net_frame_extents (MetaWindow *window)
|
||||
{
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
MetaX11Display *x11_display = window->display->x11_display;
|
||||
|
||||
unsigned long data[4];
|
||||
MetaFrameBorders borders;
|
||||
Window xwindow = meta_window_x11_get_xwindow (window);
|
||||
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
meta_frame_calc_borders (priv->frame, &borders);
|
||||
/* Left */
|
||||
data[0] = borders.visible.left;
|
||||
/* Right */
|
||||
|
@ -1228,6 +1230,8 @@ edge_constraints_to_gtk_edge_constraints (MetaWindow *window)
|
|||
static void
|
||||
update_gtk_edge_constraints (MetaWindow *window)
|
||||
{
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
MetaX11Display *x11_display = window->display->x11_display;
|
||||
unsigned long data[1];
|
||||
|
||||
|
@ -1237,7 +1241,7 @@ update_gtk_edge_constraints (MetaWindow *window)
|
|||
|
||||
mtk_x11_error_trap_push (x11_display->xdisplay);
|
||||
XChangeProperty (x11_display->xdisplay,
|
||||
window->frame ? window->frame->xwindow : meta_window_x11_get_xwindow (window),
|
||||
priv->frame ? priv->frame->xwindow : meta_window_x11_get_xwindow (window),
|
||||
x11_display->atom__GTK_EDGE_CONSTRAINTS,
|
||||
XA_CARDINAL, 32, PropModeReplace,
|
||||
(guchar*) data, 1);
|
||||
|
@ -1321,14 +1325,14 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||
|
||||
is_configure_request = (flags & META_MOVE_RESIZE_CONFIGURE_REQUEST) != 0;
|
||||
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
meta_frame_calc_borders (priv->frame, &borders);
|
||||
|
||||
size_dx = constrained_rect.width - window->rect.width;
|
||||
size_dy = constrained_rect.height - window->rect.height;
|
||||
|
||||
window->rect = constrained_rect;
|
||||
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
{
|
||||
int new_w, new_h;
|
||||
int new_x, new_y;
|
||||
|
@ -1337,24 +1341,24 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||
new_w = window->rect.width + borders.invisible.left + borders.invisible.right;
|
||||
new_h = window->rect.height + borders.invisible.top + borders.invisible.bottom;
|
||||
|
||||
if (new_w != window->frame->rect.width ||
|
||||
new_h != window->frame->rect.height)
|
||||
if (new_w != priv->frame->rect.width ||
|
||||
new_h != priv->frame->rect.height)
|
||||
{
|
||||
need_resize_frame = TRUE;
|
||||
window->frame->rect.width = new_w;
|
||||
window->frame->rect.height = new_h;
|
||||
priv->frame->rect.width = new_w;
|
||||
priv->frame->rect.height = new_h;
|
||||
}
|
||||
|
||||
/* Compute new frame coords */
|
||||
new_x = window->rect.x - borders.invisible.left;
|
||||
new_y = window->rect.y - borders.invisible.top;
|
||||
|
||||
if (new_x != window->frame->rect.x ||
|
||||
new_y != window->frame->rect.y)
|
||||
if (new_x != priv->frame->rect.x ||
|
||||
new_y != priv->frame->rect.y)
|
||||
{
|
||||
need_move_frame = TRUE;
|
||||
window->frame->rect.x = new_x;
|
||||
window->frame->rect.y = new_y;
|
||||
priv->frame->rect.x = new_x;
|
||||
priv->frame->rect.y = new_y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1369,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||
* values we need to pass to XConfigureWindow are in parent
|
||||
* coordinates, so if the window is in a frame, we need to
|
||||
* correct the x/y positions here. */
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
{
|
||||
client_rect.x = borders.total.left;
|
||||
client_rect.y = borders.total.top;
|
||||
|
@ -1389,16 +1393,16 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||
|
||||
/* If frame extents have changed, fill in other frame fields and
|
||||
change frame's extents property. */
|
||||
if (window->frame &&
|
||||
(window->frame->child_x != borders.total.left ||
|
||||
window->frame->child_y != borders.total.top ||
|
||||
window->frame->right_width != borders.total.right ||
|
||||
window->frame->bottom_height != borders.total.bottom))
|
||||
if (priv->frame &&
|
||||
(priv->frame->child_x != borders.total.left ||
|
||||
priv->frame->child_y != borders.total.top ||
|
||||
priv->frame->right_width != borders.total.right ||
|
||||
priv->frame->bottom_height != borders.total.bottom))
|
||||
{
|
||||
window->frame->child_x = borders.total.left;
|
||||
window->frame->child_y = borders.total.top;
|
||||
window->frame->right_width = borders.total.right;
|
||||
window->frame->bottom_height = borders.total.bottom;
|
||||
priv->frame->child_x = borders.total.left;
|
||||
priv->frame->child_y = borders.total.top;
|
||||
priv->frame->right_width = borders.total.right;
|
||||
priv->frame->bottom_height = borders.total.bottom;
|
||||
|
||||
update_net_frame_extents (window);
|
||||
}
|
||||
|
@ -1430,7 +1434,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||
* PROGRAM_POSITION/USER_POSITION hints aren't set, mutter seems to send a
|
||||
* ConfigureNotify anyway due to the above code.)
|
||||
*/
|
||||
if (window->constructing && window->frame &&
|
||||
if (window->constructing && priv->frame &&
|
||||
((window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION) ||
|
||||
(window->size_hints.flags & META_SIZE_HINTS_USER_POSITION)))
|
||||
need_configure_notify = TRUE;
|
||||
|
@ -1506,12 +1510,12 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||
meta_grab_op_is_resizing (meta_window_drag_get_grab_op (window_drag)))
|
||||
{
|
||||
meta_sync_counter_send_request (&priv->sync_counter);
|
||||
if (window->frame)
|
||||
meta_sync_counter_send_request (meta_frame_get_sync_counter (window->frame));
|
||||
if (priv->frame)
|
||||
meta_sync_counter_send_request (meta_frame_get_sync_counter (priv->frame));
|
||||
}
|
||||
|
||||
if (configure_frame_first && window->frame)
|
||||
frame_shape_changed = meta_frame_sync_to_window (window->frame, need_resize_frame);
|
||||
if (configure_frame_first && priv->frame)
|
||||
frame_shape_changed = meta_frame_sync_to_window (priv->frame, need_resize_frame);
|
||||
|
||||
if (mask != 0)
|
||||
{
|
||||
|
@ -1521,13 +1525,13 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||
&values);
|
||||
}
|
||||
|
||||
if (!configure_frame_first && window->frame)
|
||||
frame_shape_changed = meta_frame_sync_to_window (window->frame, need_resize_frame);
|
||||
if (!configure_frame_first && priv->frame)
|
||||
frame_shape_changed = meta_frame_sync_to_window (priv->frame, need_resize_frame);
|
||||
|
||||
mtk_x11_error_trap_pop (window->display->x11_display->xdisplay);
|
||||
|
||||
if (window->frame)
|
||||
window->buffer_rect = window->frame->rect;
|
||||
if (priv->frame)
|
||||
window->buffer_rect = priv->frame->rect;
|
||||
else
|
||||
window->buffer_rect = client_rect;
|
||||
|
||||
|
@ -1830,8 +1834,8 @@ meta_window_x11_are_updates_frozen (MetaWindow *window)
|
|||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
if (window->frame &&
|
||||
meta_sync_counter_is_waiting (meta_frame_get_sync_counter (window->frame)))
|
||||
if (priv->frame &&
|
||||
meta_sync_counter_is_waiting (meta_frame_get_sync_counter (priv->frame)))
|
||||
return TRUE;
|
||||
|
||||
return meta_sync_counter_is_waiting (&priv->sync_counter);
|
||||
|
@ -2038,8 +2042,11 @@ meta_window_x11_set_transient_for (MetaWindow *window,
|
|||
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;
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
return priv->frame != NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2080,6 +2087,7 @@ meta_window_x11_constructed (GObject *object)
|
|||
|
||||
priv->user_time_window = None;
|
||||
|
||||
priv->frame = NULL;
|
||||
window->decorated = TRUE;
|
||||
window->hidden = FALSE;
|
||||
priv->border_width = attrs.border_width;
|
||||
|
@ -2290,10 +2298,10 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
|
|||
XA_ATOM,
|
||||
32, PropModeReplace, (guchar*) data, i);
|
||||
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
{
|
||||
XChangeProperty (x11_display->xdisplay,
|
||||
window->frame->xwindow,
|
||||
priv->frame->xwindow,
|
||||
x11_display->atom__NET_WM_STATE,
|
||||
XA_ATOM,
|
||||
32, PropModeReplace, (guchar*) data, i);
|
||||
|
@ -2417,7 +2425,7 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|||
meta_window_set_input_region (window, NULL);
|
||||
return;
|
||||
}
|
||||
xwindow = window->frame->xwindow;
|
||||
xwindow = priv->frame->xwindow;
|
||||
bounding_rect.width = window->buffer_rect.width;
|
||||
bounding_rect.height = window->buffer_rect.height;
|
||||
}
|
||||
|
@ -2617,6 +2625,8 @@ meta_window_x11_get_gravity_position (MetaWindow *window,
|
|||
int *root_x,
|
||||
int *root_y)
|
||||
{
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
MtkRectangle frame_extents;
|
||||
int w, h;
|
||||
int x, y;
|
||||
|
@ -2627,18 +2637,18 @@ meta_window_x11_get_gravity_position (MetaWindow *window,
|
|||
if (gravity == META_GRAVITY_STATIC)
|
||||
{
|
||||
frame_extents = window->rect;
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
{
|
||||
frame_extents.x = window->frame->rect.x + window->frame->child_x;
|
||||
frame_extents.y = window->frame->rect.y + window->frame->child_y;
|
||||
frame_extents.x = priv->frame->rect.x + priv->frame->child_x;
|
||||
frame_extents.y = priv->frame->rect.y + priv->frame->child_y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->frame == NULL)
|
||||
if (priv->frame == NULL)
|
||||
frame_extents = window->rect;
|
||||
else
|
||||
frame_extents = window->frame->rect;
|
||||
frame_extents = priv->frame->rect;
|
||||
}
|
||||
|
||||
x = frame_extents.x;
|
||||
|
@ -4208,7 +4218,7 @@ meta_window_x11_configure_notify (MetaWindow *window,
|
|||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
g_assert (window->override_redirect);
|
||||
g_assert (window->frame == NULL);
|
||||
g_assert (priv->frame == NULL);
|
||||
|
||||
window->rect.x = event->x;
|
||||
window->rect.y = event->y;
|
||||
|
@ -4235,6 +4245,8 @@ meta_window_x11_configure_notify (MetaWindow *window,
|
|||
void
|
||||
meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
|
||||
{
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
MetaX11Display *x11_display = window->display->x11_display;
|
||||
#define MAX_N_ACTIONS 12
|
||||
unsigned long data[MAX_N_ACTIONS];
|
||||
|
@ -4297,10 +4309,10 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
|
|||
XA_ATOM,
|
||||
32, PropModeReplace, (guchar*) data, i);
|
||||
|
||||
if (window->frame)
|
||||
if (priv->frame)
|
||||
{
|
||||
XChangeProperty (x11_display->xdisplay,
|
||||
window->frame->xwindow,
|
||||
priv->frame->xwindow,
|
||||
x11_display->atom__NET_WM_ALLOWED_ACTIONS,
|
||||
XA_ATOM,
|
||||
32, PropModeReplace, (guchar*) data, i);
|
||||
|
@ -4316,8 +4328,8 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
|
|||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
if (window->frame)
|
||||
meta_sync_counter_create_sync_alarm (meta_frame_get_sync_counter (window->frame));
|
||||
if (priv->frame)
|
||||
meta_sync_counter_create_sync_alarm (meta_frame_get_sync_counter (priv->frame));
|
||||
|
||||
meta_sync_counter_create_sync_alarm (&priv->sync_counter);
|
||||
}
|
||||
|
@ -4328,8 +4340,8 @@ meta_window_x11_destroy_sync_request_alarm (MetaWindow *window)
|
|||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
if (window->frame)
|
||||
meta_sync_counter_destroy_sync_alarm (meta_frame_get_sync_counter (window->frame));
|
||||
if (priv->frame)
|
||||
meta_sync_counter_destroy_sync_alarm (meta_frame_get_sync_counter (priv->frame));
|
||||
|
||||
meta_sync_counter_destroy_sync_alarm (&priv->sync_counter);
|
||||
}
|
||||
|
@ -4337,7 +4349,10 @@ meta_window_x11_destroy_sync_request_alarm (MetaWindow *window)
|
|||
Window
|
||||
meta_window_x11_get_toplevel_xwindow (MetaWindow *window)
|
||||
{
|
||||
return window->frame ? window->frame->xwindow : meta_window_x11_get_xwindow (window);
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
return priv->frame ? priv->frame->xwindow : meta_window_x11_get_xwindow (window);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4387,11 +4402,13 @@ meta_window_x11_surface_rect_to_frame_rect (MetaWindow *window,
|
|||
MtkRectangle *frame_rect)
|
||||
|
||||
{
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
MetaFrameBorders borders;
|
||||
|
||||
g_return_if_fail (window->frame);
|
||||
g_return_if_fail (priv->frame);
|
||||
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
meta_frame_calc_borders (priv->frame, &borders);
|
||||
|
||||
*frame_rect = *surface_rect;
|
||||
frame_rect->x += borders.invisible.left;
|
||||
|
@ -4405,9 +4422,11 @@ meta_window_x11_surface_rect_to_client_rect (MetaWindow *window,
|
|||
MtkRectangle *surface_rect,
|
||||
MtkRectangle *client_rect)
|
||||
{
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
MetaFrameBorders borders;
|
||||
|
||||
meta_frame_calc_borders (window->frame, &borders);
|
||||
meta_frame_calc_borders (priv->frame, &borders);
|
||||
|
||||
*client_rect = *surface_rect;
|
||||
client_rect->x += borders.total.left;
|
||||
|
@ -4483,14 +4502,36 @@ meta_window_x11_get_sync_counter (MetaWindow *window)
|
|||
return &priv->sync_counter;
|
||||
}
|
||||
|
||||
MetaFrame*
|
||||
meta_window_x11_get_frame (MetaWindow *window)
|
||||
{
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
return priv->frame;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_x11_get_frame_borders (MetaWindow *window,
|
||||
MetaFrameBorders *borders)
|
||||
{
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
|
||||
if (!frame)
|
||||
return FALSE;
|
||||
|
||||
meta_frame_calc_borders (frame, borders);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_x11_is_awaiting_sync_response (MetaWindow *window)
|
||||
{
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
if (window->frame &&
|
||||
meta_sync_counter_is_waiting_response (meta_frame_get_sync_counter (window->frame)))
|
||||
if (priv->frame &&
|
||||
meta_sync_counter_is_waiting_response (meta_frame_get_sync_counter (priv->frame)))
|
||||
return TRUE;
|
||||
|
||||
return meta_sync_counter_is_waiting_response (&priv->sync_counter);
|
||||
|
@ -4503,8 +4544,8 @@ meta_window_x11_check_update_resize (MetaWindow *window)
|
|||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||
MetaWindowDrag *window_drag;
|
||||
|
||||
if (window->frame &&
|
||||
meta_sync_counter_is_waiting (meta_frame_get_sync_counter (window->frame)))
|
||||
if (priv->frame &&
|
||||
meta_sync_counter_is_waiting (meta_frame_get_sync_counter (priv->frame)))
|
||||
return;
|
||||
|
||||
if (meta_sync_counter_is_waiting (&priv->sync_counter))
|
||||
|
|
|
@ -100,6 +100,9 @@ void meta_window_x11_surface_rect_to_client_rect (MetaWindow *window,
|
|||
|
||||
MtkRectangle meta_window_x11_get_client_rect (MetaWindowX11 *window_x11);
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaFrame * meta_window_x11_get_frame (MetaWindow *window);
|
||||
|
||||
gboolean meta_window_x11_can_unredirect (MetaWindowX11 *window_x11);
|
||||
|
||||
MetaSyncCounter * meta_window_x11_get_sync_counter (MetaWindow *window);
|
||||
|
|
Loading…
Reference in a new issue