1
0
Fork 0

source/Platform/Unix/X11Display.cpp: register with X11WindowEventHandler

This commit is contained in:
Henrik Hautakoski 2019-12-30 05:34:01 +01:00
parent 2788424516
commit 6dffb1619a

View file

@ -1,6 +1,7 @@
#include <Spectre/Display/DisplayDescription.h> // Prevents conflict with X.h defining "None"
#include <Spectre/System/Log.h>
#include "X11WindowEventHandler.h"
#include "X11SharedDisplay.h"
#include "GLXContext.h"
#include "X11Display.h"
@ -45,6 +46,9 @@ bool X11Display::create(DisplayDescription description)
InputOutput, DefaultVisual(m_disp, m_screen),
CWBackPixel | CWColormap | CWBorderPixel | CWEventMask, &attr);
// Register event handler
X11WindowEventHandler::registerHandler(m_disp, m_win, this);
// 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.
@ -66,6 +70,10 @@ bool X11Display::create(DisplayDescription description)
void X11Display::destroy()
{
if (m_win) {
X11WindowEventHandler::unregisterHandler(m_disp, m_win);
}
if (m_disp) {
XReleaseDisplay();
m_disp = NULL;