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 <co/connection.h>
22 : #include <eq/os.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 2 : X11Connection(Display* display)
39 2 : : _display(display)
40 : {
41 2 : _setState(STATE_CONNECTED);
42 1 : }
43 :
44 4 : virtual ~X11Connection() { _setState(STATE_CLOSED); }
45 2 : virtual Notifier getNotifier() const { return ConnectionNumber(_display); }
46 2 : const Display* getDisplay() const { return _display; }
47 : protected:
48 0 : virtual void readNB(void*, const uint64_t) { LBDONTCALL; }
49 0 : virtual int64_t readSync(void*, const uint64_t, const bool)
50 : {
51 0 : LBDONTCALL;
52 0 : return -1;
53 : }
54 0 : virtual int64_t write(const void*, const uint64_t)
55 : {
56 0 : LBDONTCALL;
57 0 : return -1;
58 : }
59 :
60 : private:
61 : Display* const _display;
62 : };
63 : }
64 : }
65 :
66 : #endif // EQ_X11_CONNECTION_H
|