Fixed an issue that caused the render to main window to lose focus if the gfx config dialog is opened while the emulator is running. Only affects linux. Also fixed a few preprocessor conditionals.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5186 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-03-10 17:29:19 +00:00
parent 70627c5652
commit 5fa18ae114
4 changed files with 15 additions and 7 deletions

View File

@ -272,6 +272,8 @@ void ProcessXEvents(void)
case ClientMessage: case ClientMessage:
if ((ulong) event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False)) if ((ulong) event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False))
Host_Message(WM_USER_STOP); 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; break;
default: default:
break; break;

View File

@ -547,8 +547,8 @@ void X11_SendEvent(const char *message)
// Events // Events
void CFrame::OnActive(wxActivateEvent& event) void CFrame::OnActive(wxActivateEvent& event)
{ {
#if defined(HAVE_X11) && HAVE_X11 && defined(wxGTK) #if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
if (event.GetActive() && Core::GetState() == Core::CORE_RUN) if (event.GetActive() && (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE))
X11_SendEvent("WINDOW_REFOCUS"); X11_SendEvent("WINDOW_REFOCUS");
#endif #endif
event.Skip(); event.Skip();
@ -614,8 +614,8 @@ void CFrame::OnResize(wxSizeEvent& event)
SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth(); SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth();
SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight(); SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight();
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
if (Core::GetState() == Core::CORE_RUN) if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
X11_SendEvent("MAIN_RESIZED"); X11_SendEvent("MAIN_RESIZED");
#endif #endif

View File

@ -699,10 +699,10 @@ void OpenGL_Update()
GLWin.panel->GetSize((int *)&GLWin.width, (int *)&GLWin.height); GLWin.panel->GetSize((int *)&GLWin.width, (int *)&GLWin.height);
XResizeWindow(GLWin.dpy, GLWin.win, GLWin.width, GLWin.height); XResizeWindow(GLWin.dpy, GLWin.win, GLWin.width, GLWin.height);
} }
#endif
if (g_Config.RenderToMainframe && if (g_Config.RenderToMainframe &&
(ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WINDOW_REFOCUS", False)) (ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WINDOW_REFOCUS", False))
XSetInputFocus(GLWin.dpy, GLWin.win, RevertToPointerRoot, CurrentTime); XSetInputFocus(GLWin.dpy, GLWin.win, RevertToPointerRoot, CurrentTime);
#endif
break; break;
default: default:
break; break;

View File

@ -208,12 +208,18 @@ void Win32AddResolutions()
} }
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XRANDR) && HAVE_XRANDR #elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XRANDR) && HAVE_XRANDR
void X11AddResolutions() { 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 //Get all full screen resos for the config dialog
XRRScreenSize *sizes = NULL; XRRScreenSize *sizes = NULL;
int modeNum = 0; int modeNum = 0;
sizes = XRRSizes(GLWin.dpy, GLWin.screen, &modeNum); sizes = XRRSizes(dpy, screen, &modeNum);
XCloseDisplay(dpy);
if (modeNum > 0 && sizes != NULL) if (modeNum > 0 && sizes != NULL)
{ {
for (int i = 0; i < modeNum; i++) for (int i = 0; i < modeNum; i++)