diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-04-10 12:37:45 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-04-10 12:40:19 +0200 |
commit | 34d96928632b79196cc3d46aa2abd7c1f1122593 (patch) | |
tree | 2810f052c0ca6f0d8331a6881804e4beceb75b19 /vncviewer | |
parent | c987d61e8330063d9ae90d6e4b7c6d7e05109456 (diff) | |
download | tigervnc-34d96928632b79196cc3d46aa2abd7c1f1122593.tar.gz tigervnc-34d96928632b79196cc3d46aa2abd7c1f1122593.zip |
Use XQueryPointer() instead to detect zaphod
FLTK can send events with fl_xevent pointing to random memory, which
means that we cannot trust that structure. XQueryPointer() can give us
what we need, at the cost of an extra round trip.
Diffstat (limited to 'vncviewer')
-rw-r--r-- | vncviewer/DesktopWindow.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index b85485b2..7d7ae7c3 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -850,11 +850,15 @@ int DesktopWindow::handle(int event) (Fl::event_y() < 0) || (Fl::event_y() >= h())) { ungrabPointer(); } - // We also don't get sensible coordinates on zaphod setups #if !defined(WIN32) && !defined(__APPLE__) - if ((fl_xevent != NULL) && (fl_xevent->type == MotionNotify) && - (((XMotionEvent*)fl_xevent)->root != - XRootWindow(fl_display, fl_screen))) { + Window root, child; + int x, y, wx, wy; + unsigned int mask; + + // We also don't get sensible coordinates on zaphod setups + if (XQueryPointer(fl_display, fl_xid(this), &root, &child, + &x, &y, &wx, &wy, &mask) && + (root != XRootWindow(fl_display, fl_screen))) { ungrabPointer(); } #endif |