diff options
-rw-r--r-- | src/mir_app/src/srmm_util.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp index 43e90992eb..46726b478a 100644 --- a/src/mir_app/src/srmm_util.cpp +++ b/src/mir_app/src/srmm_util.cpp @@ -93,6 +93,17 @@ MIR_APP_DLL(CMsgDialog*) Srmm_FindDialog(MCONTACT hContact) /////////////////////////////////////////////////////////////////////////////////////////
+static HWND GetContainer(HWND hwnd)
+{
+ while (true) {
+ HWND hwndParent = GetParent(hwnd);
+ if (hwndParent == nullptr)
+ return hwnd;
+
+ hwnd = hwndParent;
+ }
+}
+
MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd)
{
if (hContact == 0)
@@ -107,7 +118,9 @@ MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd) mwd.uState = MSG_WINDOW_STATE_EXISTS;
if (IsWindowVisible(hwnd))
mwd.uState |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == hwnd || GetForegroundWindow() == GetParent(hwnd))
+
+ HWND hwndFocused = GetForegroundWindow();
+ if (hwndFocused == hwnd || hwndFocused == GetContainer(hwnd))
mwd.uState |= MSG_WINDOW_STATE_FOCUS;
if (IsIconic(hwnd))
mwd.uState |= MSG_WINDOW_STATE_ICONIC;
|