mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-29 13:28:04 +00:00
Fixed the GadgetWindow AlwaysOnTop option (could be lost by tracking "Show Desktop" events even when AlwaysOnTop = true).
This commit is contained in:
parent
4054b2d9fb
commit
92a7f77851
@ -226,13 +226,16 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
NativeMethods.SetWindowPos(Handle, IntPtr.Zero, 0, 0, 0, 0,
|
NativeMethods.SetWindowPos(Handle, IntPtr.Zero, 0, 0, 0, 0,
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER |
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER |
|
||||||
(value ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
|
(value ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
|
||||||
if (value)
|
if (value) {
|
||||||
|
if (!alwaysOnTop)
|
||||||
ShowDesktop.Instance.ShowDesktopChanged += ShowDesktopChanged;
|
ShowDesktop.Instance.ShowDesktopChanged += ShowDesktopChanged;
|
||||||
else
|
} else {
|
||||||
|
if (!alwaysOnTop)
|
||||||
ShowDesktop.Instance.ShowDesktopChanged -= ShowDesktopChanged;
|
ShowDesktop.Instance.ShowDesktopChanged -= ShowDesktopChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if locked, the window can not be moved
|
// if locked, the window can not be moved
|
||||||
public bool LockPosition {
|
public bool LockPosition {
|
||||||
@ -252,10 +255,12 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
if (value != alwaysOnTop) {
|
if (value != alwaysOnTop) {
|
||||||
alwaysOnTop = value;
|
alwaysOnTop = value;
|
||||||
if (alwaysOnTop) {
|
if (alwaysOnTop) {
|
||||||
|
if (visible)
|
||||||
ShowDesktop.Instance.ShowDesktopChanged -= ShowDesktopChanged;
|
ShowDesktop.Instance.ShowDesktopChanged -= ShowDesktopChanged;
|
||||||
MoveToTopMost(Handle);
|
MoveToTopMost(Handle);
|
||||||
} else {
|
} else {
|
||||||
MoveToBottom(Handle);
|
MoveToBottom(Handle);
|
||||||
|
if (visible)
|
||||||
ShowDesktop.Instance.ShowDesktopChanged += ShowDesktopChanged;
|
ShowDesktop.Instance.ShowDesktopChanged += ShowDesktopChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user