diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-02-19 00:58:59 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-02-19 00:58:59 +0000 |
| commit | d647de97bec82fa6c229a4801908b847f631f031 (patch) | |
| tree | 5369ed520bc4836dafa245844b67946673eb1401 /otk | |
| parent | d8429b31b450c41973947eeec1f27af3b2807409 (diff) | |
add the new '-remote' option. let the dispatchEvents loop work in 'local' or 'remote' mode.
Diffstat (limited to 'otk')
| -rw-r--r-- | otk/eventdispatcher.cc | 25 | ||||
| -rw-r--r-- | otk/eventdispatcher.hh | 12 |
2 files changed, 34 insertions, 3 deletions
diff --git a/otk/eventdispatcher.cc b/otk/eventdispatcher.cc index 0560eec8..1b90dbc0 100644 --- a/otk/eventdispatcher.cc +++ b/otk/eventdispatcher.cc @@ -34,11 +34,32 @@ void EventDispatcher::clearHandler(Window id) _map.erase(id); } -void EventDispatcher::dispatchEvents(void) +void EventDispatcher::dispatchEvents(bool remote) { XEvent e; - while (XPending(**display)) { + while (true) { + /* + There are slightly different event retrieval semantics here for local (or + high bandwidth) versus remote (or low bandwidth) connections to the + display/Xserver. + */ + if (remote) { + if (!XPending(**display)) + return; + } else { + /* + This XSync allows for far more compression of events, which makes + things like Motion events perform far far better. Since it also means + network traffic for every event instead of every X events (where X is + the number retrieved at a time), it probably should not be used for + setups where Openbox is running on a remote/low bandwidth + display/Xserver. + */ + XSync(**display, false); + if (!XEventsQueued(**display, QueuedAlready)) + return; + } XNextEvent(**display, &e); #if 0//defined(DEBUG) diff --git a/otk/eventdispatcher.hh b/otk/eventdispatcher.hh index 03f36299..35c3722e 100644 --- a/otk/eventdispatcher.hh +++ b/otk/eventdispatcher.hh @@ -19,7 +19,17 @@ public: virtual void clearAllHandlers(void); virtual void registerHandler(Window id, EventHandler *handler); virtual void clearHandler(Window id); - virtual void dispatchEvents(void); + //! Dispatch events from the X server to the appropriate EventHandlers + /*! + @param remote Is the Xserver on a remote (low bandwidth) connection or on a + local (high bandwidth) connection. This allows you to specify + 'false' in which case slightly different semantics are used + for event retrieval.<br> + The default is 'true' since this should generally be used, + only the Openbox window manager should need to specify + 'false' here. + */ + virtual void dispatchEvents(bool remote = true); inline void setFallbackHandler(EventHandler *fallback) { _fallback = fallback; } |
