Merge pull request #1937 from unknownbrackets/windows-ui

Fix cursor reset and pop ups in fullscreen
This commit is contained in:
Henrik Rydgård 2013-05-26 15:11:23 -07:00
commit 66129b69e8

View File

@ -62,6 +62,7 @@ namespace MainWindow
static HMENU menu;
static HINSTANCE hInst;
static int cursorCounter = 0;
//W32Util::LayeredWindow *layer;
#define MAX_LOADSTRING 100
@ -177,6 +178,19 @@ namespace MainWindow
ResizeDisplay();
}
void CorrectCursor() {
if (g_bFullScreen && globalUIState == UISTATE_INGAME) {
while (cursorCounter >= 0) {
cursorCounter = ShowCursor(FALSE);
}
} else {
if (cursorCounter < 0) {
cursorCounter = ShowCursor(TRUE);
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
}
}
void setTexScalingLevel(int num) {
g_Config.iTexScalingLevel = num;
if(gpu) gpu->ClearCacheNextFrame();
@ -393,12 +407,7 @@ namespace MainWindow
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);
} else {
ShowCursor(TRUE);
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
CorrectCursor();
SetTimer(hWnd, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0);
return 0;
@ -1472,9 +1481,6 @@ namespace MainWindow
void _ViewNormal(HWND hWnd)
{
ShowCursor(TRUE);
SetCursor(LoadCursor(NULL, IDC_ARROW));
// put caption and border styles back
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME;
@ -1493,14 +1499,13 @@ namespace MainWindow
// reset full screen indicator
g_bFullScreen = FALSE;
CorrectCursor();
ResizeDisplay();
ShowOwnedPopups(hwndMain, TRUE);
}
void _ViewFullScreen(HWND hWnd)
{
if (globalUIState == UISTATE_INGAME)
ShowCursor(FALSE);
// keep in mind normal window rectangle
::GetWindowRect(hWnd, &g_normalRC);
@ -1522,7 +1527,9 @@ namespace MainWindow
// set full screen indicator
g_bFullScreen = TRUE;
CorrectCursor();
ResizeDisplay();
ShowOwnedPopups(hwndMain, FALSE);
}
void SetPlaying(const char *text)