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:
committed by
Michael Stapelberg
parent
a49dfaf26c
commit
459490b67b
@ -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, ¶ms);
|
||||
drag_result_t drag_result = drag_pointer(NULL, event, grabwin, BORDER_TOP, 0, resize_callback, ¶ms);
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user