diff --git a/src/core/edge-resistance.c b/src/core/edge-resistance.c index 870ce6e78..3e42936e7 100644 --- a/src/core/edge-resistance.c +++ b/src/core/edge-resistance.c @@ -334,6 +334,7 @@ apply_edge_resistance (MetaWindow *window, ResistanceDataForAnEdge *resistance_data, GSourceFunc timeout_func, gboolean xdir, + gboolean include_windows, gboolean keyboard_op) { int i, begin, end; @@ -420,7 +421,8 @@ apply_edge_resistance (MetaWindow *window, switch (edge->edge_type) { case META_EDGE_WINDOW: - timeout_length_ms = TIMEOUT_RESISTANCE_LENGTH_MS_WINDOW; + if (include_windows) + timeout_length_ms = TIMEOUT_RESISTANCE_LENGTH_MS_WINDOW; break; case META_EDGE_MONITOR: timeout_length_ms = TIMEOUT_RESISTANCE_LENGTH_MS_MONITOR; @@ -464,6 +466,8 @@ apply_edge_resistance (MetaWindow *window, switch (edge->edge_type) { case META_EDGE_WINDOW: + if (!include_windows) + break; if (movement_towards_edge (edge->side_type, increment)) threshold = PIXEL_DISTANCE_THRESHOLD_TOWARDS_WINDOW; else @@ -640,6 +644,8 @@ apply_edge_resistance_to_each_side (MetaDisplay *display, } else { + gboolean include_windows = flags & META_EDGE_RESISTANCE_WINDOWS; + /* Disable edge resistance for resizes when windows have size * increment hints; see #346782. For all other cases, apply * them. @@ -656,6 +662,7 @@ apply_edge_resistance_to_each_side (MetaDisplay *display, &edge_data->left_data, timeout_func, TRUE, + include_windows, keyboard_op); new_right = apply_edge_resistance (window, BOX_RIGHT (*old_outer), @@ -666,6 +673,7 @@ apply_edge_resistance_to_each_side (MetaDisplay *display, &edge_data->right_data, timeout_func, TRUE, + include_windows, keyboard_op); } else @@ -685,6 +693,7 @@ apply_edge_resistance_to_each_side (MetaDisplay *display, &edge_data->top_data, timeout_func, FALSE, + include_windows, keyboard_op); new_bottom = apply_edge_resistance (window, BOX_BOTTOM (*old_outer), @@ -695,6 +704,7 @@ apply_edge_resistance_to_each_side (MetaDisplay *display, &edge_data->bottom_data, timeout_func, FALSE, + include_windows, keyboard_op); } else diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 417294cbd..f649093c9 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2420,7 +2420,7 @@ process_keyboard_move_grab (MetaDisplay *display, x = frame_rect.x; y = frame_rect.y; - flags = META_EDGE_RESISTANCE_KEYBOARD_OP; + flags = META_EDGE_RESISTANCE_KEYBOARD_OP | META_EDGE_RESISTANCE_WINDOWS; if ((event->modifier_state & CLUTTER_SHIFT_MASK) != 0) flags |= META_EDGE_RESISTANCE_SNAP; diff --git a/src/core/window-private.h b/src/core/window-private.h index ef0023108..2ef0db714 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -162,6 +162,7 @@ typedef enum META_EDGE_RESISTANCE_DEFAULT = 0, META_EDGE_RESISTANCE_SNAP = 1 << 0, META_EDGE_RESISTANCE_KEYBOARD_OP = 1 << 1, + META_EDGE_RESISTANCE_WINDOWS = 1 << 2, } MetaEdgeResistanceFlags; struct _MetaWindow diff --git a/src/core/window.c b/src/core/window.c index 968893786..149a6fa62 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -6421,6 +6421,9 @@ end_grab_op (MetaWindow *window, if (modifiers & CLUTTER_SHIFT_MASK) flags |= META_EDGE_RESISTANCE_SNAP; + if (modifiers & CLUTTER_CONTROL_MASK) + flags |= META_EDGE_RESISTANCE_WINDOWS; + if (meta_grab_op_is_moving (window->display->grab_op)) { if (window->display->preview_tile_mode != META_TILE_NONE) @@ -6431,7 +6434,7 @@ end_grab_op (MetaWindow *window, else if (meta_grab_op_is_resizing (window->display->grab_op)) { if (window->tile_match != NULL) - flags |= META_EDGE_RESISTANCE_SNAP; + flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS); update_resize (window, flags, x, y, TRUE); maybe_maximize_tiled_window (window); @@ -6503,6 +6506,9 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, if (modifier_state & CLUTTER_SHIFT_MASK) flags |= META_EDGE_RESISTANCE_SNAP; + if (modifier_state & CLUTTER_CONTROL_MASK) + flags |= META_EDGE_RESISTANCE_WINDOWS; + meta_display_check_threshold_reached (window->display, x, y); if (meta_grab_op_is_moving (window->display->grab_op)) { @@ -6511,7 +6517,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, else if (meta_grab_op_is_resizing (window->display->grab_op)) { if (window->tile_match != NULL) - flags |= META_EDGE_RESISTANCE_SNAP; + flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS); update_resize (window, flags, x, y, FALSE); }