window: Move get_session_geometry to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
This commit is contained in:

committed by
Marge Bot

parent
751ef5abd2
commit
70f8cc433e
@ -4260,107 +4260,6 @@ meta_window_update_layout (MetaWindow *window)
|
||||
window->unconstrained_rect.height);
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_get_gravity_position (MetaWindow *window,
|
||||
MetaGravity gravity,
|
||||
int *root_x,
|
||||
int *root_y)
|
||||
{
|
||||
MtkRectangle frame_extents;
|
||||
int w, h;
|
||||
int x, y;
|
||||
|
||||
w = window->rect.width;
|
||||
h = window->rect.height;
|
||||
|
||||
if (gravity == META_GRAVITY_STATIC)
|
||||
{
|
||||
frame_extents = window->rect;
|
||||
if (window->frame)
|
||||
{
|
||||
frame_extents.x = window->frame->rect.x + window->frame->child_x;
|
||||
frame_extents.y = window->frame->rect.y + window->frame->child_y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->frame == NULL)
|
||||
frame_extents = window->rect;
|
||||
else
|
||||
frame_extents = window->frame->rect;
|
||||
}
|
||||
|
||||
x = frame_extents.x;
|
||||
y = frame_extents.y;
|
||||
|
||||
switch (gravity)
|
||||
{
|
||||
case META_GRAVITY_NORTH:
|
||||
case META_GRAVITY_CENTER:
|
||||
case META_GRAVITY_SOUTH:
|
||||
/* Find center of frame. */
|
||||
x += frame_extents.width / 2;
|
||||
/* Center client window on that point. */
|
||||
x -= w / 2;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_SOUTH_EAST:
|
||||
case META_GRAVITY_EAST:
|
||||
case META_GRAVITY_NORTH_EAST:
|
||||
/* Find right edge of frame */
|
||||
x += frame_extents.width;
|
||||
/* Align left edge of client at that point. */
|
||||
x -= w;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (gravity)
|
||||
{
|
||||
case META_GRAVITY_WEST:
|
||||
case META_GRAVITY_CENTER:
|
||||
case META_GRAVITY_EAST:
|
||||
/* Find center of frame. */
|
||||
y += frame_extents.height / 2;
|
||||
/* Center client window there. */
|
||||
y -= h / 2;
|
||||
break;
|
||||
case META_GRAVITY_SOUTH_WEST:
|
||||
case META_GRAVITY_SOUTH:
|
||||
case META_GRAVITY_SOUTH_EAST:
|
||||
/* Find south edge of frame */
|
||||
y += frame_extents.height;
|
||||
/* Place bottom edge of client there */
|
||||
y -= h;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (root_x)
|
||||
*root_x = x;
|
||||
if (root_y)
|
||||
*root_y = y;
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_get_session_geometry (MetaWindow *window,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
meta_window_get_gravity_position (window,
|
||||
window->size_hints.win_gravity,
|
||||
x, y);
|
||||
|
||||
*width = (window->rect.width - window->size_hints.base_width) /
|
||||
window->size_hints.width_inc;
|
||||
*height = (window->rect.height - window->size_hints.base_height) /
|
||||
window->size_hints.height_inc;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_geometry_contains_rect (MetaWindow *window,
|
||||
MtkRectangle *rect)
|
||||
|
Reference in New Issue
Block a user