• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _TCULNXX11XCB_HPP
2 #define _TCULNXX11XCB_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program Tester Core
5  * ----------------------------------------
6  *
7  * Copyright (c) 2016 The Khronos Group Inc.
8  *
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
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
21  *//*!
22  * \file
23  * \brief X11 using XCB utilities.
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuLnxX11.hpp"
27 #include <xcb/xcb.h>
28 
29 namespace tcu
30 {
31 namespace lnx
32 {
33 namespace x11
34 {
35 
36 class XcbDisplay : public DisplayBase
37 {
38 public:
39 						XcbDisplay		(EventState& platform, const char* name);
40 	virtual				~XcbDisplay		(void);
41 
getScreen(void)42 	xcb_screen_t*		getScreen		(void) { return m_screen;		}
getConnection(void)43 	xcb_connection_t*	getConnection	(void) { return m_connection;	}
44 
45 	void				processEvents	(void);
46 
47 protected:
48 	xcb_screen_t*		m_screen;
49 	xcb_connection_t*	m_connection;
50 
51 private:
52 						XcbDisplay		(const XcbDisplay&);
53 	XcbDisplay&			operator=		(const XcbDisplay&);
54 };
55 
56 class XcbWindow : public WindowBase
57 {
58 public:
59 					XcbWindow		(XcbDisplay& display, int width, int height, xcb_visualid_t* visual);
60 					~XcbWindow		(void);
61 
62 	void			setVisibility	(bool visible);
63 
64 	void			processEvents	(void);
getDisplay(void)65 	DisplayBase&	getDisplay		(void) { return (DisplayBase&)m_display; }
getXID(void)66 	xcb_window_t&	getXID			(void) { return m_window; }
67 
68 	void			getDimensions	(int* width, int* height) const;
69 	void			setDimensions	(int width, int height);
70 
71 protected:
72 
73 	XcbDisplay&		m_display;
74 	xcb_colormap_t	m_colormap;
75 	xcb_window_t	m_window;
76 
77 private:
78 					XcbWindow		(const XcbWindow&);
79 	XcbWindow&		operator=		(const XcbWindow&);
80 };
81 
82 } // x11
83 } // lnx
84 } // tcu
85 
86 #endif // _TCULNXX11XCB_HPP
87