diff options
author | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2011-12-05 13:38:25 +0100 |
---|---|---|
committer | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2011-12-05 13:47:21 +0100 |
commit | 8930de803ce9e70aa56ca6e9b714f933fc62575c (patch) | |
tree | 67716659b4da334adafd91ce97e4f1eb97ff8ab2 /LayerManagerPlugins | |
parent | d91c927ad7049a5b5ae50cd2c1ff1c74d57458c3 (diff) | |
download | layer_management-8930de803ce9e70aa56ca6e9b714f933fc62575c.tar.gz |
removed compiler flags -DUSE_XTHREADS and -DENABLE_INPUT_EVENTS. these #defines are contained in config.h now.
Diffstat (limited to 'LayerManagerPlugins')
-rw-r--r-- | LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h | 4 | ||||
-rw-r--r-- | LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp | 39 |
2 files changed, 24 insertions, 19 deletions
diff --git a/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h b/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h index 1c64347..1f17b9f 100644 --- a/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h +++ b/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h @@ -27,6 +27,8 @@ #include <X11/Xutil.h> #include "Log.h" #include "ScreenShotType.h" +#include "config.h" + typedef XVisualInfo* (*GetVisualInfoFunction)(Display *dpy); @@ -119,7 +121,7 @@ private: static int error(Display *dpy, XErrorEvent *ev); bool redrawEvent; static bool m_xerror; - #ifdef ENABLE_INPUT_EVENTS + #ifdef WITH_INPUT_EVENTS void ManageXInputEvent(XEvent *pevent); #endif diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp index 9df214f..d27cce2 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp @@ -444,7 +444,7 @@ bool X11WindowSystem::CreateCompositorWindow() XSetWindowAttributes attr; // draw a black background the full size of the resolution attr.override_redirect = True; -#ifdef ENABLE_INPUT_EVENTS +#ifdef WITH_INPUT_EVENTS attr.event_mask = ExposureMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask; #else attr.event_mask = ExposureMask | StructureNotifyMask; @@ -728,11 +728,12 @@ init_complete: this->graphicSystem->clearBackground(); this->graphicSystem->swapBuffers(); XFlush(this->x11Display); + while (this->m_running) { -#ifndef USE_XTHREADS +#ifndef WITH_XTHREADS if ( XPending(this->x11Display) > 0) { -#endif //USE_XTHREADS +#endif //WITH_XTHREADS XEvent event; // blocking wait for event XNextEvent(this->x11Display, &event); @@ -783,9 +784,10 @@ init_complete: // else // renderer->DestroyWindow(event.xreparent.window); break; -#ifdef ENABLE_INPUT_EVENTS +#ifdef WITH_INPUT_EVENTS case ButtonPress: case ButtonRelease: + case MotionNotify: ManageXInputEvent(&event); break; @@ -806,9 +808,10 @@ init_complete: break; } this->m_pScene->unlockScene(); -#ifndef USE_XTHREADS + +#ifndef WITH_XTHREADS } -#endif //USE_XTHREADS +#endif //WITH_XTHREADS if (this->redrawEvent) { this->redrawEvent = false; @@ -831,7 +834,7 @@ init_complete: this->Redraw(); checkRedraw = false; } -#ifndef USE_XTHREADS +#ifndef WITH_XTHREADS else { /* put thread in sleep mode for 500 useconds due to safe cpu performance */ @@ -845,7 +848,7 @@ init_complete: } -#ifdef ENABLE_INPUT_EVENTS +#ifdef WITH_INPUT_EVENTS void X11WindowSystem::ManageXInputEvent(XEvent *pevent) { Surface * surf; @@ -870,22 +873,22 @@ void X11WindowSystem::ManageXInputEvent(XEvent *pevent) surf = m_pScene->getSurfaceAt((unsigned int *) pX, (unsigned int *) pY, 0.1); if (surf != NULL) { - pevent->xany.window = surf->nativeHandle; - XSendEvent(x11Display, surf->nativeHandle, false, 0, pevent); + pevent->xany.window = surf->getNativeContent(); + XSendEvent(x11Display, pevent->xany.window, false, 0, pevent); } } #endif -#ifdef USE_XTHREADS +#ifdef WITH_XTHREADS static Display* displaySignal = NULL; -#endif //USE_XTHREADS +#endif //WITH_XTHREADS void X11WindowSystem::signalRedrawEvent() { // set flag that redraw is needed redrawEvent = true; m_damaged = true; -#ifdef USE_XTHREADS +#ifdef WITH_XTHREADS // send dummy expose event, to wake up blocking x11 event loop (XNextEvent) LOG_DEBUG("X11WindowSystem", "Sending dummy event to wake up renderer thread"); if (NULL == displaySignal ) @@ -898,7 +901,7 @@ void X11WindowSystem::signalRedrawEvent() XUnlockDisplay(displaySignal); XFlush(displaySignal); LOG_DEBUG("X11WindowSystem", "Event successfully sent to renderer"); -#endif //USE_XTHREADS +#endif //WITH_XTHREADS } void X11WindowSystem::cleanup(){ @@ -915,21 +918,21 @@ void X11WindowSystem::cleanup(){ XFree(windowVis); } -#ifdef USE_XTHREADS +#ifdef WITH_XTHREADS if ( NULL != displaySignal ) { XCloseDisplay(displaySignal); } -#endif //USE_XTHREADS +#endif //WITH_XTHREADS XCloseDisplay(x11Display); m_running = false; } bool X11WindowSystem::init(BaseGraphicSystem<Display*,Window>* base) { -#ifdef USE_XTHREADS +#ifdef WITH_XTHREADS XInitThreads(); -#endif //USE_XTHREADS +#endif //WITH_XTHREADS X11WindowSystem *renderer = this; graphicSystem = base; int status = pthread_create( &renderThread, NULL, X11eventLoopCallback, (void*) renderer); |