diff --git a/src/lib/platform/IXWindowsImpl.h b/src/lib/platform/IXWindowsImpl.h index 7b19bce3..ddcaf2f5 100644 --- a/src/lib/platform/IXWindowsImpl.h +++ b/src/lib/platform/IXWindowsImpl.h @@ -230,4 +230,5 @@ public: int level, int eGroup) = 0; virtual unsigned char do_XkbKeyGroupInfo(XkbDescPtr m_xkb, KeyCode keycode) = 0; + virtual int XNextEvent(Display* display, XEvent* event_return) = 0; }; diff --git a/src/lib/platform/XWindowsEventQueueBuffer.cpp b/src/lib/platform/XWindowsEventQueueBuffer.cpp index 234cd621..78f0e5af 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/XWindowsEventQueueBuffer.cpp @@ -52,17 +52,18 @@ class EventQueueTimer { }; // XWindowsEventQueueBuffer // -XWindowsEventQueueBuffer::XWindowsEventQueueBuffer( +XWindowsEventQueueBuffer::XWindowsEventQueueBuffer(IXWindowsImpl* impl, Display* display, Window window, IEventQueue* events) : m_events(events), m_display(display), m_window(window), m_waiting(false) { + m_impl = impl; assert(m_display != NULL); assert(m_window != None); - m_userEvent = XInternAtom(m_display, "BARRIER_USER_EVENT", False); + m_userEvent = m_impl->XInternAtom(m_display, "BARRIER_USER_EVENT", False); // set up for pipe hack int result = pipe(m_pipefd); assert(result == 0); @@ -206,7 +207,7 @@ XWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID) flush(); // get next event - XNextEvent(m_display, &m_event); + m_impl->XNextEvent(m_display, &m_event); // process event if (m_event.xany.type == ClientMessage && @@ -262,7 +263,7 @@ bool XWindowsEventQueueBuffer::isEmpty() const { Lock lock(&m_mutex); - return (XPending(m_display) == 0 ); + return (m_impl->XPending(m_display) == 0 ); } EventQueueTimer* @@ -284,8 +285,8 @@ XWindowsEventQueueBuffer::flush() // flush the posted event list to the X server for (size_t i = 0; i < m_postedEvents.size(); ++i) { - XSendEvent(m_display, m_window, False, 0, &m_postedEvents[i]); + m_impl->XSendEvent(m_display, m_window, False, 0, &m_postedEvents[i]); } - XFlush(m_display); + m_impl->XFlush(m_display); m_postedEvents.clear(); } diff --git a/src/lib/platform/XWindowsEventQueueBuffer.h b/src/lib/platform/XWindowsEventQueueBuffer.h index 07f3b3ab..e49b282b 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.h +++ b/src/lib/platform/XWindowsEventQueueBuffer.h @@ -21,6 +21,7 @@ #include "mt/Mutex.h" #include "base/IEventQueueBuffer.h" #include "common/stdvector.h" +#include "XWindowsImpl.h" #if X_DISPLAY_MISSING # error X11 is required to build barrier @@ -33,7 +34,8 @@ class IEventQueue; //! Event queue buffer for X11 class XWindowsEventQueueBuffer : public IEventQueueBuffer { public: - XWindowsEventQueueBuffer(Display*, Window, IEventQueue* events); + XWindowsEventQueueBuffer(IXWindowsImpl* impl, Display*, Window, + IEventQueue* events); virtual ~XWindowsEventQueueBuffer(); // IEventQueueBuffer overrides @@ -51,6 +53,7 @@ private: private: typedef std::vector EventList; + IXWindowsImpl* m_impl; Mutex m_mutex; Display* m_display; diff --git a/src/lib/platform/XWindowsImpl.cpp b/src/lib/platform/XWindowsImpl.cpp index ce6212af..0fbe34c2 100644 --- a/src/lib/platform/XWindowsImpl.cpp +++ b/src/lib/platform/XWindowsImpl.cpp @@ -639,3 +639,8 @@ unsigned char XWindowsImpl::do_XkbKeyGroupInfo(XkbDescPtr m_xkb, { return do_XkbKeyGroupInfo(m_xkb, keycode); } + +int XWindowsImpl::XNextEvent(Display* display, XEvent* event_return) +{ + return ::XNextEvent(display, event_return); +} diff --git a/src/lib/platform/XWindowsImpl.h b/src/lib/platform/XWindowsImpl.h index e3d14bd8..ae45aea2 100644 --- a/src/lib/platform/XWindowsImpl.h +++ b/src/lib/platform/XWindowsImpl.h @@ -192,4 +192,5 @@ public: int level, int eGroup); virtual unsigned char do_XkbKeyGroupInfo(XkbDescPtr m_xkb, KeyCode keycode); + virtual int XNextEvent(Display* display, XEvent* event_return); }; diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index e1dee240..5f6c6235 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -160,7 +160,7 @@ XWindowsScreen::XWindowsScreen( &XWindowsScreen::handleSystemEvent)); // install the platform event queue - m_events->adoptBuffer(new XWindowsEventQueueBuffer( + m_events->adoptBuffer(new XWindowsEventQueueBuffer(m_impl, m_display, m_window, m_events)); }