Fix the auto window resize option to take into account if the log/console window is open.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7031 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2011-02-01 04:35:25 +00:00
parent 53ae9e9e8f
commit 0d426e3972
4 changed files with 37 additions and 10 deletions

View File

@ -656,6 +656,14 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
m_RenderParent->SetCursor(wxCURSOR_BLANK);
break;
case IDM_WINDOWSIZEREQUEST:
{
std::pair<int, int> *win_size = (std::pair<int, int> *)(event.GetClientData());
OnRenderWindowSizeRequest(win_size->first, win_size->second);
delete win_size;
}
break;
#ifdef __WXGTK__
case IDM_PANIC:
bPanicResult = (wxYES == wxMessageBox(event.GetString(),
@ -684,18 +692,34 @@ void CFrame::GetRenderWindowSize(int& x, int& y, int& width, int& height)
void CFrame::OnRenderWindowSizeRequest(int width, int height)
{
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize ||
if (Core::GetState() == Core::CORE_UNINITIALIZED ||
!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain ||
!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize ||
RendererIsFullscreen() || m_RenderFrame->IsMaximized())
return;
int old_width, old_height;
int old_width, old_height, log_width = 0, log_height = 0;
m_RenderFrame->GetClientSize(&old_width, &old_height);
if (old_width != width || old_height != height)
// Add space for the log/console/debugger window
if ((SConfig::GetInstance().m_InterfaceLogWindow || SConfig::GetInstance().m_InterfaceConsole) &&
!m_Mgr->GetPane(wxT("Pane 1")).IsFloating())
{
wxMutexGuiEnter();
m_RenderFrame->SetClientSize(width, height);
wxMutexGuiLeave();
switch (m_Mgr->GetPane(wxT("Pane 1")).dock_direction)
{
case wxAUI_DOCK_LEFT:
case wxAUI_DOCK_RIGHT:
log_width = m_Mgr->GetPane(wxT("Pane 1")).rect.GetWidth();
break;
case wxAUI_DOCK_TOP:
case wxAUI_DOCK_BOTTOM:
log_height = m_Mgr->GetPane(wxT("Pane 1")).rect.GetHeight();
break;
}
}
if (old_width != width + log_width || old_height != height + log_height)
m_RenderFrame->SetClientSize(width + log_width, height + log_height);
}
bool CFrame::RendererHasFocus()

View File

@ -239,6 +239,7 @@ enum
IDM_UPDATEBREAKPOINTS,
IDM_PANIC,
IDM_KEYSTATE,
IDM_WINDOWSIZEREQUEST,
IDM_HOST_MESSAGE,
IDM_MPANEL, ID_STATUSBAR,

View File

@ -587,7 +587,9 @@ void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
void Host_RequestRenderWindowSize(int width, int height)
{
main_frame->OnRenderWindowSizeRequest(width, height);
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_WINDOWSIZEREQUEST);
event.SetClientData(new std::pair<int, int>(width, height));
main_frame->GetEventHandler()->AddPendingEvent(event);
}
void Host_SetWaitCursor(bool enable)

View File

@ -238,7 +238,7 @@ bool OpenGL_Create(int _twidth, int _theight)
None };
GLWin.dpy = XOpenDisplay(0);
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
GLWin.parent = (Window)VideoWindowHandle();
GLWin.screen = DefaultScreen(GLWin.dpy);
// Get an appropriate visual
@ -294,7 +294,7 @@ bool OpenGL_Create(int _twidth, int _theight)
"GPU", None, NULL, 0, NULL);
XMapRaised(GLWin.dpy, GLWin.win);
g_VideoInitialize.pWindowHandle = (void *)GLWin.win;
VideoWindowHandle() = (void *)GLWin.win;
#endif
return true;
}
@ -370,7 +370,7 @@ void OpenGL_Update()
break;
case ClientMessage:
if ((unsigned long) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False))
g_VideoInitialize.pCoreMessage(WM_USER_STOP);
Core::Callback_CoreMessage(WM_USER_STOP);
if ((unsigned long) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "RESIZE", False))
XMoveResizeWindow(GLWin.dpy, GLWin.win, event.xclient.data.l[1],
event.xclient.data.l[2], event.xclient.data.l[3], event.xclient.data.l[4]);