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 static bool hasDisplay (const char* name); 47 48 static DisplayState s_displayState; 49 protected: 50 xcb_screen_t* m_screen; 51 xcb_connection_t* m_connection; 52 53 private: 54 XcbDisplay (const XcbDisplay&); 55 XcbDisplay& operator= (const XcbDisplay&); 56 }; 57 58 class XcbWindow : public WindowBase 59 { 60 public: 61 XcbWindow (XcbDisplay& display, int width, int height, xcb_visualid_t* visual); 62 ~XcbWindow (void); 63 64 void setVisibility (bool visible); 65 66 void processEvents (void); getDisplay(void)67 DisplayBase& getDisplay (void) { return (DisplayBase&)m_display; } getXID(void)68 xcb_window_t& getXID (void) { return m_window; } 69 70 void getDimensions (int* width, int* height) const; 71 void setDimensions (int width, int height); 72 73 protected: 74 75 XcbDisplay& m_display; 76 xcb_colormap_t m_colormap; 77 xcb_window_t m_window; 78 79 private: 80 XcbWindow (const XcbWindow&); 81 XcbWindow& operator= (const XcbWindow&); 82 }; 83 84 } // x11 85 } // lnx 86 } // tcu 87 88 #endif // _TCULNXX11XCB_HPP 89