Equalizer  2.1.0
Parallel Rendering Framework
glx/window.h
1 
2 /* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
3  * Daniel Nachbaur <danielnachbaur@gmail.com>
4  * Maxim Makhinya
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef EQ_GLX_WINDOW_H
21 #define EQ_GLX_WINDOW_H
22 
23 #include <eq/glWindow.h> // base class
24 #include <eq/glx/types.h>
25 
26 namespace eq
27 {
28 namespace glx
29 {
30 namespace detail
31 {
32 class Window;
33 }
34 
36 class WindowIF : public GLWindow
37 {
38 public:
39  WindowIF(NotifierInterface& parent, const WindowSettings& settings)
40  : GLWindow(parent, settings)
41  {
42  }
43  virtual ~WindowIF() {}
45  virtual GLXContext getGLXContext() const = 0;
46 
48  virtual XID getXDrawable() const = 0;
49 
51  virtual Display* getXDisplay() = 0;
52 
54  virtual bool processEvent(EventType type, const XEvent&, SizeEvent& event)
55  {
56  return GLWindow::processEvent(type, event);
57  }
58 
60  virtual bool processEvent(EventType type, const XEvent&,
61  PointerEvent& event)
62  {
63  return GLWindow::processEvent(type, event);
64  }
65 
67  virtual bool processEvent(EventType type, const XEvent&, KeyEvent& event)
68  {
69  return GLWindow::processEvent(type, event);
70  }
71 
73  virtual bool processEvent(const XEvent&, AxisEvent& event)
74  {
75  return GLWindow::processEvent(event);
76  }
77 
79  virtual bool processEvent(const XEvent&, ButtonEvent& event)
80  {
81  return GLWindow::processEvent(event);
82  }
83 
85  virtual bool processEvent(EventType type, const XEvent&)
86  {
87  if (type == EVENT_UNKNOWN)
88  return false;
89  return GLWindow::processEvent(type);
90  }
91 };
92 
94 class Window : public WindowIF
95 {
96 public:
101  Window(NotifierInterface& parent, const WindowSettings& settings,
102  Display* xDisplay, const GLXEWContext* glxewContext,
103  MessagePump* messagePump);
104 
106  virtual ~Window();
107 
120  bool configInit() override;
121 
123  void configExit() override;
124 
133  virtual GLXFBConfig* chooseGLXFBConfig();
134 
144  virtual GLXContext createGLXContext(GLXFBConfig* fbConfig);
145 
155  virtual bool configInitGLXDrawable(GLXFBConfig* fbConfig);
156 
166  virtual bool configInitGLXWindow(GLXFBConfig* fbConfig);
167 
172  virtual void initEventHandler();
173 
178  virtual void exitEventHandler();
180 
184  GLXContext getGLXContext() const override;
185 
187  XID getXDrawable() const override;
188 
190  Display* getXDisplay() override;
191 
193  const GLXEWContext* glxewGetContext() const;
194 
204  virtual void setXDrawable(XID drawable);
205 
216  virtual void setGLXContext(GLXContext context);
218 
222  void makeCurrent(const bool cache = true) const override;
223 
225  void doneCurrent() const override;
226 
228  void swapBuffers() override;
229 
231  void joinNVSwapBarrier(const uint32_t group,
232  const uint32_t barrier) override;
233 
235  void leaveNVSwapBarrier();
236 
237  bool processEvent(EventType type, const XEvent& xEvent,
238  PointerEvent& event) override;
240 
241 private:
242  detail::Window* const _impl;
243 
245  XID _createGLXWindow(GLXFBConfig* fbConfig, const PixelViewport& pvp);
246 
248  void _initSwapSync();
249 
250  void _resize(const PixelViewport& pvp) override;
251 };
252 }
253 }
254 #endif // EQ_GLX_WINDOW_H
Equalizer default implementation of a glX window.
Definition: glx/window.h:94
A message pump receiving and dispatching X11 events.
virtual bool processEvent(EventType type, const XEvent &, KeyEvent &event)
Process a keyboard event.
Definition: glx/window.h:67
virtual bool processEvent(EventType type, const XEvent &)
Process a stateless event.
Definition: glx/window.h:85
A set of settings to setup an eq::SystemWindow.
virtual bool processEvent(const XEvent &, AxisEvent &event)
Process an axis event.
Definition: glx/window.h:73
virtual bool processEvent(EventType type, const XEvent &, SizeEvent &event)
Process a (re)size event.
Definition: glx/window.h:54
A system window for OpenGL rendering.
Definition: glWindow.h:39
A base class for notifying errors and events.
EQ_API bool processEvent(EventType type)
Process a stateless event.
The Equalizer client library.
Definition: eq/agl/types.h:23
virtual bool processEvent(EventType type, const XEvent &, PointerEvent &event)
Process a mouse event.
Definition: glx/window.h:60
The interface defining the minimum functionality for a glX window.
Definition: glx/window.h:36
virtual bool processEvent(const XEvent &, ButtonEvent &event)
Process a button event.
Definition: glx/window.h:79