Permalink
Browse files

Windows: Track minimize as lost focus.

It makes sense if we have the other feature.  Fixes #9918.
  • Loading branch information...
unknownbrackets committed Dec 25, 2017
1 parent 9b909b4 commit 8c1c0e1897165e7882a5d9d539caf93345726d9b
Showing with 12 additions and 2 deletions.
  1. +12 −2 Windows/MainWindow.cpp
View
@@ -116,6 +116,7 @@ namespace MainWindow
static bool g_IgnoreWM_SIZE = false;
static bool inFullscreenResize = false;
static bool inResizeMove = false;
static bool hasFocus = true;
// gross hack
bool noFocusPause = false; // TOGGLE_PAUSE state to override pause on lost focus
@@ -379,6 +380,7 @@ namespace MainWindow
void Minimize() {
ShowWindow(hwndMain, SW_MINIMIZE);
InputDevice::LoseFocus();
}
RECT DetermineWindowRectangle() {
@@ -688,7 +690,9 @@ namespace MainWindow
bool pause = true;
if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) {
WindowsRawInput::GainFocus();
InputDevice::GainFocus();
if (!IsIconic(GetHWND())) {
InputDevice::GainFocus();
}
g_activeWindow = WINDOW_MAINWINDOW;
pause = false;
}
@@ -701,14 +705,16 @@ namespace MainWindow
}
}
if (wParam == WA_ACTIVE) {
if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) {
NativeMessageReceived("got_focus", "");
hasFocus = true;
trapMouse = true;
}
if (wParam == WA_INACTIVE) {
NativeMessageReceived("lost_focus", "");
WindowsRawInput::LoseFocus();
InputDevice::LoseFocus();
hasFocus = false;
trapMouse = false;
}
}
@@ -740,13 +746,17 @@ namespace MainWindow
} else if (!inResizeMove) {
HandleSizeChange(wParam);
}
if (hasFocus) {
InputDevice::GainFocus();
}
break;
case SIZE_MINIMIZED:
Core_NotifyWindowHidden(true);
if (!g_Config.bPauseWhenMinimized) {
NativeMessageReceived("window minimized", "true");
}
InputDevice::LoseFocus();
break;
default:
break;

0 comments on commit 8c1c0e1

Please sign in to comment.