mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
window: Change meta_window_move_resize_internal to take a MetaRectangle
We construct one anyway, and most callers already pass in a rectangle the long way around, so why not change the internal API?
This commit is contained in:
parent
e3001794f2
commit
43d6088ebb
@ -741,10 +741,7 @@ void meta_window_update_resize (MetaWindow *window,
|
|||||||
void meta_window_move_resize_internal (MetaWindow *window,
|
void meta_window_move_resize_internal (MetaWindow *window,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
int gravity,
|
int gravity,
|
||||||
int root_x_nw,
|
MetaRectangle client_rect);
|
||||||
int root_y_nw,
|
|
||||||
int w,
|
|
||||||
int h);
|
|
||||||
void meta_window_save_user_window_placement (MetaWindow *window);
|
void meta_window_save_user_window_placement (MetaWindow *window);
|
||||||
|
|
||||||
void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op);
|
void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op);
|
||||||
|
@ -3223,10 +3223,7 @@ meta_window_unmaximize_internal (MetaWindow *window,
|
|||||||
meta_window_move_resize_internal (window,
|
meta_window_move_resize_internal (window,
|
||||||
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION,
|
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION,
|
||||||
gravity,
|
gravity,
|
||||||
target_rect.x,
|
target_rect);
|
||||||
target_rect.y,
|
|
||||||
target_rect.width,
|
|
||||||
target_rect.height);
|
|
||||||
|
|
||||||
meta_window_get_frame_rect (window, &new_rect);
|
meta_window_get_frame_rect (window, &new_rect);
|
||||||
meta_compositor_unmaximize_window (window->display->compositor,
|
meta_compositor_unmaximize_window (window->display->compositor,
|
||||||
@ -3769,18 +3766,12 @@ void
|
|||||||
meta_window_move_resize_internal (MetaWindow *window,
|
meta_window_move_resize_internal (MetaWindow *window,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
int gravity,
|
int gravity,
|
||||||
int root_x_nw,
|
MetaRectangle client_rect)
|
||||||
int root_y_nw,
|
|
||||||
int w,
|
|
||||||
int h)
|
|
||||||
{
|
{
|
||||||
/* The rectangle here that's passed in is always the root position
|
/* The rectangle here that's passed in is always the root position
|
||||||
* of the client window. For undecorated or client-decorated windows,
|
* of the client window. For undecorated or client-decorated windows,
|
||||||
* this is the root position of the X11 window. For server-decorated
|
* this is the root position of the X11 window. For server-decorated
|
||||||
* windows, this is the root position of the client area of the window.
|
* windows, this is the root position of the client area of the window.
|
||||||
*
|
|
||||||
* Similarly, the width and height passed in are in client window
|
|
||||||
* coordinates as well.
|
|
||||||
*/
|
*/
|
||||||
gboolean is_user_action;
|
gboolean is_user_action;
|
||||||
gboolean did_placement;
|
gboolean did_placement;
|
||||||
@ -3813,14 +3804,13 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
meta_rectangle_resize_with_gravity (&old_rect,
|
meta_rectangle_resize_with_gravity (&old_rect,
|
||||||
&requested_rect,
|
&requested_rect,
|
||||||
gravity, w, h);
|
gravity,
|
||||||
|
client_rect.width,
|
||||||
|
client_rect.height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
requested_rect.x = root_x_nw;
|
requested_rect = client_rect;
|
||||||
requested_rect.y = root_y_nw;
|
|
||||||
requested_rect.width = w;
|
|
||||||
requested_rect.height = h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new_rect = requested_rect;
|
new_rect = requested_rect;
|
||||||
@ -3898,18 +3888,17 @@ meta_window_resize (MetaWindow *window,
|
|||||||
int w,
|
int w,
|
||||||
int h)
|
int h)
|
||||||
{
|
{
|
||||||
int x, y;
|
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
|
MetaRectangle rect;
|
||||||
|
|
||||||
g_return_if_fail (!window->override_redirect);
|
g_return_if_fail (!window->override_redirect);
|
||||||
|
|
||||||
meta_window_get_position (window, &x, &y);
|
|
||||||
|
|
||||||
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
|
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
|
||||||
meta_window_move_resize_internal (window,
|
|
||||||
flags,
|
rect.width = w;
|
||||||
NorthWestGravity,
|
rect.height = h;
|
||||||
x, y, w, h);
|
|
||||||
|
meta_window_move_resize_internal (window, flags, NorthWestGravity, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3931,18 +3920,20 @@ meta_window_move (MetaWindow *window,
|
|||||||
int root_y_nw)
|
int root_y_nw)
|
||||||
{
|
{
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
|
MetaRectangle rect;
|
||||||
|
|
||||||
g_return_if_fail (!window->override_redirect);
|
g_return_if_fail (!window->override_redirect);
|
||||||
|
|
||||||
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION;
|
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION;
|
||||||
|
|
||||||
meta_window_move_resize_internal (window,
|
rect.x = root_x_nw;
|
||||||
flags,
|
rect.y = root_y_nw;
|
||||||
NorthWestGravity,
|
rect.width = window->rect.width;
|
||||||
root_x_nw, root_y_nw,
|
rect.height = window->rect.height;
|
||||||
window->rect.width,
|
|
||||||
window->rect.height);
|
meta_window_move_resize_internal (window, flags, NorthWestGravity, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_window_move_frame:
|
* meta_window_move_frame:
|
||||||
* @window: a #MetaWindow
|
* @window: a #MetaWindow
|
||||||
@ -4060,16 +4051,19 @@ meta_window_move_resize (MetaWindow *window,
|
|||||||
int h)
|
int h)
|
||||||
{
|
{
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
|
MetaRectangle rect;
|
||||||
|
|
||||||
g_return_if_fail (!window->override_redirect);
|
g_return_if_fail (!window->override_redirect);
|
||||||
|
|
||||||
flags = (user_op ? META_IS_USER_ACTION : 0) |
|
flags = (user_op ? META_IS_USER_ACTION : 0) |
|
||||||
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
|
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
|
||||||
meta_window_move_resize_internal (window,
|
|
||||||
flags,
|
rect.x = root_x_nw;
|
||||||
NorthWestGravity,
|
rect.y = root_y_nw;
|
||||||
root_x_nw, root_y_nw,
|
rect.width = w;
|
||||||
w, h);
|
rect.height = h;
|
||||||
|
|
||||||
|
meta_window_move_resize_internal (window, flags, NorthWestGravity, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -4079,16 +4073,14 @@ meta_window_resize_with_gravity (MetaWindow *window,
|
|||||||
int h,
|
int h,
|
||||||
int gravity)
|
int gravity)
|
||||||
{
|
{
|
||||||
int x, y;
|
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
|
MetaRectangle rect;
|
||||||
|
|
||||||
meta_window_get_position (window, &x, &y);
|
rect.width = w;
|
||||||
|
rect.height = h;
|
||||||
|
|
||||||
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
|
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_RESIZE_ACTION;
|
||||||
meta_window_move_resize_internal (window,
|
meta_window_move_resize_internal (window, flags, gravity, rect);
|
||||||
flags,
|
|
||||||
gravity,
|
|
||||||
x, y, w, h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -217,7 +217,8 @@ meta_window_wayland_move_resize (MetaWindow *window,
|
|||||||
int dy)
|
int dy)
|
||||||
{
|
{
|
||||||
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
|
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
|
||||||
int x, y;
|
int gravity;
|
||||||
|
MetaRectangle rect;
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
|
|
||||||
flags = META_IS_WAYLAND_RESIZE;
|
flags = META_IS_WAYLAND_RESIZE;
|
||||||
@ -227,29 +228,31 @@ meta_window_wayland_move_resize (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
if (wl_window->has_saved_pos)
|
if (wl_window->has_saved_pos)
|
||||||
{
|
{
|
||||||
x = wl_window->saved_x;
|
rect.x = wl_window->saved_x;
|
||||||
y = wl_window->saved_y;
|
rect.y = wl_window->saved_y;
|
||||||
wl_window->has_saved_pos = FALSE;
|
wl_window->has_saved_pos = FALSE;
|
||||||
flags |= META_IS_MOVE_ACTION;
|
flags |= META_IS_MOVE_ACTION;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
meta_window_get_position (window, &x, &y);
|
meta_window_get_position (window, &rect.x, &rect.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dx != 0 || dy != 0)
|
if (dx != 0 || dy != 0)
|
||||||
{
|
{
|
||||||
x += dx;
|
rect.x += dx;
|
||||||
y += dy;
|
rect.y += dy;
|
||||||
flags |= META_IS_MOVE_ACTION;
|
flags |= META_IS_MOVE_ACTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width != window->rect.width || height != window->rect.height)
|
rect.width = width;
|
||||||
|
rect.height = height;
|
||||||
|
|
||||||
|
if (rect.width != window->rect.width || rect.height != window->rect.height)
|
||||||
flags |= META_IS_RESIZE_ACTION;
|
flags |= META_IS_RESIZE_ACTION;
|
||||||
|
|
||||||
meta_window_move_resize_internal (window, flags,
|
gravity = meta_resize_gravity_from_grab_op (window->display->grab_op);
|
||||||
meta_resize_gravity_from_grab_op (window->display->grab_op),
|
meta_window_move_resize_internal (window, flags, gravity, rect);
|
||||||
x, y, width, height);
|
|
||||||
meta_window_save_user_window_placement (window);
|
meta_window_save_user_window_placement (window);
|
||||||
}
|
}
|
||||||
|
@ -488,8 +488,7 @@ meta_window_apply_session_info (MetaWindow *window,
|
|||||||
flags = META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
|
flags = META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
|
||||||
|
|
||||||
adjust_for_gravity (window, FALSE, gravity, &rect);
|
adjust_for_gravity (window, FALSE, gravity, &rect);
|
||||||
meta_window_move_resize_internal (window, flags, gravity,
|
meta_window_move_resize_internal (window, flags, gravity, rect);
|
||||||
rect.x, rect.y, rect.width, rect.height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,8 +543,7 @@ meta_window_x11_manage (MetaWindow *window)
|
|||||||
rect.height = window->size_hints.height;
|
rect.height = window->size_hints.height;
|
||||||
|
|
||||||
adjust_for_gravity (window, TRUE, gravity, &rect);
|
adjust_for_gravity (window, TRUE, gravity, &rect);
|
||||||
meta_window_move_resize_internal (window, flags, gravity,
|
meta_window_move_resize_internal (window, flags, gravity, rect);
|
||||||
rect.x, rect.y, rect.width, rect.height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2079,8 +2077,7 @@ meta_window_move_resize_request (MetaWindow *window,
|
|||||||
rect.height = height;
|
rect.height = height;
|
||||||
|
|
||||||
adjust_for_gravity (window, TRUE, gravity, &rect);
|
adjust_for_gravity (window, TRUE, gravity, &rect);
|
||||||
meta_window_move_resize_internal (window, flags, gravity,
|
meta_window_move_resize_internal (window, flags, gravity, rect);
|
||||||
rect.x, rect.y, rect.width, rect.height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* window->user_rect exists to allow "snapping-back" the window if a
|
/* window->user_rect exists to allow "snapping-back" the window if a
|
||||||
|
Loading…
Reference in New Issue
Block a user