Windows Cursor fixes: Show mouse cursor in menu in fullscreen. Remove ClipCursor calls, not necessary.

This commit is contained in:
Henrik Rydgard
2013-05-04 23:21:51 +02:00
parent dfd07cd37c
commit d053d3c8b4
2 changed files with 21 additions and 4 deletions
+2
View File
@@ -18,6 +18,7 @@
#include "Core/Core.h"
#include "Core/Config.h"
#include "Core/CoreParameter.h"
#include "Core/System.h"
#include "EmuThread.h"
#include "DSoundStream.h"
#include "WindowsHost.h"
@@ -127,6 +128,7 @@ void WindowsHost::SetDebugMode(bool mode)
disasmWindow[i]->SetDebugMode(mode);
}
extern BOOL g_bFullScreen;
void WindowsHost::PollControllers(InputState &input_state)
{
+19 -4
View File
@@ -42,11 +42,12 @@
#define ENABLE_TOUCH 0
static BOOL g_bFullScreen = FALSE;
BOOL g_bFullScreen = FALSE;
static RECT g_normalRC = {0};
extern InputState input_state;
#define TIMER_CURSORUPDATE 1
#define CURSORUPDATE_INTERVAL_MS 500
extern unsigned short analog_ctrl_map[];
extern unsigned int key_pad_map[];
extern const char * getVirtualKeyName(unsigned char key);
@@ -200,6 +201,7 @@ namespace MainWindow
hwndMain = CreateWindowEx(0,szWindowClass, "", style,
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInstance, NULL);
SetTimer(hwndMain, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0);
SetPlaying(0);
if (!hwndMain)
return FALSE;
@@ -233,6 +235,7 @@ namespace MainWindow
#endif
SetFocus(hwndMain);
SetFocus(hwndDisplay);
return TRUE;
}
@@ -388,6 +391,18 @@ namespace MainWindow
ResizeDisplay();
break;
case WM_TIMER:
// Hack: Take the opportunity to also show/hide the mouse cursor in fullscreen mode.
if (g_bFullScreen && globalUIState == UISTATE_INGAME) {
ShowCursor(FALSE);
SetCursor(0);
} else {
ShowCursor(TRUE);
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
SetTimer(hWnd, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0);
return 0;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
@@ -1112,7 +1127,7 @@ namespace MainWindow
{
ShowCursor(TRUE);
SetCursor(LoadCursor(NULL, IDC_ARROW));
ClipCursor(NULL);
// put caption and border styles back
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME;
@@ -1138,7 +1153,7 @@ namespace MainWindow
{
ShowCursor(FALSE);
SetCursor(NULL);
ClipCursor(&g_normalRC);
// keep in mind normal window rectangle
::GetWindowRect(hWnd, &g_normalRC);