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.
This commit is contained in:
Jasper St. Pierre 2014-08-06 14:58:34 -04:00
parent 0dd7f6f5ea
commit d6f4f4df42
2 changed files with 8 additions and 10 deletions

View File

@ -8,8 +8,6 @@
void cX11Window::CreateXWindow(void) void cX11Window::CreateXWindow(void)
{ {
Atom wmProtocols[1];
// Setup window attributes // Setup window attributes
GLWin.attr.colormap = XCreateColormap(GLWin.dpy, GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
GLWin.parent, GLWin.vi->visual, AllocNone); GLWin.parent, GLWin.vi->visual, AllocNone);
@ -22,9 +20,7 @@ void cX11Window::CreateXWindow(void)
0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
GLWin.vi->depth, InputOutput, GLWin.vi->visual, GLWin.vi->depth, InputOutput, GLWin.vi->visual,
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr); CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True); XMapWindow(GLWin.dpy, GLWin.win);
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1);
XMapRaised(GLWin.dpy, GLWin.win);
XSync(GLWin.dpy, True); XSync(GLWin.dpy, True);
GLWin.xEventThread = std::thread(&cX11Window::XEventThread, this); GLWin.xEventThread = std::thread(&cX11Window::XEventThread, this);
@ -51,11 +47,6 @@ void cX11Window::XEventThread()
case ConfigureNotify: case ConfigureNotify:
GLInterface->SetBackBufferDimensions(event.xconfigure.width, event.xconfigure.height); GLInterface->SetBackBufferDimensions(event.xconfigure.width, event.xconfigure.height);
break; 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: default:
break; break;
} }

View File

@ -148,6 +148,9 @@ class PlatformX11 : public Platform
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight, SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight,
0, 0, BlackPixel(dpy, 0)); 0, 0, BlackPixel(dpy, 0));
XSelectInput(dpy, win, KeyPressMask | FocusChangeMask); XSelectInput(dpy, win, KeyPressMask | FocusChangeMask);
Atom wmProtocols[1];
wmProtocols[0] = XInternAtom(dpy, "WM_DELETE_WINDOW", True);
XSetWMProtocols(dpy, win, wmProtocols, 1);
XMapRaised(dpy, win); XMapRaised(dpy, win);
XFlush(dpy); XFlush(dpy);
windowHandle = (void *) win; windowHandle = (void *) win;
@ -250,6 +253,10 @@ class PlatformX11 : public Platform
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XUndefineCursor(dpy, win); XUndefineCursor(dpy, win);
break; break;
case ClientMessage:
if ((unsigned long) event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False))
running = false;
break;
} }
} }
if (!fullscreen) if (!fullscreen)