]> git.sur5r.net Git - i3/i3/blobdiff - src/floating.c
replace remaining printf()s with D?LOG
[i3/i3] / src / floating.c
index 166e054cf67f93942013a0c1f3f6092971db4129..4180ba724903ea7494407016ef9ffdb77a7a6e99 100644 (file)
@@ -535,12 +535,12 @@ void floating_resize_window(Con *con, const bool proportional,
      * a bitmask of the nearest borders (BORDER_LEFT, BORDER_RIGHT, …) */
     border_t corner = 0;
 
-    if (event->event_x <= (con->rect.width / 2))
+    if (event->event_x <= (int16_t)(con->rect.width / 2))
         corner |= BORDER_LEFT;
     else corner |= BORDER_RIGHT;
 
     int cursor = 0;
-    if (event->event_y <= (con->rect.height / 2)) {
+    if (event->event_y <= (int16_t)(con->rect.height / 2)) {
         corner |= BORDER_TOP;
         cursor = (corner & BORDER_LEFT) ?
             XCURSOR_CURSOR_TOP_LEFT_CORNER : XCURSOR_CURSOR_TOP_RIGHT_CORNER;
@@ -682,6 +682,8 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_
     /* Grab the pointer */
     xcb_grab_pointer_cookie_t cookie;
     xcb_grab_pointer_reply_t *reply;
+    xcb_generic_error_t *error;
+
     cookie = xcb_grab_pointer(conn,
         false,               /* get all pointer events specified by the following mask */
         root,                /* grab the root window */
@@ -692,8 +694,9 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_
         xcursor,             /* possibly display a special cursor */
         XCB_CURRENT_TIME);
 
-    if ((reply = xcb_grab_pointer_reply(conn, cookie, NULL)) == NULL) {
-        ELOG("Could not grab pointer\n");
+    if ((reply = xcb_grab_pointer_reply(conn, cookie, &error)) == NULL) {
+        ELOG("Could not grab pointer (error_code = %d)\n", error->error_code);
+        free(error);
         return DRAG_ABORT;
     }
 
@@ -711,8 +714,10 @@ drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_
             XCB_GRAB_MODE_ASYNC /* keyboard mode */
             );
 
-    if ((keyb_reply = xcb_grab_keyboard_reply(conn, keyb_cookie, NULL)) == NULL) {
-        ELOG("Could not grab keyboard\n");
+    if ((keyb_reply = xcb_grab_keyboard_reply(conn, keyb_cookie, &error)) == NULL) {
+        ELOG("Could not grab keyboard (error_code = %d)\n", error->error_code);
+        free(error);
+        xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
         return DRAG_ABORT;
     }