Add more structure constructor tests.
[piglit/hramrach.git] / tests / glean / winsys.h
blob595fb64f076d36a2740d0a5ffc9d23b05fa3700f
1 // BEGIN_COPYRIGHT -*- glean -*-
2 //
3 // Copyright (C) 1999 Allen Akin All Rights Reserved.
4 //
5 // Permission is hereby granted, free of charge, to any person
6 // obtaining a copy of this software and associated documentation
7 // files (the "Software"), to deal in the Software without
8 // restriction, including without limitation the rights to use,
9 // copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following
12 // conditions:
13 //
14 // The above copyright notice and this permission notice shall be
15 // included in all copies or substantial portions of the
16 // Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 // KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ALLEN AKIN BE
22 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 // DEALINGS IN THE SOFTWARE.
26 //
27 // END_COPYRIGHT
32 // winsys.h: facade for common window-system operations
34 // This class and related classes provide window system operations
35 // that are sufficient to support most basic rendering tests. These
36 // operations include initializing the window system, creating and
37 // destroying windows and rendering contexts, selecting pixel
38 // configurations, etc.
40 // Tests using this set of classes for all window system services are
41 // ``portable'' in a useful sense. Not all tests are portable,
42 // however; in particular, tests of window-system-specific
43 // functionality must execute window system commands directly. Such
44 // tests may require access to class members that would ideally be
45 // private; for example, the X11 Display pointer. Thus most members
46 // of this class are public.
50 #ifndef __winsys_h__
51 #define __winsys_h__
53 using namespace std;
55 #include <string>
56 #include <vector>
57 #include "glwrap.h"
59 namespace GLEAN {
61 class DrawingSurface; // Forward and mutually-recursive references.
62 class Window;
63 class DrawingSurfaceConfig;
64 class RenderingContext;
65 class Options;
67 class WindowSystem {
68 public:
69 // Constructors/Destructor:
71 WindowSystem(Options& o);
72 ~WindowSystem();
74 // Exceptions:
76 struct Error { }; // Base class for window system errors.
77 struct CantOpenDisplay: public Error { // Can't initialize display.
79 struct NoOpenGL: public Error { // Missing GLX, WGL, etc.
82 // Utilities:
84 bool makeCurrent(); // Remove context/surface binding.
85 bool makeCurrent(RenderingContext& r, Window& w);
86 // Bind given context and surface.
87 void quiesce(); // Wait for system to go idle.
89 // State information:
91 vector<DrawingSurfaceConfig*> surfConfigs;
92 // All available drawing surface configurations.
93 vector<DrawingSurface*> surfaces;
94 // All currently-active surfaces.
95 vector<RenderingContext*> contexts;
96 // All currently-active rendering contexts.
98 # if defined(__X11__)
99 Display* dpy; // Pointer to X11 Display structure.
101 int GLXVersMajor; // GLX major version number.
102 int GLXVersMinor; // GLX minor version number.
104 XVisualInfo* vip; // Array of raw XVisualInfo structures.
106 # elif defined(__WIN__)
108 # elif defined(__BEWIN__)
109 BApplication *theApp;
111 # endif
113 }; // class WindowSystem
115 } // namespace GLEAN
117 #endif // __winsys_h__