1
0
Fork 0

Platform/Unix/X11Display.cpp: Minor cleanup.

This commit is contained in:
Henrik Hautakoski 2020-10-27 18:47:26 +01:00
parent f5d80aa46f
commit 61b233f708

View file

@ -24,6 +24,8 @@ bool X11Display::create(DisplayDescription description)
XSetWindowAttributes attr; XSetWindowAttributes attr;
XVisualInfo* vi; XVisualInfo* vi;
Atom protocols; Atom protocols;
Visual* visual;
Window root_win;
m_disp = XGetDisplay(); m_disp = XGetDisplay();
if (m_disp == NULL) { if (m_disp == NULL) {
@ -32,21 +34,22 @@ bool X11Display::create(DisplayDescription description)
} }
m_screen = DefaultScreen(m_disp); m_screen = DefaultScreen(m_disp);
root_win = XRootWindow(m_disp, m_screen);
visual = DefaultVisual(m_disp, m_screen);
attr.border_pixel = BlackPixel(m_disp, m_screen); attr.border_pixel = BlackPixel(m_disp, m_screen);
attr.background_pixel = WhitePixel(m_disp, m_screen); attr.background_pixel = WhitePixel(m_disp, m_screen);
//attr.override_redirect = True; //attr.override_redirect = True;
attr.colormap = ::XCreateColormap(m_disp, RootWindow(m_disp, m_screen), DefaultVisual(m_disp, m_screen), AllocNone); attr.colormap = ::XCreateColormap(m_disp, root_win, visual, AllocNone);
// We want Keyboard,Mouse,Resize,Exposure (repaint) events. // We want Keyboard,Mouse,Resize,Exposure (repaint) events.
attr.event_mask = KeyPressMask | KeyReleaseMask attr.event_mask = KeyPressMask | KeyReleaseMask
| ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask
| StructureNotifyMask | ExposureMask; | StructureNotifyMask | ExposureMask;
m_win = XCreateWindow(m_disp, m_win = XCreateWindow(m_disp, root_win,
RootWindow(m_disp, m_screen),
0, 0, 0, 0,
m_size.x, m_size.y, 0, DefaultDepth(m_disp, m_screen), m_size.x, m_size.y, 0, DefaultDepth(m_disp, m_screen),
InputOutput, DefaultVisual(m_disp, m_screen), InputOutput, visual,
CWBackPixel | CWColormap | CWBorderPixel | CWEventMask, &attr); CWBackPixel | CWColormap | CWBorderPixel | CWEventMask, &attr);
// Register event handler // Register event handler