Implement drag cancel for resizing tiled windows
Patch status: needinfo
Patch by Tony Crisci
Long description:
Hi, I am a new developer and this is my first code submission to a project. If I do anything wrong, please let me know. The patches I've submitted implement #1074 "Add ability to escape out of a mouse-resize operation".
To apply this patch, use:
curl http://cr.i3wm.org/patch/236/raw.patch | git am
b/src/resize.c
18 |
@@ -106,12 +106,16 @@ int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, |
19 |
|
20 |
const struct callback_params params = { orientation, output, helpwin, &new_position }; |
21 |
|
22 |
- drag_pointer(NULL, event, grabwin, BORDER_TOP, 0, resize_callback, ¶ms); |
23 |
+ int drag_result = drag_pointer(NULL, event, grabwin, BORDER_TOP, 0, resize_callback, ¶ms); |
24 |
|
25 |
xcb_destroy_window(conn, helpwin); |
26 |
xcb_destroy_window(conn, grabwin); |
27 |
xcb_flush(conn); |
28 |
|
29 |
+ // User cancelled the drag so no action should be taken. |
30 |
+ if (drag_result == 1) |
31 |
+ return 0; |
32 |
+ |
33 |
int pixels; |
34 |
if (orientation == HORIZ) |
35 |
pixels = (new_position - event->root_x); |