glXEventHandler.h

00001 
00002 /* Copyright (c) 2006-2009, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef EQ_GLXEVENTHANDLER_H
00019 #define EQ_GLXEVENTHANDLER_H
00020 
00021 #include <eq/client/eventHandler.h> // base class
00022 #include <eq/client/types.h>        // basic typedefs
00023 #include <eq/client/windowSystem.h> // XEvent type
00024 
00025 #include <eq/net/connectionSet.h>
00026 
00027 namespace eq
00028 {
00029     class GLXPipe;
00030     class Window;
00031     class GLXWindowEvent;
00032 
00036     class GLXEventHandler : public EventHandler
00037     {
00038     public:
00039         class EventSet : public net::ConnectionSet, public base::Referenced
00040         {
00041         public:
00042             void notifyPerThreadDelete() { unref(); }
00043 
00044         protected:
00045             virtual ~EventSet(){}
00046         };
00047 
00049         static void dispatchOne();
00050 
00052         static void dispatchAll();
00053 
00055         static base::RefPtr< EventSet > getEventSet();
00056 
00058         static void clearEventSet();
00059 
00061         GLXEventHandler( GLXPipe* pipe );
00062 
00064         virtual ~GLXEventHandler();
00065 
00066     private:
00068         GLXPipe* const _pipe;
00069 
00070         static void _handleEvents( X11ConnectionPtr connection );
00071 
00073         static bool _dispatch( const int timeout );
00074 
00075         void _processEvent( GLXWindowEvent& event, Pipe* pipe );
00076         uint32_t  _getButtonState( XEvent& event );
00077         uint32_t  _getButtonAction( XEvent& event );
00078         uint32_t  _getKey( XEvent& event );
00079     };
00080 
00082     typedef base::RefPtr< GLXEventHandler::EventSet > GLXEventSetPtr; 
00084 }
00085 
00086 #endif // EQ_GLXEVENTHANDLER_H
00087 
Generated on Mon Aug 10 18:58:39 2009 for Equalizer 0.9 by  doxygen 1.5.8