devdraw: work around XWayland pointer warping
This commit is contained in:
@@ -1342,10 +1342,33 @@ _xtoplan9mouse(Xwin *w, XEvent *e, Mouse *m)
|
|||||||
void
|
void
|
||||||
rpc_setmouse(Client *client, Point p)
|
rpc_setmouse(Client *client, Point p)
|
||||||
{
|
{
|
||||||
|
static XCursor empty_cursor;
|
||||||
Xwin *w = (Xwin*)client->view;
|
Xwin *w = (Xwin*)client->view;
|
||||||
|
|
||||||
xlock();
|
xlock();
|
||||||
|
// XWayland hack - hide cursor before warping
|
||||||
|
// see https://github.com/libsdl-org/SDL/issues/9539
|
||||||
|
if(!empty_cursor){
|
||||||
|
Pixmap bm;
|
||||||
|
XColor black;
|
||||||
|
char bmd[] = { 0 };
|
||||||
|
bm = XCreateBitmapFromData(_x.display, w->drawable, bmd, 1, 1);
|
||||||
|
if(bm){
|
||||||
|
empty_cursor = XCreatePixmapCursor(_x.display, bm, bm, &black, &black, 0, 0);
|
||||||
|
XFreePixmap(_x.display, bm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty_cursor){
|
||||||
|
XDefineCursor(_x.display, w->drawable, empty_cursor);
|
||||||
|
XFlush(_x.display);
|
||||||
|
}
|
||||||
|
|
||||||
XWarpPointer(_x.display, None, w->drawable, 0, 0, 0, 0, p.x, p.y);
|
XWarpPointer(_x.display, None, w->drawable, 0, 0, 0, 0, p.x, p.y);
|
||||||
|
|
||||||
|
if(empty_cursor)
|
||||||
|
XDefineCursor(_x.display, w->drawable, _x.cursor);
|
||||||
|
|
||||||
XFlush(_x.display);
|
XFlush(_x.display);
|
||||||
xunlock();
|
xunlock();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user