From: Tony Crisci Date: Sat, 9 Nov 2013 17:51:44 +0000 (-0500) Subject: Add sensible discretion to UnmapNotify drag abort X-Git-Tag: 4.7~24 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f3bf314662e739e4c0ab3264e793871983242325;p=i3%2Fi3 Add sensible discretion to UnmapNotify drag abort Only abort a drag action on UnmapNotify when the unmapping window is managed on the current workspace. fixes #1108 --- diff --git a/src/floating.c b/src/floating.c index 9b9d3af7..10962403 100644 --- a/src/floating.c +++ b/src/floating.c @@ -629,6 +629,8 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_ xcb_flush(conn); xcb_generic_event_t *inside_event, *last_motion_notify = NULL; + Con *inside_con = NULL; + drag_result_t drag_result = DRAGGING; /* I’ve always wanted to have my own eventhandler… */ while (drag_result == DRAGGING && (inside_event = xcb_wait_for_event(conn))) { @@ -654,8 +656,16 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_ break; case XCB_UNMAP_NOTIFY: - DLOG("Unmap-notify, aborting\n"); - drag_result = DRAG_ABORT; + inside_con = con_by_window_id(((xcb_unmap_notify_event_t*)inside_event)->window); + + if (inside_con != NULL) { + DLOG("UnmapNotify for window 0x%08x (container %p)\n", ((xcb_unmap_notify_event_t*)inside_event)->window, inside_con); + + if (con_get_workspace(inside_con) == con_get_workspace(focused)) { + DLOG("UnmapNotify for a managed window on the current workspace, aborting\n"); + drag_result = DRAG_ABORT; + } + } handle_event(type, inside_event); break;