make ESC quit the game instead of toggling out of/into full screen mode (fixes issue 2246),

implement proper window handling (d3d/sw) which i believe fixes a hang that occurs when a game is stopped (plz test this :)) + some minor stuff

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5030 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
luisr142004 2010-02-08 09:57:52 +00:00
parent 3915f0fbca
commit 3f90bb215c
6 changed files with 46 additions and 60 deletions

View File

@ -80,11 +80,11 @@ bool Exists(const char *filename)
// Returns true if filename is a directory
bool IsDirectory(const char *filename)
{
struct stat file_info;
struct stat64 file_info;
char *copy = StripTailDirSlashes(__strdup(filename));
int result = stat(copy, &file_info);
int result = stat64(copy, &file_info);
free(copy);
if (result < 0) {

View File

@ -30,7 +30,7 @@ SConfig::SConfig()
{
// Make sure we have log manager
LoadSettings();
//Mkae sure we load settings
//Make sure we load settings
LoadSettingsHLE();
}

View File

@ -148,7 +148,7 @@ CPanel::CPanel(
// Stop
case WM_USER_STOP:
main_frame->DoStop();
return 0;
break;
case WM_USER_CREATE:
// We don't have a local setting for bRenderToMain but we can detect it this way instead
@ -157,7 +157,7 @@ CPanel::CPanel(
main_frame->bRenderToMain = false;
else
main_frame->bRenderToMain = true;
return 0;
break;
case WIIMOTE_DISCONNECT:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
@ -183,13 +183,13 @@ CPanel::CPanel(
dlg->Destroy();
}
}
return 0;
}
break;
default:
// By default let wxWidgets do what it normally does with this event
return wxPanel::MSWWindowProc(nMsg, wParam, lParam);
}
// By default let wxWidgets do what it normally does with this event
return wxPanel::MSWWindowProc(nMsg, wParam, lParam);
return 0;
}
#endif
@ -730,13 +730,17 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
void CFrame::OnKeyDown(wxKeyEvent& event)
{
// Toggle fullscreen
if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == WXK_RETURN && event.GetModifiers() == wxMOD_ALT))
if (event.GetKeyCode() == WXK_RETURN && event.GetModifiers() == wxMOD_ALT)
{
DoFullscreen(!IsFullScreen());
// We do that to avoid the event to be double processed (which would cause the window to be stuck in fullscreen)
event.StopPropagation();
}
else if(event.GetKeyCode() == WXK_ESCAPE)
{
main_frame->DoStop();
}
// event.Skip() allows the event to propagate to the gamelist for example
else if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == this))
event.Skip();
@ -927,7 +931,10 @@ void CFrame::DoFullscreen(bool bF)
}
#ifdef _WIN32
else // Post the message to the separate rendering window which will then handle it.
{
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, TOGGLE_FULLSCREEN, 0);
BringWindowToTop((HWND)Core::GetWindowHandle());
}
#endif
}

View File

@ -80,7 +80,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
}
return 0;
break;
case WM_ENTERSIZEMOVE:
s_sizing = true;
@ -94,22 +94,16 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
switch (LOWORD(wParam))
{
case VK_ESCAPE:
ToggleFullscreen(hWnd);
return 0;
/*
if (g_Config.bFullscreen)
{
// Pressing Esc switches to Windowed in Fullscreen mode
ToggleFullscreen(hWnd);
return 0;
}
else
if(!g_Config.RenderToMainframe)
{
if (g_Config.bFullscreen)
{
// Pressing Esc switches to Windowed mode from Fullscreen mode
ToggleFullscreen(hWnd);
}
// And stops the emulation when already in Windowed mode
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
return 0;
}
*/
break;
case '3': // OSD keys
case '4':
@ -125,18 +119,17 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
break;
case WM_SYSKEYDOWN:
switch( LOWORD( wParam ))
switch (LOWORD( wParam ))
{
case VK_RETURN: // Pressing Alt+Enter switch FullScreen/Windowed
if (m_hParent == NULL && !g_Config.RenderToMainframe)
{
ToggleFullscreen(hWnd);
return 0;
}
break;
case VK_F5: case VK_F6: case VK_F7: case VK_F8:
PostMessage(m_hMain, WM_SYSKEYDOWN, wParam, lParam);
return 0;
break;
}
break;
@ -146,7 +139,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
PostMessage(GetParentWnd(), iMsg, wParam, lParam);
break;
break;
case WM_CLOSE:
// When the user closes the window, we post an event to the main window to call Stop()
@ -154,7 +147,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
if (m_hParent == NULL)
{
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
return 0;
}
break;
@ -178,12 +170,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return 0;
break;
}
break;
default:
return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
return DefWindowProc(hWnd, iMsg, wParam, lParam);
return 0;
}
// ---------------------------------------------------------------------

View File

@ -243,25 +243,16 @@ void OnKeyDown(WPARAM wParam)
switch (LOWORD( wParam ))
{
case VK_ESCAPE:
ToggleFullscreen(m_hWnd);
return;
/*
if (!g_Config.RenderToMainframe)
{
if (g_Config.bFullscreen)
{
// Pressing Esc switches to Windowed in Fullscreen mode
// Pressing Esc switches to Windowed mode from Fullscreen mode
ToggleFullscreen(m_hWnd);
return;
}
else
{
// Pressing Esc stops the emulation
SendMessage( m_hWnd, WM_CLOSE, 0, 0 );
return;
}
// then stops the emulation if already Windowed
SendMessage(m_hWnd, WM_CLOSE, 0, 0);
}
*/
break;
case '3': // OSD keys
case '4':

View File

@ -23,7 +23,7 @@
#include <wx/dialog.h>
#include <wx/aboutdlg.h>
#include "../VideoConfig.h"
#include "VideoConfig.h"
#include "main.h"
#include "Win32.h"
@ -135,7 +135,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
case WM_PAINT:
hdc = BeginPaint( hWnd, &ps );
EndPaint( hWnd, &ps );
return 0;
break;
case WM_SYSKEYDOWN:
switch( LOWORD( wParam ))
@ -145,31 +145,25 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
if (m_hParent == NULL && !g_Config.renderToMainframe)
{
ToggleFullscreen(hWnd);
return 0;
}
break;
case VK_F5: case VK_F6: case VK_F7: case VK_F8:
PostMessage(m_hMain, WM_SYSKEYDOWN, wParam, lParam);
return 0;
break;
}
break;
case WM_KEYDOWN:
switch( LOWORD( wParam ))
switch (LOWORD( wParam ))
{
case VK_ESCAPE:
if (g_Config.bFullscreen)
{
// Pressing Esc switch to Windowed in Fullscreen mode
// Pressing Esc switches to Windowed mode from Fullscreen mode
ToggleFullscreen(hWnd);
return 0;
}
else if (!g_Config.renderToMainframe)
{
// And stops the emulation when already in Windowed mode
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
return 0;
}
// And stops the emulation when already in Windowed mode
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
break;
}
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
@ -214,8 +208,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
{
// Simple hack to easily exit without stopping. Hope to fix the stopping errors soon.
ExitProcess(0);
return 0;
}
break;
case WM_DESTROY:
//Shutdown();
@ -228,12 +222,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return 0;
break;
}
break;
default:
return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
return DefWindowProc(hWnd, iMsg, wParam, lParam);
return 0;
}