mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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
|
||||
meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
int *new_x,
|
||||
int *new_y,
|
||||
MetaEdgeResistanceFlags flags)
|
||||
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,14 +1144,17 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_edge_resistance_for_resize (MetaWindow *window,
|
||||
int *new_width,
|
||||
int *new_height,
|
||||
MetaGravity gravity,
|
||||
MetaEdgeResistanceFlags flags)
|
||||
meta_window_drag_edge_resistance_for_resize (MetaWindowDrag *window_drag,
|
||||
int *new_width,
|
||||
int *new_height,
|
||||
MetaGravity gravity,
|
||||
MetaEdgeResistanceFlags flags)
|
||||
{
|
||||
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;
|
||||
|
@ -24,15 +24,18 @@
|
||||
|
||||
#include "core/window-private.h"
|
||||
|
||||
void meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
int *new_x,
|
||||
int *new_y,
|
||||
MetaEdgeResistanceFlags flags);
|
||||
void meta_window_edge_resistance_for_resize (MetaWindow *window,
|
||||
int *new_width,
|
||||
int *new_height,
|
||||
MetaGravity gravity,
|
||||
MetaEdgeResistanceFlags flags);
|
||||
#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_drag_edge_resistance_for_resize (MetaWindowDrag *window_drag,
|
||||
int *new_width,
|
||||
int *new_height,
|
||||
MetaGravity gravity,
|
||||
MetaEdgeResistanceFlags flags);
|
||||
|
||||
#endif /* META_EDGE_RESISTANCE_H */
|
||||
|
||||
|
@ -615,10 +615,10 @@ 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,
|
||||
&x,
|
||||
&y,
|
||||
flags);
|
||||
meta_window_drag_edge_resistance_for_move (window_drag,
|
||||
&x,
|
||||
&y,
|
||||
flags);
|
||||
|
||||
meta_window_move_frame (window, TRUE, x, y);
|
||||
update_keyboard_move (window_drag);
|
||||
@ -970,11 +970,11 @@ 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,
|
||||
&width,
|
||||
&height,
|
||||
gravity,
|
||||
flags);
|
||||
meta_window_drag_edge_resistance_for_resize (window_drag,
|
||||
&width,
|
||||
&height,
|
||||
gravity,
|
||||
flags);
|
||||
|
||||
meta_window_resize_frame_with_gravity (window,
|
||||
TRUE,
|
||||
@ -1271,10 +1271,10 @@ update_move (MetaWindowDrag *window_drag,
|
||||
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||
|
||||
/* Do any edge resistance/snapping */
|
||||
meta_window_edge_resistance_for_move (window,
|
||||
&new_x,
|
||||
&new_y,
|
||||
flags);
|
||||
meta_window_drag_edge_resistance_for_move (window_drag,
|
||||
&new_x,
|
||||
&new_y,
|
||||
flags);
|
||||
|
||||
meta_window_move_frame (window, TRUE, new_x, new_y);
|
||||
}
|
||||
@ -1427,11 +1427,11 @@ update_resize (MetaWindowDrag *window_drag,
|
||||
flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||
|
||||
/* Do any edge resistance/snapping */
|
||||
meta_window_edge_resistance_for_resize (window,
|
||||
&new_rect.width,
|
||||
&new_rect.height,
|
||||
gravity,
|
||||
flags);
|
||||
meta_window_drag_edge_resistance_for_resize (window_drag,
|
||||
&new_rect.width,
|
||||
&new_rect.height,
|
||||
gravity,
|
||||
flags);
|
||||
|
||||
meta_window_resize_frame_with_gravity (window, TRUE,
|
||||
new_rect.width, new_rect.height,
|
||||
|
Loading…
Reference in New Issue
Block a user