1
0
Fork 0

source/Platform/Unix/X11Display.cpp: call XSetWMProtocols with "WM_DELETE_WINDOW" flag.

This commit is contained in:
Henrik Hautakoski 2019-12-27 22:21:46 +01:00
parent d94c7fcf9a
commit 46bf27f4a4

View file

@ -19,6 +19,7 @@ bool X11Display::create(DisplayDescription description)
{
XSetWindowAttributes attr;
XVisualInfo* vi;
Atom protocols;
m_disp = XGetDisplay();
if (m_disp == NULL) {
@ -44,6 +45,11 @@ bool X11Display::create(DisplayDescription description)
InputOutput, DefaultVisual(m_disp, m_screen),
CWBackPixel | CWColormap | CWBorderPixel | CWEventMask, &attr);
// X11 does not handle pressing the X button on a window.
// that is the job of the window manager.
// Here we can request the WM to send us a delete event so we can handle it ourself.
protocols = getAtom("WM_DELETE_WINDOW");
XSetWMProtocols(m_disp, m_win, &protocols, 1);
XMapWindow(m_disp, m_win);