compositor: Pass MetaWindowDrag to edge resistance functions

This code will be poked exclusively from the MetaWindowDrag, so
change the API to start passing this object around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
Carlos Garnacho 2022-10-27 18:01:02 +02:00 committed by Marge Bot
parent 36bda45888
commit 60f11e419f
3 changed files with 45 additions and 36 deletions

View File

@ -1065,13 +1065,16 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
}
void
meta_window_edge_resistance_for_move (MetaWindow *window,
meta_window_drag_edge_resistance_for_move (MetaWindowDrag *window_drag,
int *new_x,
int *new_y,
MetaEdgeResistanceFlags flags)
{
MetaRectangle old_outer, proposed_outer, new_outer;
gboolean is_resize, is_keyboard_op, snap;
MetaWindow *window;
window = meta_window_drag_get_window (window_drag);
meta_window_get_frame_rect (window, &old_outer);
@ -1141,7 +1144,7 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
}
void
meta_window_edge_resistance_for_resize (MetaWindow *window,
meta_window_drag_edge_resistance_for_resize (MetaWindowDrag *window_drag,
int *new_width,
int *new_height,
MetaGravity gravity,
@ -1149,6 +1152,9 @@ meta_window_edge_resistance_for_resize (MetaWindow *window,
{
MetaRectangle old_outer, new_outer;
int proposed_outer_width, proposed_outer_height;
MetaWindow *window;
window = meta_window_drag_get_window (window_drag);
meta_window_get_frame_rect (window, &old_outer);
proposed_outer_width = *new_width;

View File

@ -24,11 +24,14 @@
#include "core/window-private.h"
void meta_window_edge_resistance_for_move (MetaWindow *window,
#include "compositor/meta-window-drag.h"
void meta_window_drag_edge_resistance_for_move (MetaWindowDrag *window_drag,
int *new_x,
int *new_y,
MetaEdgeResistanceFlags flags);
void meta_window_edge_resistance_for_resize (MetaWindow *window,
void meta_window_drag_edge_resistance_for_resize (MetaWindowDrag *window_drag,
int *new_width,
int *new_height,
MetaGravity gravity,

View File

@ -615,7 +615,7 @@ process_keyboard_move_grab (MetaWindowDrag *window_drag,
window_drag->last_edge_resistance_flags =
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
meta_window_edge_resistance_for_move (window,
meta_window_drag_edge_resistance_for_move (window_drag,
&x,
&y,
flags);
@ -970,7 +970,7 @@ process_keyboard_resize_grab (MetaWindowDrag *window_drag,
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
/* Do any edge resistance/snapping */
meta_window_edge_resistance_for_resize (window,
meta_window_drag_edge_resistance_for_resize (window_drag,
&width,
&height,
gravity,
@ -1271,7 +1271,7 @@ update_move (MetaWindowDrag *window_drag,
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
/* Do any edge resistance/snapping */
meta_window_edge_resistance_for_move (window,
meta_window_drag_edge_resistance_for_move (window_drag,
&new_x,
&new_y,
flags);
@ -1427,7 +1427,7 @@ update_resize (MetaWindowDrag *window_drag,
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
/* Do any edge resistance/snapping */
meta_window_edge_resistance_for_resize (window,
meta_window_drag_edge_resistance_for_resize (window_drag,
&new_rect.width,
&new_rect.height,
gravity,