summaryrefslogtreecommitdiffstats
path: root/unix/tx/TXWindow.h
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-06-13 10:52:11 +0000
committerPierre Ossman <ossman@cendio.se>2014-06-25 14:45:52 +0200
commitdf0f2832b407e811060291d0ab8a3bbae1fcf0eb (patch)
treeaeae09e02599d53e4b722b5403d1d3dd692b2b45 /unix/tx/TXWindow.h
parent9545bc728d2ba7c350c1e98cf712e333a4985755 (diff)
downloadtigervnc-df0f2832b407e811060291d0ab8a3bbae1fcf0eb.tar.gz
tigervnc-df0f2832b407e811060291d0ab8a3bbae1fcf0eb.zip
Add a global event handler so that we can intercept custom events
that aren't for a specific window. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5184 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'unix/tx/TXWindow.h')
-rw-r--r--unix/tx/TXWindow.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/unix/tx/TXWindow.h b/unix/tx/TXWindow.h
index 45ee28fb..5a72c335 100644
--- a/unix/tx/TXWindow.h
+++ b/unix/tx/TXWindow.h
@@ -51,6 +51,14 @@ public:
virtual void handleEvent(TXWindow* w, XEvent* ev) = 0;
};
+// TXGlobalEventHandler is similar to TXEventHandler but will be called early and
+// for every X event. The handler should return true to indicate that the
+// event was swallowed and shouldn't be processed further.
+class TXGlobalEventHandler {
+public:
+ virtual bool handleGlobalEvent(XEvent* ev) = 0;
+};
+
class TXWindow {
public:
@@ -162,6 +170,11 @@ public:
// returns when there are no more events to process.
static void handleXEvents(Display* dpy);
+ // setGlobalEventHandler() sets the TXGlobalEventHandler to intercept all
+ // X events. It returns the previous events handler, so that handlers can
+ // chain themselves.
+ static TXGlobalEventHandler* setGlobalEventHandler(TXGlobalEventHandler* h);
+
// windowWithName() locates a window with a given name on a display.
static Window windowWithName(Display* dpy, Window top, const char* name);
@@ -204,6 +217,8 @@ private:
std::map<Atom,Time> selectionOwnTime;
std::map<Atom,bool> selectionOwner_;
bool toplevel_;
+
+ static TXGlobalEventHandler* globalEventHandler;
};
extern Atom wmProtocols, wmDeleteWindow, wmTakeFocus;