From 2f56f169248535dc45f71509fdc04a01dd4ea8cc Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 12 Oct 2009 19:48:43 +0000 Subject: [PATCH] - added code for Linux mouse check svn path=/trunk/boinc/; revision=19290 --- checkin_notes | 6 +++++ lib/x_util.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 lib/x_util.cpp diff --git a/checkin_notes b/checkin_notes index bc8d8d4e25..8f7540556d 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8560,3 +8560,9 @@ David 12 Oct 2009 client/ gui_rpc_server_ops.cpp + +David 12 Oct 2009 + - added code for Linux mouse check + + lib/ + x_util.cpp diff --git a/lib/x_util.cpp b/lib/x_util.cpp new file mode 100644 index 0000000000..447de1d131 --- /dev/null +++ b/lib/x_util.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +Display *d; + +// listen for mouse motion in all windows under the given one +// +void listen_for_mouse(Display* display, Window window) { + Window parent, *children; + unsigned int nchildren; + int retval; + + retval = XQueryTree(d, window, &window, &parent, &children, &nchildren); + if (retval == FALSE) { + fprintf(stderr, "XQueryTree() failed: %d\n", retval); + return; + } + + if (nchildren == 0) return; + XSelectInput(display, window, PointerMotionMask); + for (int i=0; i