mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
fix XFlush wait for events flushing
This commit is contained in:
parent
600734c884
commit
3cb987ceb2
@ -22,7 +22,7 @@
|
|||||||
(XTestFakeKeyEvent(display, \
|
(XTestFakeKeyEvent(display, \
|
||||||
XKeysymToKeycode(display, key), \
|
XKeysymToKeycode(display, key), \
|
||||||
is_press, CurrentTime), \
|
is_press, CurrentTime), \
|
||||||
XFlush(display))
|
XSync(display, false))
|
||||||
#define X_KEY_EVENT_WAIT(display, key, is_press) \
|
#define X_KEY_EVENT_WAIT(display, key, is_press) \
|
||||||
(X_KEY_EVENT(display, key, is_press), \
|
(X_KEY_EVENT(display, key, is_press), \
|
||||||
microsleep(DEADBEEF_UNIFORM(0.0, 62.5)))
|
microsleep(DEADBEEF_UNIFORM(0.0, 62.5)))
|
||||||
|
@ -105,7 +105,7 @@ void moveMouse(MMPoint point){
|
|||||||
Display *display = XGetMainDisplay();
|
Display *display = XGetMainDisplay();
|
||||||
XWarpPointer(display, None, DefaultRootWindow(display),
|
XWarpPointer(display, None, DefaultRootWindow(display),
|
||||||
0, 0, 0, 0, point.x, point.y);
|
0, 0, 0, 0, point.x, point.y);
|
||||||
XFlush(display);
|
XSync(display, false);
|
||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
//Mouse motion is now done using SendInput with MOUSEINPUT. We use Absolute mouse positioning
|
//Mouse motion is now done using SendInput with MOUSEINPUT. We use Absolute mouse positioning
|
||||||
#define MOUSE_COORD_TO_ABS(coord, width_or_height) (((65536 * coord) / width_or_height) + (coord < 0 ? -1 : 1))
|
#define MOUSE_COORD_TO_ABS(coord, width_or_height) (((65536 * coord) / width_or_height) + (coord < 0 ? -1 : 1))
|
||||||
@ -183,7 +183,7 @@ void toggleMouse(bool down, MMMouseButton button){
|
|||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
Display *display = XGetMainDisplay();
|
Display *display = XGetMainDisplay();
|
||||||
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);
|
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);
|
||||||
XFlush(display);
|
XSync(display, false);
|
||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
mouse_event(MMMouseToMEventF(down, button), 0, 0, 0, 0);
|
mouse_event(MMMouseToMEventF(down, button), 0, 0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
@ -276,7 +276,7 @@ void scrollMouse(int scrollMagnitude, MMMouseWheelDirection scrollDirection){
|
|||||||
XTestFakeButtonEvent(display, dir, 0, CurrentTime);
|
XTestFakeButtonEvent(display, dir, 0, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFlush(display);
|
XSync(display, false);
|
||||||
|
|
||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ void scrollMouseXY(int x, int y){
|
|||||||
XTestFakeButtonEvent(display, ydir, 0, CurrentTime);
|
XTestFakeButtonEvent(display, ydir, 0, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFlush(display);
|
XSync(display, false);
|
||||||
|
|
||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user