Add ability to escape out of a mouse-resize operation

Implement #1074. drag_cancel grabs the keyboard and returns DRAG_CANCEL
when the user presses any key during the grab.
This commit is contained in:
Tony Crisci
2013-09-25 20:52:59 -04:00
committed by Michael Stapelberg
parent a49dfaf26c
commit 459490b67b
3 changed files with 78 additions and 18 deletions

View File

@ -154,12 +154,16 @@ int resize_graphical_handler(Con *first, Con *second, orientation_t orientation,
const struct callback_params params = { orientation, output, helpwin, &new_position };
drag_pointer(NULL, event, grabwin, BORDER_TOP, 0, resize_callback, &params);
drag_result_t drag_result = drag_pointer(NULL, event, grabwin, BORDER_TOP, 0, resize_callback, &params);
xcb_destroy_window(conn, helpwin);
xcb_destroy_window(conn, grabwin);
xcb_flush(conn);
/* User cancelled the drag so no action should be taken. */
if (drag_result == DRAG_CANCEL)
return 0;
int pixels;
if (orientation == HORIZ)
pixels = (new_position - event->root_x);