mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Fixes Issue 2070
Fixes Issue 1886 Fixes Issue 1519 Fixes wxWindow Destroy Issue Quits DX9 full screen when a message box pops up git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4898 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -145,11 +145,19 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||
|
||||
case WM_USER:
|
||||
if (wParam == WM_USER_STOP)
|
||||
{
|
||||
SetCursor((lParam) ? hCursor : hCursorBlank);
|
||||
}
|
||||
else if (wParam == TOGGLE_FULLSCREEN)
|
||||
{
|
||||
ToggleFullscreen(hWnd);
|
||||
}
|
||||
else if (wParam == WIIMOTE_DISCONNECT)
|
||||
{
|
||||
if (g_Config.bFullscreen)
|
||||
ToggleFullscreen(hWnd);
|
||||
PostMessage(m_hMain, WM_USER, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
@ -204,7 +212,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
||||
m_hMain = parent;
|
||||
m_hParent = NULL;
|
||||
|
||||
DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
|
||||
DWORD style = WS_OVERLAPPEDWINDOW;
|
||||
|
||||
RECT rc = {0, 0, width, height};
|
||||
AdjustWindowRect(&rc, style, false);
|
||||
@ -239,38 +247,31 @@ HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title)
|
||||
// 2. Make DX9 in fullscreen can be overlapped by other dialogs
|
||||
HWND Ret;
|
||||
int width=640, height=480;
|
||||
sscanf( g_Config.bFullscreen ? g_Config.cFSResolution : g_Config.cInternalRes, "%dx%d", &width, &height );
|
||||
// SetSize(width, height);
|
||||
sscanf(g_Config.cInternalRes, "%dx%d", &width, &height );
|
||||
|
||||
Ret = OpenWindow(hParent, hInstance, width, height, title);
|
||||
|
||||
if (Ret)
|
||||
{
|
||||
DWORD dwStyle = 0; // Window Style
|
||||
DWORD dwExStyle = 0; // Window Extended Style
|
||||
RECT rc = {0, 0, width, height};
|
||||
RECT rcdesktop;
|
||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||
|
||||
if (g_Config.bFullscreen && !g_Config.RenderToMainframe)
|
||||
if (g_Config.bFullscreen)
|
||||
{
|
||||
// Hide the cursor
|
||||
ShowCursor(FALSE);
|
||||
ToggleFullscreen(Ret, true);
|
||||
}
|
||||
else if (!g_Config.RenderToMainframe)
|
||||
{
|
||||
SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||
Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
||||
dwStyle = WS_OVERLAPPEDWINDOW;
|
||||
Show();
|
||||
}
|
||||
|
||||
// AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
|
||||
|
||||
if (g_Config.bFullscreen)
|
||||
// We put the window at the upper left corner of the screen, so x = y = 0
|
||||
SetWindowPos(EmuWindow::GetWnd(), NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||
else if (!g_Config.RenderToMainframe)
|
||||
SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
@ -300,7 +301,7 @@ void SetSize(int width, int height)
|
||||
MoveWindow(m_hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
|
||||
}
|
||||
|
||||
void ToggleFullscreen(HWND hParent)
|
||||
void ToggleFullscreen(HWND hParent, bool bForceFull)
|
||||
{
|
||||
if (m_hParent == NULL)
|
||||
{
|
||||
@ -312,35 +313,7 @@ void ToggleFullscreen(HWND hParent)
|
||||
|
||||
RECT rcdesktop;
|
||||
int w_fs = 640, h_fs = 480;
|
||||
if (g_Config.bFullscreen)
|
||||
{
|
||||
if (strlen(g_Config.cInternalRes) > 1)
|
||||
sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
|
||||
|
||||
//Get out of fullscreen
|
||||
g_Config.bFullscreen = false;
|
||||
|
||||
// FullScreen - > Desktop
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
|
||||
// Re-Enable the cursor
|
||||
ShowCursor(TRUE);
|
||||
|
||||
RECT rc = {0, 0, w_fs, h_fs};
|
||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||
|
||||
// SetWindowPos to the center of the screen
|
||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||
SetWindowPos(hParent, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||
|
||||
// Set new window style FS -> Windowed
|
||||
SetWindowLong(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW);
|
||||
|
||||
// Eventually show the window!
|
||||
EmuWindow::Show();
|
||||
}
|
||||
else
|
||||
if (!g_Config.bFullscreen || bForceFull)
|
||||
{
|
||||
if (strlen(g_Config.cFSResolution) > 1)
|
||||
sscanf(g_Config.cFSResolution, "%dx%d", &w_fs, &h_fs);
|
||||
@ -367,6 +340,34 @@ void ToggleFullscreen(HWND hParent)
|
||||
ShowCursor(FALSE);
|
||||
g_Config.bFullscreen = true;
|
||||
|
||||
// Eventually show the window!
|
||||
EmuWindow::Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(g_Config.cInternalRes) > 1)
|
||||
sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
|
||||
|
||||
//Get out of fullscreen
|
||||
g_Config.bFullscreen = false;
|
||||
|
||||
// FullScreen - > Desktop
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
|
||||
// Re-Enable the cursor
|
||||
ShowCursor(TRUE);
|
||||
|
||||
RECT rc = {0, 0, w_fs, h_fs};
|
||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||
|
||||
// SetWindowPos to the center of the screen
|
||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||
SetWindowPos(hParent, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||
|
||||
// Set new window style FS -> Windowed
|
||||
SetWindowLong(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW);
|
||||
|
||||
// Eventually show the window!
|
||||
EmuWindow::Show();
|
||||
}
|
||||
|
Reference in New Issue
Block a user