diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/maingui/main.cpp | 2 | ||||
-rw-r--r-- | src/pwgui/main.cpp | 3 | ||||
-rw-r--r-- | src/x11workaround.cpp | 23 | ||||
-rw-r--r-- | src/x11workaround.h | 10 |
4 files changed, 38 insertions, 0 deletions
diff --git a/src/maingui/main.cpp b/src/maingui/main.cpp index 1e7c2b2..06a165b 100644 --- a/src/maingui/main.cpp +++ b/src/maingui/main.cpp @@ -5,6 +5,7 @@ #include "../backdrop.h" #include <fcntl.h> #include <sys/stat.h> +#include "../x11workaround.h" static Backdrop* showGrayBackground(); @@ -34,6 +35,7 @@ int main(int argc, char *argv[]) PrinterGui *w = new PrinterGui(argv, bgWin); bgWin->setMainWindow(w); w->show(); + wiggle(); } return a.exec(); } diff --git a/src/pwgui/main.cpp b/src/pwgui/main.cpp index 8a9833b..9f3bbef 100644 --- a/src/pwgui/main.cpp +++ b/src/pwgui/main.cpp @@ -20,6 +20,8 @@ #include <grp.h> #include <errno.h> +#include "../x11workaround.h" + #define NAMELEN 400 #define BUFLEN 9000 #define ENVLEN 20000 @@ -193,6 +195,7 @@ int main(int argc, char *argv[]) PwGui *w = new PwGui(pfd[1], creds); bg->setMainWindow(w); w->show(); + wiggle(); exit(a.exec()); return CUPS_BACKEND_CANCEL; } diff --git a/src/x11workaround.cpp b/src/x11workaround.cpp new file mode 100644 index 0000000..c093362 --- /dev/null +++ b/src/x11workaround.cpp @@ -0,0 +1,23 @@ +#include "x11workaround.h" + + +void movePointer(int x, int y) { + bool result; + int root_x, root_y, win_x, win_y; + unsigned int mask_return; + Display* dpy = XOpenDisplay(0); + 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); + if (result != true) { + fprintf(stderr, "No mouse found.\n"); + return; + } + XWarpPointer(dpy, None,root, 0, 0, 0, 0, root_x - x ,root_y - y); + XFlush(dpy); +} + +void wiggle() { + movePointer(5, 5); + movePointer(-5, -5); +} diff --git a/src/x11workaround.h b/src/x11workaround.h new file mode 100644 index 0000000..d0aef7d --- /dev/null +++ b/src/x11workaround.h @@ -0,0 +1,10 @@ +#ifndef X11_WORKAROUND_VMWARE +#define X11_WORKAROUND_VMWARE + +#include <stdio.h> +#include <X11/Xlib.h> + + +void movePointer(int x, int y); +void wiggle(); +#endif |