XCURSOR_CURSOR_POINTER = 0,
XCURSOR_CURSOR_RESIZE_HORIZONTAL,
XCURSOR_CURSOR_RESIZE_VERTICAL,
+ XCURSOR_CURSOR_TOP_LEFT_CORNER,
+ XCURSOR_CURSOR_TOP_RIGHT_CORNER,
+ XCURSOR_CURSOR_BOTTOM_LEFT_CORNER,
+ XCURSOR_CURSOR_BOTTOM_RIGHT_CORNER,
XCURSOR_CURSOR_WATCH,
+ XCURSOR_CURSOR_MOVE,
XCURSOR_CURSOR_MAX
};
tree_render();
/* Drag the window */
- drag_pointer(con, event, XCB_NONE, BORDER_TOP /* irrelevant */, drag_window_callback, event);
+ drag_pointer(con, event, XCB_NONE, BORDER_TOP /* irrelevant */, XCURSOR_CURSOR_MOVE, drag_window_callback, event);
tree_render();
}
corner |= BORDER_LEFT;
else corner |= BORDER_RIGHT;
- if (event->event_y <= (con->rect.height / 2))
+ int cursor = 0;
+ if (event->event_y <= (con->rect.height / 2)) {
corner |= BORDER_TOP;
- else corner |= BORDER_BOTTOM;
+ cursor = (corner & BORDER_LEFT) ?
+ XCURSOR_CURSOR_TOP_LEFT_CORNER : XCURSOR_CURSOR_TOP_RIGHT_CORNER;
+ }
+ else {
+ corner |= BORDER_BOTTOM;
+ cursor = (corner & BORDER_LEFT) ?
+ XCURSOR_CURSOR_BOTTOM_LEFT_CORNER : XCURSOR_CURSOR_BOTTOM_RIGHT_CORNER;
+ }
struct resize_window_callback_params params = { corner, proportional, event };
- drag_pointer(con, event, XCB_NONE, BORDER_TOP /* irrelevant */, resize_window_callback, ¶ms);
+ drag_pointer(con, event, XCB_NONE, BORDER_TOP /* irrelevant */, cursor, resize_window_callback, ¶ms);
}
/*
*
*/
void drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_window_t
- confine_to, border_t border, callback_t callback, const void *extra)
+ confine_to, border_t border, int cursor, callback_t callback, const void *extra)
{
uint32_t new_x, new_y;
Rect old_rect = { 0, 0, 0, 0 };
if (con != NULL)
memcpy(&old_rect, &(con->rect), sizeof(Rect));
+ Cursor xcursor = (cursor && xcursor_supported) ?
+ xcursor_get_cursor(cursor) : XCB_NONE;
+
/* Grab the pointer */
xcb_grab_pointer_cookie_t cookie;
xcb_grab_pointer_reply_t *reply;
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 */
+ xcursor, /* possibly display a special cursor */
XCB_CURRENT_TIME);
if ((reply = xcb_grab_pointer_reply(conn, cookie, NULL)) == NULL) {
const struct callback_params params = { orientation, output, helpwin, &new_position };
- drag_pointer(NULL, event, grabwin, BORDER_TOP, resize_callback, ¶ms);
+ drag_pointer(NULL, event, grabwin, BORDER_TOP, 0, resize_callback, ¶ms);
xcb_destroy_window(conn, helpwin);
xcb_destroy_window(conn, grabwin);
}
void xcursor_load_cursors(void) {
- cursors[XCURSOR_CURSOR_POINTER] = load_cursor("left_ptr");
- cursors[XCURSOR_CURSOR_RESIZE_HORIZONTAL] = load_cursor("sb_h_double_arrow");
- cursors[XCURSOR_CURSOR_RESIZE_VERTICAL] = load_cursor("sb_v_double_arrow");
- cursors[XCURSOR_CURSOR_WATCH] = load_cursor("watch");
+ cursors[XCURSOR_CURSOR_POINTER] = load_cursor("left_ptr");
+ cursors[XCURSOR_CURSOR_RESIZE_HORIZONTAL] = load_cursor("sb_h_double_arrow");
+ cursors[XCURSOR_CURSOR_RESIZE_VERTICAL] = load_cursor("sb_v_double_arrow");
+ cursors[XCURSOR_CURSOR_WATCH] = load_cursor("watch");
+ cursors[XCURSOR_CURSOR_MOVE] = load_cursor("fleur");
+ cursors[XCURSOR_CURSOR_TOP_LEFT_CORNER] = load_cursor("top_left_corner");
+ cursors[XCURSOR_CURSOR_TOP_RIGHT_CORNER] = load_cursor("top_right_corner");
+ cursors[XCURSOR_CURSOR_BOTTOM_LEFT_CORNER] = load_cursor("bottom_left_corner");
+ cursors[XCURSOR_CURSOR_BOTTOM_RIGHT_CORNER] = load_cursor("bottom_right_corner");
}
/*