diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 95a1a592ed..7abb4612fd 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -272,6 +272,8 @@ void ProcessXEvents(void) case ClientMessage: if ((ulong) event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False)) Host_Message(WM_USER_STOP); + if ((ulong) event.xclient.data.l[0] == XInternAtom(dpy, "WINDOW_REFOCUS", False)) + XSetInputFocus(dpy, *(Window *)g_pXWindow, RevertToPointerRoot, CurrentTime); break; default: break; diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index d970fe86b8..2fcfe3c18d 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -547,8 +547,8 @@ void X11_SendEvent(const char *message) // Events void CFrame::OnActive(wxActivateEvent& event) { -#if defined(HAVE_X11) && HAVE_X11 && defined(wxGTK) - if (event.GetActive() && Core::GetState() == Core::CORE_RUN) +#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK) + if (event.GetActive() && (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)) X11_SendEvent("WINDOW_REFOCUS"); #endif event.Skip(); @@ -614,8 +614,8 @@ void CFrame::OnResize(wxSizeEvent& event) SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth(); SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight(); -#if defined(HAVE_X11) && HAVE_X11 - if (Core::GetState() == Core::CORE_RUN) +#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK) + if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE) X11_SendEvent("MAIN_RESIZED"); #endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 6df7ec195a..5f329a62d4 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -699,10 +699,10 @@ void OpenGL_Update() GLWin.panel->GetSize((int *)&GLWin.width, (int *)&GLWin.height); XResizeWindow(GLWin.dpy, GLWin.win, GLWin.width, GLWin.height); } -#endif if (g_Config.RenderToMainframe && (ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WINDOW_REFOCUS", False)) XSetInputFocus(GLWin.dpy, GLWin.win, RevertToPointerRoot, CurrentTime); +#endif break; default: break; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index a763290b85..0a712ab95f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -208,12 +208,18 @@ void Win32AddResolutions() } #elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XRANDR) && HAVE_XRANDR void X11AddResolutions() { - GLWin.dpy = XOpenDisplay(0); + // Don't modify GLWin.dpy here. + // If the emulator is running that is bad. + Display *dpy; + int screen; + dpy = XOpenDisplay(0); + screen = DefaultScreen(dpy); //Get all full screen resos for the config dialog XRRScreenSize *sizes = NULL; int modeNum = 0; - sizes = XRRSizes(GLWin.dpy, GLWin.screen, &modeNum); + sizes = XRRSizes(dpy, screen, &modeNum); + XCloseDisplay(dpy); if (modeNum > 0 && sizes != NULL) { for (int i = 0; i < modeNum; i++)