3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief X11 utilities.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "gluRenderConfig.hpp"
28 #include "gluPlatform.hpp"
29 #include "deMutex.hpp"
32 #include <X11/Xutil.h>
33 #include <X11/keysym.h>
34 #include <X11/Xatom.h>
42 DEFAULT_WINDOW_WIDTH = 400,
43 DEFAULT_WINDOW_HEIGHT = 300
50 virtual ~EventState (void);
51 void setQuitFlag (bool quit);
52 bool getQuitFlag (void);
59 EventState (const EventState&);
60 EventState& operator= (const EventState&);
66 DisplayBase (EventState& platform);
67 virtual ~DisplayBase (void);
68 virtual void processEvents (void) = 0;
71 EventState& m_eventState;
74 DisplayBase (const DisplayBase&);
75 DisplayBase& operator= (const DisplayBase&);
82 virtual ~WindowBase (void);
84 virtual void setVisibility (bool visible) = 0;
86 virtual void processEvents (void) = 0;
87 virtual DisplayBase& getDisplay (void) = 0;
89 virtual void getDimensions (int* width, int* height) const = 0;
90 virtual void setDimensions (int width, int height) = 0;
96 WindowBase (const WindowBase&);
97 WindowBase& operator= (const WindowBase&);
100 class XlibDisplay : public DisplayBase
103 XlibDisplay (EventState& platform, const char* name);
104 virtual ~XlibDisplay (void);
106 ::Display* getXDisplay (void) { return m_display; }
107 Atom getDeleteAtom (void) { return m_deleteAtom; }
109 ::Visual* getVisual (VisualID visualID);
110 bool getVisualInfo (VisualID visualID, XVisualInfo& dst);
111 void processEvents (void);
112 void processEvent (XEvent& event);
115 ::Display* m_display;
119 XlibDisplay (const XlibDisplay&);
120 XlibDisplay& operator= (const XlibDisplay&);
123 class XlibWindow : public WindowBase
126 XlibWindow (XlibDisplay& display, int width, int height,
130 void setVisibility (bool visible);
132 void processEvents (void);
133 DisplayBase& getDisplay (void) { return (DisplayBase&)m_display; }
134 ::Window& getXID (void) { return m_window; }
136 void getDimensions (int* width, int* height) const;
137 void setDimensions (int width, int height);
140 XlibDisplay& m_display;
141 ::Colormap m_colormap;
145 XlibWindow (const XlibWindow&);
146 XlibWindow& operator= (const XlibWindow&);
152 #endif // _TCUX11_HPP