mirror of
https://github.com/vale981/spectrwm
synced 2025-03-05 18:01:37 -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;
|
int dx, dy;
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
unsigned int shape; /* cursor style */
|
unsigned int shape; /* cursor style */
|
||||||
|
xcb_grab_pointer_reply_t *gpr;
|
||||||
xcb_query_pointer_reply_t *xpr;
|
xcb_query_pointer_reply_t *xpr;
|
||||||
|
|
||||||
if (win == NULL)
|
if (win == NULL)
|
||||||
|
@ -4355,8 +4356,12 @@ resize(struct ws_win *win, union arg *args)
|
||||||
|
|
||||||
cursor = XCreateFontCursor(display, shape);
|
cursor = XCreateFontCursor(display, shape);
|
||||||
|
|
||||||
if (XGrabPointer(display, win->id, False, MOUSEMASK, GrabModeAsync,
|
gpr = xcb_grab_pointer_reply(conn,
|
||||||
GrabModeAsync, None, cursor, CurrentTime) != GrabSuccess) {
|
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);
|
XFreeCursor(display, cursor);
|
||||||
free(xpr);
|
free(xpr);
|
||||||
return;
|
return;
|
||||||
|
@ -4463,7 +4468,7 @@ move(struct ws_win *win, union arg *args)
|
||||||
Time time = 0;
|
Time time = 0;
|
||||||
int move_step = 0;
|
int move_step = 0;
|
||||||
struct swm_region *r = NULL;
|
struct swm_region *r = NULL;
|
||||||
|
xcb_grab_pointer_reply_t *gpr;
|
||||||
xcb_query_pointer_reply_t *qpr;
|
xcb_query_pointer_reply_t *qpr;
|
||||||
|
|
||||||
if (win == NULL)
|
if (win == NULL)
|
||||||
|
@ -4519,10 +4524,14 @@ move(struct ws_win *win, union arg *args)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XGrabPointer(display, win->id, False, MOUSEMASK, GrabModeAsync,
|
gpr = xcb_grab_pointer_reply(conn,
|
||||||
GrabModeAsync, None, XCreateFontCursor(display, XC_fleur),
|
xcb_grab_pointer(conn, False, win->id, MOUSEMASK,
|
||||||
CurrentTime) != GrabSuccess)
|
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
|
||||||
return;
|
XCB_WINDOW_NONE, XCreateFontCursor(display, XC_fleur),
|
||||||
|
XCB_CURRENT_TIME),
|
||||||
|
NULL);
|
||||||
|
if (!gpr)
|
||||||
|
return;
|
||||||
|
|
||||||
/* get cursor offset from window root */
|
/* get cursor offset from window root */
|
||||||
qpr = xcb_query_pointer_reply(conn, xcb_query_pointer(conn, win->id),
|
qpr = xcb_query_pointer_reply(conn, xcb_query_pointer(conn, win->id),
|
||||||
|
|
Loading…
Add table
Reference in a new issue