1#ifndef _TCUX11XCB_HPP
2#define _TCUX11XCB_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 "tcuX11.hpp"
27#include <xcb/xcb.h>
28
29namespace tcu
30{
31namespace x11
32{
33
34class XcbDisplay : public DisplayBase
35{
36public:
37						XcbDisplay		(EventState& platform, const char* name);
38	virtual				~XcbDisplay		(void);
39
40	xcb_screen_t*		getScreen		(void) { return m_screen;		}
41	xcb_connection_t*	getConnection	(void) { return m_connection;	}
42
43	void				processEvents	(void);
44
45protected:
46	xcb_screen_t*		m_screen;
47	xcb_connection_t*	m_connection;
48
49private:
50						XcbDisplay		(const XcbDisplay&);
51	XcbDisplay&			operator=		(const XcbDisplay&);
52};
53
54class XcbWindow : public WindowBase
55{
56public:
57					XcbWindow		(XcbDisplay& display, int width, int height, xcb_visualid_t* visual);
58					~XcbWindow		(void);
59
60	void			setVisibility	(bool visible);
61
62	void			processEvents	(void);
63	DisplayBase&	getDisplay		(void) { return (DisplayBase&)m_display; }
64	xcb_window_t&	getXID			(void) { return m_window; }
65
66	void			getDimensions	(int* width, int* height) const;
67	void			setDimensions	(int width, int height);
68
69protected:
70
71	XcbDisplay&		m_display;
72	xcb_colormap_t	m_colormap;
73	xcb_window_t	m_window;
74
75private:
76					XcbWindow		(const XcbWindow&);
77	XcbWindow&		operator=		(const XcbWindow&);
78};
79
80} // x11
81} // tcu
82
83#endif // _TCUX11XCB_HPP
84