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:
Jasper St. Pierre 2014-05-01 19:09:13 -04:00
parent e3001794f2
commit 43d6088ebb
4 changed files with 49 additions and 60 deletions

View File

@ -741,10 +741,7 @@ void meta_window_update_resize (MetaWindow *window,
void meta_window_move_resize_internal (MetaWindow *window,
MetaMoveResizeFlags flags,
int gravity,
int root_x_nw,
int root_y_nw,
int w,
int h);
MetaRectangle client_rect);
void meta_window_save_user_window_placement (MetaWindow *window);
void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op);

View File

@ -3223,10 +3223,7 @@ meta_window_unmaximize_internal (MetaWindow *window,
meta_window_move_resize_internal (window,
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION,
gravity,
target_rect.x,
target_rect.y,
target_rect.width,
target_rect.height);
target_rect);
meta_window_get_frame_rect (window, &new_rect);
meta_compositor_unmaximize_window (window->display->compositor,
@ -3769,18 +3766,12 @@ void
meta_window_move_resize_internal (MetaWindow *window,
MetaMoveResizeFlags flags,
int gravity,
int root_x_nw,
int root_y_nw,
int w,
int h)
MetaRectangle client_rect)
{
/* The rectangle here that's passed in is always the root position
* of the client window. For undecorated or client-decorated windows,
* 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.
*
* Similarly, the width and height passed in are in client window
* coordinates as well.
*/
gboolean is_user_action;
gboolean did_placement;
@ -3813,14 +3804,13 @@ meta_window_move_resize_internal (MetaWindow *window,
{
meta_rectangle_resize_with_gravity (&old_rect,
&requested_rect,
gravity, w, h);
gravity,
client_rect.width,
client_rect.height);
}
else
{
requested_rect.x = root_x_nw;
requested_rect.y = root_y_nw;
requested_rect.width = w;
requested_rect.height = h;
requested_rect = client_rect;
}
new_rect = requested_rect;
@ -3898,18 +3888,17 @@ meta_window_resize (MetaWindow *window,
int w,
int h)
{
int x, y;
MetaMoveResizeFlags flags;
MetaRectangle rect;
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;
meta_window_move_resize_internal (window,
flags,
NorthWestGravity,
x, y, w, h);
rect.width = w;
rect.height = h;
meta_window_move_resize_internal (window, flags, NorthWestGravity, rect);
}
/**
@ -3931,18 +3920,20 @@ meta_window_move (MetaWindow *window,
int root_y_nw)
{
MetaMoveResizeFlags flags;
MetaRectangle rect;
g_return_if_fail (!window->override_redirect);
flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION;
meta_window_move_resize_internal (window,
flags,
NorthWestGravity,
root_x_nw, root_y_nw,
window->rect.width,
window->rect.height);
rect.x = root_x_nw;
rect.y = root_y_nw;
rect.width = window->rect.width;
rect.height = window->rect.height;
meta_window_move_resize_internal (window, flags, NorthWestGravity, rect);
}
/**
* meta_window_move_frame:
* @window: a #MetaWindow
@ -4060,16 +4051,19 @@ meta_window_move_resize (MetaWindow *window,
int h)
{
MetaMoveResizeFlags flags;
MetaRectangle rect;
g_return_if_fail (!window->override_redirect);
flags = (user_op ? META_IS_USER_ACTION : 0) |
META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
meta_window_move_resize_internal (window,
flags,
NorthWestGravity,
root_x_nw, root_y_nw,
w, h);
rect.x = root_x_nw;
rect.y = root_y_nw;
rect.width = w;
rect.height = h;
meta_window_move_resize_internal (window, flags, NorthWestGravity, rect);
}
void
@ -4079,16 +4073,14 @@ meta_window_resize_with_gravity (MetaWindow *window,
int h,
int gravity)
{
int x, y;
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;
meta_window_move_resize_internal (window,
flags,
gravity,
x, y, w, h);
meta_window_move_resize_internal (window, flags, gravity, rect);
}
static void

View File

@ -217,7 +217,8 @@ meta_window_wayland_move_resize (MetaWindow *window,
int dy)
{
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
int x, y;
int gravity;
MetaRectangle rect;
MetaMoveResizeFlags flags;
flags = META_IS_WAYLAND_RESIZE;
@ -227,29 +228,31 @@ meta_window_wayland_move_resize (MetaWindow *window,
{
if (wl_window->has_saved_pos)
{
x = wl_window->saved_x;
y = wl_window->saved_y;
rect.x = wl_window->saved_x;
rect.y = wl_window->saved_y;
wl_window->has_saved_pos = FALSE;
flags |= META_IS_MOVE_ACTION;
}
else
{
meta_window_get_position (window, &x, &y);
meta_window_get_position (window, &rect.x, &rect.y);
}
if (dx != 0 || dy != 0)
{
x += dx;
y += dy;
rect.x += dx;
rect.y += dy;
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;
meta_window_move_resize_internal (window, flags,
meta_resize_gravity_from_grab_op (window->display->grab_op),
x, y, width, height);
gravity = meta_resize_gravity_from_grab_op (window->display->grab_op);
meta_window_move_resize_internal (window, flags, gravity, rect);
meta_window_save_user_window_placement (window);
}

View File

@ -488,8 +488,7 @@ meta_window_apply_session_info (MetaWindow *window,
flags = META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION;
adjust_for_gravity (window, FALSE, gravity, &rect);
meta_window_move_resize_internal (window, flags, gravity,
rect.x, rect.y, rect.width, rect.height);
meta_window_move_resize_internal (window, flags, gravity, rect);
}
}
@ -544,8 +543,7 @@ meta_window_x11_manage (MetaWindow *window)
rect.height = window->size_hints.height;
adjust_for_gravity (window, TRUE, gravity, &rect);
meta_window_move_resize_internal (window, flags, gravity,
rect.x, rect.y, rect.width, rect.height);
meta_window_move_resize_internal (window, flags, gravity, rect);
}
}
@ -2079,8 +2077,7 @@ meta_window_move_resize_request (MetaWindow *window,
rect.height = height;
adjust_for_gravity (window, TRUE, gravity, &rect);
meta_window_move_resize_internal (window, flags, gravity,
rect.x, rect.y, rect.width, rect.height);
meta_window_move_resize_internal (window, flags, gravity, rect);
}
/* window->user_rect exists to allow "snapping-back" the window if a