diff --git a/source/Platform/Unix/X11Display.cpp b/source/Platform/Unix/X11Display.cpp index fc6f700..1c825f6 100644 --- a/source/Platform/Unix/X11Display.cpp +++ b/source/Platform/Unix/X11Display.cpp @@ -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);