From b2ebe9c26247a76842d50238e093991f22e267a6 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 21 Oct 2022 16:36:30 +0200 Subject: [PATCH] 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: --- src/compositor/meta-window-drag.c | 12 +++++++----- src/core/window-private.h | 3 --- src/core/window.c | 2 -- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/compositor/meta-window-drag.c b/src/compositor/meta-window-drag.c index 64a2cc279..d3b3f0404 100644 --- a/src/compositor/meta-window-drag.c +++ b/src/compositor/meta-window-drag.c @@ -67,6 +67,8 @@ struct _MetaWindowDrag { gboolean threshold_movement_reached; /* raise_on_click == FALSE. */ unsigned int last_edge_resistance_flags; unsigned int move_resize_later_id; + /* if TRUE, window was maximized at start of current grab op */ + gboolean shaken_loose; gulong unmanaging_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 * 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); else if (tile_mode != META_TILE_NONE) 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 * 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); else 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 * 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; /* 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 * 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) { 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->anchor_root_x = x; window_drag->anchor_root_y = y; - window->shaken_loose = FALSE; + window_drag->shaken_loose = FALSE; meta_window_maximize (window, META_MAXIMIZE_BOTH); } diff --git a/src/core/window-private.h b/src/core/window-private.h index 074a3654d..6908b904e 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -530,9 +530,6 @@ struct _MetaWindow */ 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 */ guint have_focus_click_grab : 1; diff --git a/src/core/window.c b/src/core/window.c index 8e3cce845..8546f1f90 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -270,7 +270,6 @@ static void meta_window_real_grab_op_ended (MetaWindow *window, MetaGrabOp op) { - window->shaken_loose = FALSE; } static void @@ -1093,7 +1092,6 @@ meta_window_constructed (GObject *object) window->user_time_window = None; window->input = TRUE; window->calc_placement = FALSE; - window->shaken_loose = FALSE; window->have_focus_click_grab = FALSE; window->unmaps_pending = 0;