Skip to content

Commit 632a165

Browse files
committed
frames.c: Re-implement directional maximization when double-clicking
the frame edges. Fixes #620.
1 parent 8961c35 commit 632a165

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

src/core/window.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6476,10 +6476,15 @@ update_move (MetaWindow *window,
64766476

64776477
/* shake loose (unmaximize) maximized or tiled window if dragged beyond
64786478
* the threshold in the Y direction. Tiled windows can also be pulled
6479-
* loose via X motion.
6479+
* loose via X motion. The fact you can 'slide' one-way-maximized
6480+
* windows along their maximized edge is useful but it's easy to accidentally
6481+
* pull them loose while doing so. Double their thresholds to make this less
6482+
* likely to happen.
64806483
*/
64816484

64826485
if ((META_WINDOW_MAXIMIZED (window) && ABS (dy) >= shake_threshold) ||
6486+
(META_WINDOW_MAXIMIZED_HORIZONTALLY (window) && ABS (dx) >= (shake_threshold * 2)) ||
6487+
(META_WINDOW_MAXIMIZED_VERTICALLY (window) && ABS (dy) >= (shake_threshold * 2)) ||
64836488
(META_WINDOW_TILED (window) && (MAX (ABS (dx), ABS (dy)) >= shake_threshold)))
64846489
{
64856490
double prop;

src/ui/frames.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,27 @@ get_button_number (const ClutterEvent *event)
10941094
return -1;
10951095
}
10961096

1097+
static gboolean
1098+
meta_frame_double_click_edge_event (MetaUIFrame *frame,
1099+
const ClutterEvent *event,
1100+
MetaFrameControl control)
1101+
{
1102+
switch (control) {
1103+
case META_FRAME_CONTROL_RESIZE_N:
1104+
case META_FRAME_CONTROL_RESIZE_S:
1105+
return meta_frame_titlebar_event (frame,
1106+
event,
1107+
C_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_VERTICALLY);
1108+
case META_FRAME_CONTROL_RESIZE_E:
1109+
case META_FRAME_CONTROL_RESIZE_W:
1110+
return meta_frame_titlebar_event (frame,
1111+
event,
1112+
C_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_HORIZONTALLY);
1113+
default:
1114+
return FALSE;
1115+
}
1116+
}
1117+
10971118
static gboolean
10981119
meta_frame_left_click_event (MetaUIFrame *frame,
10991120
const ClutterEvent *event)
@@ -1238,6 +1259,16 @@ handle_press_event (MetaUIFrame *frame,
12381259
return meta_frame_double_click_event (frame, event);
12391260
}
12401261

1262+
if ((control == META_FRAME_CONTROL_RESIZE_N ||
1263+
control == META_FRAME_CONTROL_RESIZE_S ||
1264+
control == META_FRAME_CONTROL_RESIZE_E ||
1265+
control == META_FRAME_CONTROL_RESIZE_W) &&
1266+
action == META_ACTION_DOUBLE_CLICK)
1267+
{
1268+
meta_x11_wm_end_grab_op (frame->frames->x11_display, evtime);
1269+
return meta_frame_double_click_edge_event (frame, event, control);
1270+
}
1271+
12411272
if (meta_x11_wm_get_grab_op (frame->frames->x11_display) != META_GRAB_OP_NONE)
12421273
return FALSE; /* already up to something */
12431274

0 commit comments

Comments
 (0)