reapply the changes from rev 4532 (without the resizing issues) and the changes from rev 4555 -- fixes issue 1660
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4578 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
70068a288a
commit
14c3878543
|
@ -145,11 +145,11 @@ int abc = 0;
|
|||
switch(wParam)
|
||||
{
|
||||
// Stop
|
||||
case OPENGL_WM_USER_STOP:
|
||||
case WM_USER_STOP:
|
||||
main_frame->DoStop();
|
||||
return 0;
|
||||
|
||||
case OPENGL_WM_USER_CREATE:
|
||||
case WM_USER_CREATE:
|
||||
// We don't have a local setting for bRenderToMain but we can detect it this way instead
|
||||
//PanicAlert("main call %i %i %i %i", lParam, (HWND)Core::GetWindowHandle(), MSWGetParent_((HWND)Core::GetWindowHandle()), (HWND)this->GetHWND());
|
||||
if (lParam == NULL)
|
||||
|
@ -302,7 +302,7 @@ CFrame::CFrame(wxFrame* parent,
|
|||
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
|
||||
, m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL)
|
||||
, UseDebugger(_UseDebugger), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
|
||||
, bRenderToMain(true), bFloatLogWindow(false), bFloatConsoleWindow(false)
|
||||
, bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false)
|
||||
, HaveLeds(false), HaveSpeakers(false)
|
||||
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
|
||||
#if wxUSE_TIMER
|
||||
|
@ -671,7 +671,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
|||
#ifdef _WIN32
|
||||
if(event.GetKeyCode() == 'M', '3', '4', '5', '6', '7') // Send this to the video plugin WndProc
|
||||
{
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, OPENGL_WM_USER_KEYDOWN, event.GetKeyCode());
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
enum PLUGIN_COMM
|
||||
{
|
||||
// Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on
|
||||
OPENGL_WM_USER_STOP = 10,
|
||||
OPENGL_WM_USER_CREATE,
|
||||
OPENGL_WM_USER_KEYDOWN,
|
||||
OPENGL_VIDEO_STOP,
|
||||
WM_USER_STOP = 10,
|
||||
WM_USER_CREATE,
|
||||
WM_USER_KEYDOWN,
|
||||
WM_USER_VIDEO_STOP,
|
||||
TOGGLE_FULLSCREEN,
|
||||
VIDEO_DESTROY, // The video debugging window was destroyed
|
||||
AUDIO_DESTROY, // The audio debugging window was destroyed
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
namespace EmuWindow
|
||||
{
|
||||
HWND m_hWnd = NULL;
|
||||
HWND m_hMain = NULL;
|
||||
HWND m_hParent = NULL;
|
||||
HINSTANCE m_hInstance = NULL;
|
||||
WNDCLASSEX wndClass;
|
||||
|
@ -36,6 +37,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
{
|
||||
switch( iMsg )
|
||||
{
|
||||
case WM_CREATE:
|
||||
PostMessage( m_hMain, WM_USER, WM_USER_CREATE, g_Config.RenderToMainframe );
|
||||
break;
|
||||
case WM_PAINT:
|
||||
{
|
||||
HDC hdc;
|
||||
|
@ -56,7 +60,16 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
case WM_KEYDOWN:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case VK_ESCAPE: // Pressing Esc switch FullScreen/Windowed
|
||||
case VK_ESCAPE:
|
||||
SendMessage(m_hWnd, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
}
|
||||
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
|
||||
break;
|
||||
case WM_SYSKEYDOWN:
|
||||
switch( LOWORD( wParam ))
|
||||
{
|
||||
case VK_RETURN: // Pressing Esc switch FullScreen/Windowed
|
||||
if (g_ActiveConfig.bFullscreen)
|
||||
{
|
||||
DestroyWindow(hWnd);
|
||||
|
@ -118,7 +131,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
}*/
|
||||
break;
|
||||
}
|
||||
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
|
||||
//g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
|
||||
break;
|
||||
|
||||
/* Post thes mouse events to the main window, it's nessesary because in difference to the
|
||||
|
@ -130,9 +143,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
//Fifo_ExitLoopNonBlocking();
|
||||
Fifo_ExitLoopNonBlocking();
|
||||
//Shutdown();
|
||||
PostMessage( m_hParent, WM_USER, OPENGL_WM_USER_STOP, 0 );
|
||||
PostMessage( m_hMain, WM_USER, WM_USER_STOP, 0 );
|
||||
// Simple hack to easily exit without stopping. Hope to fix the stopping errors soon.
|
||||
//ExitProcess(0);
|
||||
return 0;
|
||||
|
@ -187,17 +200,19 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||
|
||||
if (g_Config.RenderToMainframe)
|
||||
{
|
||||
m_hParent = parent;
|
||||
m_hParent = m_hMain = parent;
|
||||
|
||||
m_hWnd = CreateWindowEx(0, m_szClassName, title, WS_CHILD,
|
||||
0, 0, width, height,
|
||||
m_hParent, NULL, hInstance, NULL);
|
||||
|
||||
if( !g_Config.bFullscreen )
|
||||
SetWindowPos( GetParent(m_hParent), NULL, 0, 0, width, height, SWP_NOMOVE|SWP_NOZORDER );
|
||||
/*if( !g_Config.bFullscreen )
|
||||
SetWindowPos( GetParent(m_hParent), NULL, 0, 0, width, height, SWP_NOMOVE|SWP_NOZORDER );*/
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hMain = parent;
|
||||
|
||||
DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
|
||||
|
||||
RECT rc = {0, 0, width, height};
|
||||
|
|
|
@ -192,10 +192,10 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
#elif defined(_WIN32)
|
||||
// Create rendering window in Windows
|
||||
// Create a separate window
|
||||
if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
|
||||
/*if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
|
||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, _T("Please wait..."));
|
||||
// Create a child window
|
||||
else
|
||||
else*/
|
||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Please wait..."));
|
||||
|
||||
// Show the window
|
||||
|
|
|
@ -146,7 +146,8 @@ namespace EmuWindow
|
|||
{
|
||||
|
||||
HWND m_hWnd = NULL; // The new window that is created here
|
||||
HWND m_hParent = NULL; // The main CPanel
|
||||
HWND m_hParent = NULL;
|
||||
HWND m_hMain = NULL; // The main CPanel
|
||||
|
||||
HINSTANCE m_hInstance = NULL;
|
||||
WNDCLASSEX wndClass;
|
||||
|
@ -243,16 +244,10 @@ void OnKeyDown(WPARAM wParam)
|
|||
switch (LOWORD( wParam ))
|
||||
{
|
||||
case VK_ESCAPE:
|
||||
if (g_Config.bFullscreen && !g_Config.RenderToMainframe)
|
||||
if (!g_Config.RenderToMainframe)
|
||||
{
|
||||
// Pressing Esc switch to Windowed in Fullscreen mode
|
||||
ToggleFullscreen(m_hWnd);
|
||||
return;
|
||||
}
|
||||
else if (!g_Config.RenderToMainframe)
|
||||
{
|
||||
// And stops the emulation when already in Windowed mode
|
||||
PostMessage(m_hParent, WM_USER, OPENGL_WM_USER_STOP, 0);
|
||||
// Pressing Esc stops the emulation
|
||||
SendMessage( m_hWnd, WM_CLOSE, 0, 0 );
|
||||
}
|
||||
break;
|
||||
case '3': // OSD keys
|
||||
|
@ -275,7 +270,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|||
switch (iMsg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
PostMessage((HWND)g_VideoInitialize.pWindowHandle, WM_USER, OPENGL_WM_USER_CREATE, (int)m_hParent);
|
||||
PostMessage(m_hMain, WM_USER, WM_USER_CREATE, g_Config.RenderToMainframe);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
|
@ -325,7 +320,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|||
it's nessesary for both the child window and separate rendering window because
|
||||
moves over the rendering window do not reach the main program then. */
|
||||
if (GetParentWnd() == NULL) { // Separate rendering window
|
||||
PostMessage(m_hParent, iMsg, wParam, -1);
|
||||
PostMessage(m_hMain, iMsg, wParam, -1);
|
||||
SetCursor(hCursor);
|
||||
}
|
||||
else
|
||||
|
@ -336,14 +331,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|||
only let it pass through Dolphin > Frame.cpp to determine if it should be on or off
|
||||
and coordinate it with the other settings if nessesary */
|
||||
case WM_USER:
|
||||
if (wParam == OPENGL_WM_USER_STOP)
|
||||
if (wParam == WM_USER_STOP)
|
||||
{
|
||||
if (lParam)
|
||||
SetCursor(hCursor);
|
||||
else
|
||||
SetCursor(hCursorBlank);
|
||||
}
|
||||
if (wParam == OPENGL_WM_USER_KEYDOWN)
|
||||
if (wParam == WM_USER_KEYDOWN)
|
||||
OnKeyDown(lParam);
|
||||
if (wParam == TOGGLE_FULLSCREEN)
|
||||
ToggleFullscreen(m_hWnd);
|
||||
|
@ -353,8 +348,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_CLOSE:
|
||||
if (m_hParent == NULL)
|
||||
{
|
||||
// Simple hack to easily exit without stopping. Hope to fix the stopping errors soon.
|
||||
ExitProcess(0);
|
||||
// Take it out of fullscreen and stop the game
|
||||
if( g_Config.bFullscreen )
|
||||
ToggleFullscreen(m_hParent);
|
||||
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -405,16 +402,16 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||
CreateCursors(m_hInstance);
|
||||
|
||||
// Create child window
|
||||
if (parent)
|
||||
if (g_Config.RenderToMainframe)
|
||||
{
|
||||
m_hParent = parent;
|
||||
m_hParent = m_hMain = parent;
|
||||
|
||||
m_hWnd = CreateWindow(m_szClassName, title,
|
||||
WS_CHILD,
|
||||
m_hWnd = CreateWindowEx(0, m_szClassName, title, WS_CHILD,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
parent, NULL, hInstance, NULL);
|
||||
|
||||
ShowWindow(m_hWnd, SW_SHOWMAXIMIZED);
|
||||
/*if( !g_Config.bFullscreen )
|
||||
SetWindowPos( GetParent(m_hParent), NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER );*/
|
||||
}
|
||||
|
||||
// Create new separate window
|
||||
|
@ -424,6 +421,7 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||
// render to main, stop, then render to separate window, as the GUI will still
|
||||
// think we're rendering to main because m_hParent will still contain the old HWND...
|
||||
m_hParent = NULL;
|
||||
m_hMain = parent;
|
||||
|
||||
DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
|
||||
|
||||
|
@ -438,13 +436,9 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||
rc.top = (1024 - h)/2;
|
||||
rc.bottom = rc.top + h;
|
||||
|
||||
m_hWnd = CreateWindow(m_szClassName, title,
|
||||
style,
|
||||
m_hWnd = CreateWindowEx(0, m_szClassName, title, style,
|
||||
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
|
||||
parent, NULL, hInstance, NULL );
|
||||
|
||||
g_winstyle = GetWindowLong( m_hWnd, GWL_STYLE );
|
||||
g_winstyle &= ~WS_MAXIMIZE & ~WS_MINIMIZE; // remove minimize/maximize style
|
||||
NULL, NULL, hInstance, NULL);
|
||||
}
|
||||
|
||||
return m_hWnd;
|
||||
|
@ -539,7 +533,9 @@ void Show()
|
|||
|
||||
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title)
|
||||
{
|
||||
return OpenWindow(hParent, hInstance, 640, 480, title);
|
||||
int width=640, height=480;
|
||||
sscanf( g_Config.bFullscreen ? g_Config.cFSResolution : g_Config.cInternalRes, "%dx%d", &width, &height );
|
||||
return OpenWindow(hParent, hInstance, width, height, title);
|
||||
}
|
||||
|
||||
void Close()
|
||||
|
@ -554,7 +550,8 @@ void Close()
|
|||
void SetSize(int width, int height)
|
||||
{
|
||||
RECT rc = {0, 0, width, height};
|
||||
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false);
|
||||
DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE);
|
||||
AdjustWindowRect(&rc, dwStyle, false);
|
||||
|
||||
int w = rc.right - rc.left;
|
||||
int h = rc.bottom - rc.top;
|
||||
|
|
|
@ -129,7 +129,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
switch( iMsg )
|
||||
{
|
||||
case WM_CREATE:
|
||||
PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_CREATE, (int)m_hParent);
|
||||
PostMessage(m_hMain, WM_USER, WM_USER_CREATE, (int)m_hParent);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
|
@ -164,7 +164,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
else if (!g_Config.renderToMainframe)
|
||||
{
|
||||
// And stops the emulation when already in Windowed mode
|
||||
PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_STOP, 0);
|
||||
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue