From: Michael Stapelberg Date: Sun, 31 Jul 2011 17:48:39 +0000 (+0200) Subject: handle the xcb_grab_pointer reply X-Git-Tag: 4.0~14^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6c35a0b93b292b3d08d34cccc41544e5b8dbf707;p=i3%2Fi3 handle the xcb_grab_pointer reply --- diff --git a/src/floating.c b/src/floating.c index f9ac6e82..820fb560 100644 --- a/src/floating.c +++ b/src/floating.c @@ -407,16 +407,22 @@ void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t memcpy(&old_rect, &(con->rect), sizeof(Rect)); /* Grab the pointer */ - /* TODO: returncode */ - xcb_grab_pointer(conn, - false, /* get all pointer events specified by the following mask */ - root, /* grab the root window */ - XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION, /* which events to let through */ - XCB_GRAB_MODE_ASYNC, /* pointer events should continue as normal */ - XCB_GRAB_MODE_ASYNC, /* keyboard mode */ - confine_to, /* confine_to = in which window should the cursor stay */ - XCB_NONE, /* don’t display a special cursor */ - XCB_CURRENT_TIME); + xcb_grab_pointer_cookie_t cookie; + xcb_grab_pointer_reply_t *reply; + cookie = xcb_grab_pointer(conn, + false, /* get all pointer events specified by the following mask */ + root, /* grab the root window */ + XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION, /* which events to let through */ + XCB_GRAB_MODE_ASYNC, /* pointer events should continue as normal */ + XCB_GRAB_MODE_ASYNC, /* keyboard mode */ + confine_to, /* confine_to = in which window should the cursor stay */ + XCB_NONE, /* don’t display a special cursor */ + XCB_CURRENT_TIME); + + if ((reply = xcb_grab_pointer_reply(conn, cookie, NULL)) == NULL) { + ELOG("Could not grab pointer\n"); + return; + } /* Go into our own event loop */ xcb_flush(conn);