Improve dragging pointer UnmapNotify policy
Patch status: superseded
Patch by Tony Crisci
Long description:
Only cancel a drag operation on UnmapNotify when the unmapping window is managed on the current workspace. fixes #1108
To apply this patch, use:
curl http://cr.i3wm.org/patch/289/raw.patch | git am
b/src/floating.c
17 |
@@ -629,6 +629,7 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_ |
18 |
xcb_flush(conn); |
19 |
|
20 |
xcb_generic_event_t *inside_event, *last_motion_notify = NULL; |
21 |
+ Con *inside_con = NULL; |
22 |
bool loop_done = false; |
23 |
/* The return value, set to DRAG_CANCEL on user cancel */ |
24 |
drag_result_t drag_result = DRAG_SUCCESS; |
25 |
@@ -656,10 +657,20 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_ |
26 |
break; |
27 |
|
28 |
case XCB_UNMAP_NOTIFY: |
29 |
- DLOG("Unmap-notify, aborting\n"); |
30 |
+ inside_con = con_by_window_id(((xcb_unmap_notify_event_t*)inside_event)->window); |
31 |
+ |
32 |
+ DLOG("UnmapNotify for window 0x%08x (container %p)\n", ((xcb_unmap_notify_event_t*)inside_event)->window, inside_con); |
33 |
+ /* cancel the drag if a window is unmapped on the focused workspace */ |
34 |
+ if (inside_con != NULL && inside_con->type && ( |
35 |
+ con_get_workspace(inside_con) == NULL || |
36 |
+ con_get_workspace(inside_con) == con_get_workspace(focused) |
37 |
+ ) |
38 |
+ ) { |
39 |
+ DLOG("UnmapNotify for a managed window on the current workspace, aborting\n"); |
40 |
+ loop_done = true; |
41 |
+ } |
42 |
+ |
43 |
handle_event(type, inside_event); |
44 |
- loop_done = true; |
45 |
- drag_result = DRAG_CANCEL; |
46 |
break; |
47 |
|
48 |
case XCB_KEY_PRESS: |