Line data Source code
1 :
2 : /* Copyright (c) 2006-2012, Stefan Eilemann <eile@equalizergraphics.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQ_X11_CONNECTION_H
19 : #define EQ_X11_CONNECTION_H
20 :
21 : #include <eq/client/os.h>
22 : #include <co/connection.h>
23 :
24 : namespace eq
25 : {
26 : namespace glx
27 : {
28 : /**
29 : * @internal
30 : * An X11 Display connection wrapper.
31 : *
32 : * This class is used to monitor multiple X11 display connections for events
33 : * using a co::ConnectionSet.
34 : */
35 : class X11Connection : public co::Connection
36 : {
37 : public:
38 15 : X11Connection( Display* display )
39 15 : : _display( display ) { _setState( STATE_CONNECTED ); }
40 :
41 30 : virtual ~X11Connection() { _setState( STATE_CLOSED ); }
42 :
43 15 : virtual Notifier getNotifier() const
44 15 : { return ConnectionNumber( _display ); }
45 :
46 15 : const Display* getDisplay() const { return _display; }
47 :
48 : protected:
49 0 : virtual void readNB( void*, const uint64_t ) { LBDONTCALL; }
50 0 : virtual int64_t readSync( void*, const uint64_t, const bool )
51 0 : { LBDONTCALL; return -1; }
52 0 : virtual int64_t write( const void*, const uint64_t )
53 0 : { LBDONTCALL; return -1; }
54 :
55 : private:
56 : Display* const _display;
57 : };
58 : }
59 : }
60 :
61 : #endif // EQ_X11_CONNECTION_H
|