core: Move accounting of "shaken_loose" to MetaWindowDrag

It's entirely accessed from there (besides reset and initialization),
so can be completely taken there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
Carlos Garnacho 2022-10-21 16:36:30 +02:00 committed by Marge Bot
parent 39f1b6dca0
commit b2ebe9c262
3 changed files with 7 additions and 10 deletions

View File

@ -67,6 +67,8 @@ struct _MetaWindowDrag {
gboolean threshold_movement_reached; /* raise_on_click == FALSE. */ gboolean threshold_movement_reached; /* raise_on_click == FALSE. */
unsigned int last_edge_resistance_flags; unsigned int last_edge_resistance_flags;
unsigned int move_resize_later_id; unsigned int move_resize_later_id;
/* if TRUE, window was maximized at start of current grab op */
gboolean shaken_loose;
gulong unmanaging_id; gulong unmanaging_id;
gulong size_changed_id; gulong size_changed_id;
@ -481,7 +483,7 @@ process_mouse_move_resize_grab (MetaWindowDrag *window_drag,
* need to remaximize it. In normal cases, we need to do a * need to remaximize it. In normal cases, we need to do a
* moveresize now to get the position back to the original. * moveresize now to get the position back to the original.
*/ */
if (window->shaken_loose || tile_mode == META_TILE_MAXIMIZED) if (window_drag->shaken_loose || tile_mode == META_TILE_MAXIMIZED)
meta_window_maximize (window, META_MAXIMIZE_BOTH); meta_window_maximize (window, META_MAXIMIZE_BOTH);
else if (tile_mode != META_TILE_NONE) else if (tile_mode != META_TILE_NONE)
meta_window_restore_tile (window, meta_window_restore_tile (window,
@ -550,7 +552,7 @@ process_keyboard_move_grab (MetaWindowDrag *window_drag,
* remaximize it. In normal cases, we need to do a moveresize * remaximize it. In normal cases, we need to do a moveresize
* now to get the position back to the original. * now to get the position back to the original.
*/ */
if (window->shaken_loose) if (window_drag->shaken_loose)
meta_window_maximize (window, META_MAXIMIZE_BOTH); meta_window_maximize (window, META_MAXIMIZE_BOTH);
else else
meta_window_move_resize_frame (window_drag->effective_grab_window, meta_window_move_resize_frame (window_drag->effective_grab_window,
@ -1158,7 +1160,7 @@ update_move (MetaWindowDrag *window_drag,
* when dragged near the top; do not snap back if tiling * when dragged near the top; do not snap back if tiling
* is enabled, as top edge tiling can be used in that case * is enabled, as top edge tiling can be used in that case
*/ */
window->shaken_loose = !meta_prefs_get_edge_tiling (); window_drag->shaken_loose = !meta_prefs_get_edge_tiling ();
window->tile_mode = META_TILE_NONE; window->tile_mode = META_TILE_NONE;
/* move the unmaximized window to the cursor */ /* move the unmaximized window to the cursor */
@ -1188,7 +1190,7 @@ update_move (MetaWindowDrag *window_drag,
/* remaximize window on another monitor if window has been shaken /* remaximize window on another monitor if window has been shaken
* loose or it is still maximized (then move straight) * loose or it is still maximized (then move straight)
*/ */
else if ((window->shaken_loose || META_WINDOW_MAXIMIZED (window)) && else if ((window_drag->shaken_loose || META_WINDOW_MAXIMIZED (window)) &&
window->tile_mode != META_TILE_LEFT && window->tile_mode != META_TILE_RIGHT) window->tile_mode != META_TILE_LEFT && window->tile_mode != META_TILE_RIGHT)
{ {
MetaDisplay *display = meta_window_get_display (window); MetaDisplay *display = meta_window_get_display (window);
@ -1238,7 +1240,7 @@ update_move (MetaWindowDrag *window_drag,
window_drag->initial_window_pos = work_area; window_drag->initial_window_pos = work_area;
window_drag->anchor_root_x = x; window_drag->anchor_root_x = x;
window_drag->anchor_root_y = y; window_drag->anchor_root_y = y;
window->shaken_loose = FALSE; window_drag->shaken_loose = FALSE;
meta_window_maximize (window, META_MAXIMIZE_BOTH); meta_window_maximize (window, META_MAXIMIZE_BOTH);
} }

View File

@ -530,9 +530,6 @@ struct _MetaWindow
*/ */
guint calc_placement : 1; guint calc_placement : 1;
/* if TRUE, window was maximized at start of current grab op */
guint shaken_loose : 1;
/* if TRUE we have a grab on the focus click buttons */ /* if TRUE we have a grab on the focus click buttons */
guint have_focus_click_grab : 1; guint have_focus_click_grab : 1;

View File

@ -270,7 +270,6 @@ static void
meta_window_real_grab_op_ended (MetaWindow *window, meta_window_real_grab_op_ended (MetaWindow *window,
MetaGrabOp op) MetaGrabOp op)
{ {
window->shaken_loose = FALSE;
} }
static void static void
@ -1093,7 +1092,6 @@ meta_window_constructed (GObject *object)
window->user_time_window = None; window->user_time_window = None;
window->input = TRUE; window->input = TRUE;
window->calc_placement = FALSE; window->calc_placement = FALSE;
window->shaken_loose = FALSE;
window->have_focus_click_grab = FALSE; window->have_focus_click_grab = FALSE;
window->unmaps_pending = 0; window->unmaps_pending = 0;