window: Rename the requested_rect to the unconstrained_rect
The requested_rect is a strange name for it, because it's not actually the rect that the user or client requested all the time: in the case of a simple move or a simple resize, we calculate some of the fields ourselves. To the MetaWindow subclass implementations, it just means "the rect before we constrained it", so just use the name unconstrained_rect. This also makes it match the name of the MetaWindow field.
This commit is contained in:
parent
9df5b17940
commit
cbffbb0be0
@ -478,7 +478,7 @@ struct _MetaWindowClass
|
|||||||
void (*current_workspace_changed) (MetaWindow *window);
|
void (*current_workspace_changed) (MetaWindow *window);
|
||||||
void (*move_resize_internal) (MetaWindow *window,
|
void (*move_resize_internal) (MetaWindow *window,
|
||||||
int gravity,
|
int gravity,
|
||||||
MetaRectangle requested_rect,
|
MetaRectangle unconstrained_rect,
|
||||||
MetaRectangle constrained_rect,
|
MetaRectangle constrained_rect,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
MetaMoveResizeResultFlags *result);
|
MetaMoveResizeResultFlags *result);
|
||||||
|
@ -3651,8 +3651,8 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
gboolean did_placement;
|
gboolean did_placement;
|
||||||
MetaRectangle new_rect;
|
MetaRectangle unconstrained_rect;
|
||||||
MetaRectangle requested_rect;
|
MetaRectangle constrained_rect;
|
||||||
MetaMoveResizeResultFlags result = 0;
|
MetaMoveResizeResultFlags result = 0;
|
||||||
|
|
||||||
g_return_if_fail (!window->override_redirect);
|
g_return_if_fail (!window->override_redirect);
|
||||||
@ -3676,48 +3676,47 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
|
|
||||||
meta_window_get_client_root_coords (window, &old_rect);
|
meta_window_get_client_root_coords (window, &old_rect);
|
||||||
meta_rectangle_resize_with_gravity (&old_rect,
|
meta_rectangle_resize_with_gravity (&old_rect,
|
||||||
&requested_rect,
|
&unconstrained_rect,
|
||||||
gravity,
|
gravity,
|
||||||
client_rect.width,
|
client_rect.width,
|
||||||
client_rect.height);
|
client_rect.height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
requested_rect = client_rect;
|
unconstrained_rect = client_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is only a move, then ignore the passed in size and
|
/* If this is only a move, then ignore the passed in size and
|
||||||
* just use the existing size of the window. */
|
* just use the existing size of the window. */
|
||||||
if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == META_IS_MOVE_ACTION)
|
if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == META_IS_MOVE_ACTION)
|
||||||
{
|
{
|
||||||
requested_rect.width = window->rect.width;
|
unconstrained_rect.width = window->rect.width;
|
||||||
requested_rect.height = window->rect.height;
|
unconstrained_rect.height = window->rect.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_rect = requested_rect;
|
|
||||||
|
|
||||||
/* Save the unconstrained rectangle to the position we should be at
|
/* Save the unconstrained rectangle to the position we should be at
|
||||||
* before constraints kick in. */
|
* before constraints kick in. */
|
||||||
window->unconstrained_rect = new_rect;
|
window->unconstrained_rect = unconstrained_rect;
|
||||||
|
|
||||||
|
constrained_rect = unconstrained_rect;
|
||||||
if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION))
|
if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION))
|
||||||
{
|
{
|
||||||
MetaRectangle old_rect;
|
MetaRectangle old_rect;
|
||||||
meta_window_get_frame_rect (window, &old_rect);
|
meta_window_get_frame_rect (window, &old_rect);
|
||||||
|
|
||||||
meta_window_client_rect_to_frame_rect (window, &new_rect, &new_rect);
|
meta_window_client_rect_to_frame_rect (window, &constrained_rect, &constrained_rect);
|
||||||
|
|
||||||
meta_window_constrain (window,
|
meta_window_constrain (window,
|
||||||
flags,
|
flags,
|
||||||
gravity,
|
gravity,
|
||||||
&old_rect,
|
&old_rect,
|
||||||
&new_rect);
|
&constrained_rect);
|
||||||
|
|
||||||
meta_window_frame_rect_to_client_rect (window, &new_rect, &new_rect);
|
meta_window_frame_rect_to_client_rect (window, &constrained_rect, &constrained_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do the protocol-specific move/resize logic */
|
/* Do the protocol-specific move/resize logic */
|
||||||
META_WINDOW_GET_CLASS (window)->move_resize_internal (window, gravity, requested_rect, new_rect, flags, &result);
|
META_WINDOW_GET_CLASS (window)->move_resize_internal (window, gravity, unconstrained_rect, constrained_rect, flags, &result);
|
||||||
|
|
||||||
if (result & META_MOVE_RESIZE_RESULT_MOVED)
|
if (result & META_MOVE_RESIZE_RESULT_MOVED)
|
||||||
g_signal_emit (window, window_signals[POSITION_CHANGED], 0);
|
g_signal_emit (window, window_signals[POSITION_CHANGED], 0);
|
||||||
|
@ -150,7 +150,7 @@ meta_window_wayland_grab_op_ended (MetaWindow *window,
|
|||||||
static void
|
static void
|
||||||
meta_window_wayland_move_resize_internal (MetaWindow *window,
|
meta_window_wayland_move_resize_internal (MetaWindow *window,
|
||||||
int gravity,
|
int gravity,
|
||||||
MetaRectangle requested_rect,
|
MetaRectangle unconstrained_rect,
|
||||||
MetaRectangle constrained_rect,
|
MetaRectangle constrained_rect,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
MetaMoveResizeResultFlags *result)
|
MetaMoveResizeResultFlags *result)
|
||||||
@ -177,8 +177,8 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
*result |= META_MOVE_RESIZE_RESULT_RESIZED;
|
*result |= META_MOVE_RESIZE_RESULT_RESIZED;
|
||||||
window->rect.width = requested_rect.width;
|
window->rect.width = unconstrained_rect.width;
|
||||||
window->rect.height = requested_rect.height;
|
window->rect.height = unconstrained_rect.height;
|
||||||
|
|
||||||
/* This is a commit of an attach. We should move the window to match the
|
/* This is a commit of an attach. We should move the window to match the
|
||||||
* new position the client wants. */
|
* new position the client wants. */
|
||||||
|
@ -995,7 +995,7 @@ meta_window_x11_current_workspace_changed (MetaWindow *window)
|
|||||||
static void
|
static void
|
||||||
meta_window_x11_move_resize_internal (MetaWindow *window,
|
meta_window_x11_move_resize_internal (MetaWindow *window,
|
||||||
int gravity,
|
int gravity,
|
||||||
MetaRectangle requested_rect,
|
MetaRectangle unconstrained_rect,
|
||||||
MetaRectangle constrained_rect,
|
MetaRectangle constrained_rect,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
MetaMoveResizeResultFlags *result)
|
MetaMoveResizeResultFlags *result)
|
||||||
|
Loading…
Reference in New Issue
Block a user