This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WindowImplX11::WindowImplX11(WindowHandle handle, const ContextSettings& settings) : | |
m_window (0), | |
m_inputMethod (NULL), | |
m_inputContext(NULL), | |
m_isExternal (true), | |
m_atomClose (0), | |
m_oldVideoMode(-1), | |
m_hiddenCursor(0), | |
m_keyRepeat (true), | |
m_previousSize(-1, -1) | |
{ | |
// Instead of hooking the given window directly, we create a child window that covers it; | |
// this gives more flexibility (especially about event handling) | |
// Open a connection with the X server | |
m_display = OpenDisplay(); | |
m_screen = DefaultScreen(m_display); | |
// Get the size of the parent window | |
XWindowAttributes parentAttributes; | |
XGetWindowAttributes(m_display, handle, &parentAttributes); | |
// Choose the visual according to the context settings | |
XVisualInfo visualInfo = GlxContext::selectBestVisual(m_display, parentAttributes.depth, settings); | |
// Define the window attributes | |
XSetWindowAttributes attributes; | |
attributes.override_redirect = false; | |
attributes.event_mask = eventMask; | |
attributes.colormap = XCreateColormap(m_display, handle, visualInfo.visual, AllocNone); | |
// Create the window | |
m_window = XCreateWindow(m_display, | |
handle, | |
0, 0, | |
parentAttributes.width, parentAttributes.height, | |
0, | |
visualInfo.depth, | |
InputOutput, | |
visualInfo.visual, | |
CWEventMask | CWOverrideRedirect | CWColormap, &attributes); | |
if (!m_window) | |
{ | |
err() << "Failed to create window" << std::endl; | |
return; | |
} | |
// Do some common initializations | |
initialize(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment