summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/x11workaround.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/x11workaround.cpp b/src/x11workaround.cpp
index c093362..3554963 100644
--- a/src/x11workaround.cpp
+++ b/src/x11workaround.cpp
@@ -6,6 +6,8 @@ void movePointer(int x, int y) {
int root_x, root_y, win_x, win_y;
unsigned int mask_return;
Display* dpy = XOpenDisplay(0);
+ if (dpy == nullptr)
+ return;
Window root = DefaultRootWindow(dpy);
Window window_returned;
result = XQueryPointer(dpy, root, &window_returned, &window_returned, &root_x, &root_y, &win_x, &win_y, &mask_return);
@@ -15,6 +17,7 @@ void movePointer(int x, int y) {
}
XWarpPointer(dpy, None,root, 0, 0, 0, 0, root_x - x ,root_y - y);
XFlush(dpy);
+ XCloseDisplay(dpy);
}
void wiggle() {