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:
parent
36bda45888
commit
60f11e419f
@ -1065,13 +1065,16 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_window_edge_resistance_for_move (MetaWindow *window,
|
meta_window_drag_edge_resistance_for_move (MetaWindowDrag *window_drag,
|
||||||
int *new_x,
|
int *new_x,
|
||||||
int *new_y,
|
int *new_y,
|
||||||
MetaEdgeResistanceFlags flags)
|
MetaEdgeResistanceFlags flags)
|
||||||
{
|
{
|
||||||
MetaRectangle old_outer, proposed_outer, new_outer;
|
MetaRectangle old_outer, proposed_outer, new_outer;
|
||||||
gboolean is_resize, is_keyboard_op, snap;
|
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);
|
meta_window_get_frame_rect (window, &old_outer);
|
||||||
|
|
||||||
@ -1141,7 +1144,7 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_window_edge_resistance_for_resize (MetaWindow *window,
|
meta_window_drag_edge_resistance_for_resize (MetaWindowDrag *window_drag,
|
||||||
int *new_width,
|
int *new_width,
|
||||||
int *new_height,
|
int *new_height,
|
||||||
MetaGravity gravity,
|
MetaGravity gravity,
|
||||||
@ -1149,6 +1152,9 @@ meta_window_edge_resistance_for_resize (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
MetaRectangle old_outer, new_outer;
|
MetaRectangle old_outer, new_outer;
|
||||||
int proposed_outer_width, proposed_outer_height;
|
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);
|
meta_window_get_frame_rect (window, &old_outer);
|
||||||
proposed_outer_width = *new_width;
|
proposed_outer_width = *new_width;
|
||||||
|
@ -24,11 +24,14 @@
|
|||||||
|
|
||||||
#include "core/window-private.h"
|
#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_x,
|
||||||
int *new_y,
|
int *new_y,
|
||||||
MetaEdgeResistanceFlags flags);
|
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_width,
|
||||||
int *new_height,
|
int *new_height,
|
||||||
MetaGravity gravity,
|
MetaGravity gravity,
|
||||||
|
@ -615,7 +615,7 @@ process_keyboard_move_grab (MetaWindowDrag *window_drag,
|
|||||||
window_drag->last_edge_resistance_flags =
|
window_drag->last_edge_resistance_flags =
|
||||||
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||||
|
|
||||||
meta_window_edge_resistance_for_move (window,
|
meta_window_drag_edge_resistance_for_move (window_drag,
|
||||||
&x,
|
&x,
|
||||||
&y,
|
&y,
|
||||||
flags);
|
flags);
|
||||||
@ -970,7 +970,7 @@ process_keyboard_resize_grab (MetaWindowDrag *window_drag,
|
|||||||
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||||
|
|
||||||
/* Do any edge resistance/snapping */
|
/* Do any edge resistance/snapping */
|
||||||
meta_window_edge_resistance_for_resize (window,
|
meta_window_drag_edge_resistance_for_resize (window_drag,
|
||||||
&width,
|
&width,
|
||||||
&height,
|
&height,
|
||||||
gravity,
|
gravity,
|
||||||
@ -1271,7 +1271,7 @@ update_move (MetaWindowDrag *window_drag,
|
|||||||
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||||
|
|
||||||
/* Do any edge resistance/snapping */
|
/* Do any edge resistance/snapping */
|
||||||
meta_window_edge_resistance_for_move (window,
|
meta_window_drag_edge_resistance_for_move (window_drag,
|
||||||
&new_x,
|
&new_x,
|
||||||
&new_y,
|
&new_y,
|
||||||
flags);
|
flags);
|
||||||
@ -1427,7 +1427,7 @@ update_resize (MetaWindowDrag *window_drag,
|
|||||||
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||||
|
|
||||||
/* Do any edge resistance/snapping */
|
/* 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.width,
|
||||||
&new_rect.height,
|
&new_rect.height,
|
||||||
gravity,
|
gravity,
|
||||||
|
Loading…
Reference in New Issue
Block a user