mirror of
https://github.com/brl/mutter.git
synced 2024-11-09 23:46:33 -05:00
window: "Hide" edge resistance behind modifier key
Aligning windows manually with other windows has become less important since the advent of tiling. This decreases the usefulness of edge resistance, which in fact many users perceive as lag nowadays. Account for that by limiting resistance to screen and monitor edges by default, and only include windows when the control key is pressed. https://bugzilla.gnome.org/show_bug.cgi?id=679609
This commit is contained in:
parent
f9edb6bad3
commit
22902a5e2c
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user