mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 13:05:38 +02:00
(unsuccessful) attempt to restore window to specified virtual desktop
This commit is contained in:
parent
523bf1d1d3
commit
c5ef467e9c
2 changed files with 27 additions and 2 deletions
|
@ -1976,7 +1976,7 @@ namespace PersistentWindows.Common
|
|||
}
|
||||
}
|
||||
|
||||
if (vd.Enabled())
|
||||
if (vd.Enabled() && IsTopLevelWindow(hWnd))
|
||||
{
|
||||
curDisplayMetrics.Guid = vd.GetWindowDesktopId(hWnd);
|
||||
}
|
||||
|
@ -2368,6 +2368,19 @@ namespace PersistentWindows.Common
|
|||
moved = true;
|
||||
}
|
||||
|
||||
if (restoringFromDB)
|
||||
{
|
||||
if (vd.Enabled() && IsTopLevelWindow(hwnd))
|
||||
{
|
||||
Guid curVd = vd.GetWindowDesktopId(hwnd);
|
||||
if (curVd != Guid.Empty && prevDisplayMetrics.Guid != Guid.Empty)
|
||||
{
|
||||
if (curVd != prevDisplayMetrics.Guid)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fixZorder > 0)
|
||||
{
|
||||
if (prevDisplayMetrics.IsTopMost != curDisplayMetrics.IsTopMost)
|
||||
|
@ -3037,6 +3050,18 @@ namespace PersistentWindows.Common
|
|||
continue;
|
||||
}
|
||||
|
||||
if (restoringFromDB)
|
||||
{
|
||||
if (vd.Enabled() && IsTopLevelWindow(hWnd))
|
||||
{
|
||||
Guid curVd = vd.GetWindowDesktopId(hWnd);
|
||||
if (curVd != Guid.Empty && prevDisplayMetrics.Guid != Guid.Empty)
|
||||
{
|
||||
if (curVd != prevDisplayMetrics.Guid)
|
||||
vd.MoveWindowToDesktop(hWnd, prevDisplayMetrics.Guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
RECT rect = prevDisplayMetrics.ScreenPosition;
|
||||
WindowPlacement windowPlacement = prevDisplayMetrics.WindowPlacement;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace PersistentWindows.Common
|
|||
if (hr != 0)
|
||||
{
|
||||
//Marshal.ThrowExceptionForHR(hr);
|
||||
Log.Error("GetWindowDesktopId() call failed");
|
||||
//Log.Error("GetWindowDesktopId() call failed");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue