Fix showing autohidden taskbar with maximized window
This commit is contained in:
parent
1916823c98
commit
86e141272a
1 changed files with 38 additions and 0 deletions
|
|
@ -33,6 +33,35 @@ bool IsCompositionEnabled() {
|
|||
return success && result;
|
||||
}
|
||||
|
||||
bool IsTaskbarAutoHidden(PUINT pEdge = nullptr) {
|
||||
HWND hTaskbar = FindWindowW(L"Shell_TrayWnd", nullptr);
|
||||
if (!hTaskbar) {
|
||||
if (pEdge) {
|
||||
*pEdge = (UINT)-1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
APPBARDATA state = {sizeof(state), hTaskbar};
|
||||
APPBARDATA pos = {sizeof(pos), hTaskbar};
|
||||
|
||||
LRESULT lState = SHAppBarMessage(ABM_GETSTATE, &state);
|
||||
bool bAutoHidden = (lState & ABS_AUTOHIDE);
|
||||
|
||||
if (SHAppBarMessage(ABM_GETTASKBARPOS, &pos)) {
|
||||
if (pEdge) {
|
||||
*pEdge = pos.uEdge;
|
||||
}
|
||||
} else {
|
||||
Unexpected("Failed to get taskbar pos");
|
||||
if (pEdge) {
|
||||
*pEdge = ABE_BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
return bAutoHidden;
|
||||
}
|
||||
|
||||
HRESULT WinApiSetWindowTheme(
|
||||
HWND hWnd,
|
||||
LPCWSTR pszSubAppName,
|
||||
|
|
@ -236,6 +265,15 @@ bool WindowHelper::handleNativeEvent(
|
|||
mi.cbSize = sizeof(mi);
|
||||
if (GetMonitorInfo(hMonitor, &mi)) {
|
||||
*r = mi.rcWork;
|
||||
UINT uEdge = (UINT)-1;
|
||||
if (IsTaskbarAutoHidden(&uEdge)) {
|
||||
switch (uEdge) {
|
||||
case ABE_LEFT: r->left += 1; break;
|
||||
case ABE_RIGHT: r->right -= 1; break;
|
||||
case ABE_TOP: r->top += 1; break;
|
||||
case ABE_BOTTOM: r->bottom -= 1; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue