mirror of
https://github.com/vale981/spectrwm
synced 2025-03-05 09:51:38 -05:00
convert XGrabCursor to XCB
This commit is contained in:
parent
7d1350c820
commit
d8971cd3d6
1 changed files with 16 additions and 7 deletions
23
spectrwm.c
23
spectrwm.c
|
@ -4276,6 +4276,7 @@ resize(struct ws_win *win, union arg *args)
|
|||
int dx, dy;
|
||||
Cursor cursor;
|
||||
unsigned int shape; /* cursor style */
|
||||
xcb_grab_pointer_reply_t *gpr;
|
||||
xcb_query_pointer_reply_t *xpr;
|
||||
|
||||
if (win == NULL)
|
||||
|
@ -4355,8 +4356,12 @@ resize(struct ws_win *win, union arg *args)
|
|||
|
||||
cursor = XCreateFontCursor(display, shape);
|
||||
|
||||
if (XGrabPointer(display, win->id, False, MOUSEMASK, GrabModeAsync,
|
||||
GrabModeAsync, None, cursor, CurrentTime) != GrabSuccess) {
|
||||
gpr = xcb_grab_pointer_reply(conn,
|
||||
xcb_grab_pointer(conn, False, win->id, MOUSEMASK,
|
||||
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE,
|
||||
cursor, XCB_CURRENT_TIME),
|
||||
NULL);
|
||||
if (!gpr) {
|
||||
XFreeCursor(display, cursor);
|
||||
free(xpr);
|
||||
return;
|
||||
|
@ -4463,7 +4468,7 @@ move(struct ws_win *win, union arg *args)
|
|||
Time time = 0;
|
||||
int move_step = 0;
|
||||
struct swm_region *r = NULL;
|
||||
|
||||
xcb_grab_pointer_reply_t *gpr;
|
||||
xcb_query_pointer_reply_t *qpr;
|
||||
|
||||
if (win == NULL)
|
||||
|
@ -4519,10 +4524,14 @@ move(struct ws_win *win, union arg *args)
|
|||
return;
|
||||
}
|
||||
|
||||
if (XGrabPointer(display, win->id, False, MOUSEMASK, GrabModeAsync,
|
||||
GrabModeAsync, None, XCreateFontCursor(display, XC_fleur),
|
||||
CurrentTime) != GrabSuccess)
|
||||
return;
|
||||
gpr = xcb_grab_pointer_reply(conn,
|
||||
xcb_grab_pointer(conn, False, win->id, MOUSEMASK,
|
||||
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
|
||||
XCB_WINDOW_NONE, XCreateFontCursor(display, XC_fleur),
|
||||
XCB_CURRENT_TIME),
|
||||
NULL);
|
||||
if (!gpr)
|
||||
return;
|
||||
|
||||
/* get cursor offset from window root */
|
||||
qpr = xcb_query_pointer_reply(conn, xcb_query_pointer(conn, win->id),
|
||||
|
|
Loading…
Add table
Reference in a new issue