From 698648f7e7523a2943de7ddf24c99f89b75fc773 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 2 Nov 2010 21:40:00 +0100 Subject: [PATCH] Changed: #1063 Alt+F4 should prompt for confirm exit (thank you Naush) --- .../nel/src/3d/driver/opengl/unix_event_emitter.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp index 4ceb88116..13a264053 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -32,6 +32,7 @@ static Atom XA_CLIPBOARD = 0; static Atom XA_UTF8_STRING = 0; static Atom XA_TARGETS = 0; static Atom XA_NEL_SEL = 0; +static Atom XA_WM_DELETE_WINDOW = 0; namespace NLMISC { @@ -62,6 +63,10 @@ void CUnixEventEmitter::init(Display *dpy, Window win, NL3D::IDriver *driver) XA_TARGETS = XInternAtom(dpy, "TARGETS", False); XA_NEL_SEL = XInternAtom(dpy, "NeL_SEL", False); + // define Atom used by delete window + XA_WM_DELETE_WINDOW = XInternAtom(dpy, "WM_DELETE_WINDOW", False); + XSetWMProtocols(dpy, win, &XA_WM_DELETE_WINDOW, 1); + /* TODO: implements all useful events processing EnterWindowMask|LeaveWindowMask|ButtonMotionMask|Button1MotionMask|Button2MotionMask| @@ -775,10 +780,10 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) createIM(); break; case ClientMessage: -// if ((xevent.xclient.format == 32) && (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) -// { -// server->postEvent (new CEventDestroyWindow (this)); -// } + if ((event.xclient.format == 32) && (event.xclient.data.l[0] == XA_WM_DELETE_WINDOW)) + { + server->postEvent(new CEventDestroyWindow(this)); + } break; default: // nlinfo("UnknownEvent");