From d6f4f4df421cc1c8fe06ef345f65826d5cc7815d Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 6 Aug 2014 14:58:34 -0400 Subject: [PATCH] MainNoGUI: Move a majority of the event handling from the GLX backend The only reason the GLX backend handled this at all was because MainNoGUI didn't make its own window before. This is unused in DolphinWX builds. --- Source/Core/DolphinWX/GLInterface/X11_Util.cpp | 11 +---------- Source/Core/DolphinWX/MainNoGUI.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp index 610fd67949..79d0d76b8b 100644 --- a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp +++ b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp @@ -8,8 +8,6 @@ void cX11Window::CreateXWindow(void) { - Atom wmProtocols[1]; - // Setup window attributes GLWin.attr.colormap = XCreateColormap(GLWin.dpy, GLWin.parent, GLWin.vi->visual, AllocNone); @@ -22,9 +20,7 @@ void cX11Window::CreateXWindow(void) 0, 0, 1, 1, 0, GLWin.vi->depth, InputOutput, GLWin.vi->visual, CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr); - wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True); - XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1); - XMapRaised(GLWin.dpy, GLWin.win); + XMapWindow(GLWin.dpy, GLWin.win); XSync(GLWin.dpy, True); GLWin.xEventThread = std::thread(&cX11Window::XEventThread, this); @@ -51,11 +47,6 @@ void cX11Window::XEventThread() case ConfigureNotify: GLInterface->SetBackBufferDimensions(event.xconfigure.width, event.xconfigure.height); break; - case ClientMessage: - if ((unsigned long) event.xclient.data.l[0] == - XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False)) - Host_Message(WM_USER_STOP); - break; default: break; } diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index 74e9cc00a0..9231b3ef3a 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -148,6 +148,9 @@ class PlatformX11 : public Platform SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight, 0, 0, BlackPixel(dpy, 0)); XSelectInput(dpy, win, KeyPressMask | FocusChangeMask); + Atom wmProtocols[1]; + wmProtocols[0] = XInternAtom(dpy, "WM_DELETE_WINDOW", True); + XSetWMProtocols(dpy, win, wmProtocols, 1); XMapRaised(dpy, win); XFlush(dpy); windowHandle = (void *) win; @@ -250,6 +253,10 @@ class PlatformX11 : public Platform if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) XUndefineCursor(dpy, win); break; + case ClientMessage: + if ((unsigned long) event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False)) + running = false; + break; } } if (!fullscreen)