mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed an issue that AlwaysOnTop=-1/-2 fails on startup.
This commit is contained in:
parent
2186b2eb2a
commit
78cb8b2543
@ -536,19 +536,18 @@ void CMeterWindow::MoveWindow(int x, int y)
|
||||
*/
|
||||
void CMeterWindow::ChangeZPos(ZPOSITION zPos, bool all)
|
||||
{
|
||||
#define ZPOS_FLAGS (SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING)
|
||||
|
||||
if(!m_ChildWindow)
|
||||
{
|
||||
m_WindowZPosition = zPos;
|
||||
|
||||
HWND winPos = HWND_NOTOPMOST;
|
||||
UINT flags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING;
|
||||
m_WindowZPosition = zPos;
|
||||
|
||||
switch (zPos)
|
||||
{
|
||||
case ZPOSITION_ONTOPMOST:
|
||||
case ZPOSITION_ONTOP:
|
||||
winPos = HWND_TOPMOST;
|
||||
flags |= SWP_NOOWNERZORDER;
|
||||
break;
|
||||
|
||||
case ZPOSITION_ONBOTTOM:
|
||||
@ -574,15 +573,13 @@ void CMeterWindow::ChangeZPos(ZPOSITION zPos, bool all)
|
||||
case ZPOSITION_ONDESKTOP:
|
||||
if (CSystem::GetShowDesktop())
|
||||
{
|
||||
flags |= SWP_NOOWNERZORDER;
|
||||
|
||||
// Set WS_EX_TOPMOST flag
|
||||
SetWindowPos(m_Window, HWND_TOPMOST, 0, 0, 0, 0, flags);
|
||||
SetWindowPos(m_Window, HWND_TOPMOST, 0, 0, 0, 0, ZPOS_FLAGS);
|
||||
|
||||
if (all)
|
||||
{
|
||||
// Insert after the helper window
|
||||
SetWindowPos(m_Window, CSystem::GetHelperWindow(), 0, 0, 0, 0, flags);
|
||||
SetWindowPos(m_Window, CSystem::GetHelperWindow(), 0, 0, 0, 0, ZPOS_FLAGS);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -593,7 +590,7 @@ void CMeterWindow::ChangeZPos(ZPOSITION zPos, bool all)
|
||||
if (GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
|
||||
{
|
||||
// Insert after the found window
|
||||
if (0 != SetWindowPos(m_Window, hwnd, 0, 0, 0, 0, flags))
|
||||
if (0 != SetWindowPos(m_Window, hwnd, 0, 0, 0, 0, ZPOS_FLAGS))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -617,7 +614,7 @@ void CMeterWindow::ChangeZPos(ZPOSITION zPos, bool all)
|
||||
break;
|
||||
}
|
||||
|
||||
SetWindowPos(m_Window, winPos, 0, 0, 0, 0, flags);
|
||||
SetWindowPos(m_Window, winPos, 0, 0, 0, 0, ZPOS_FLAGS);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user