When I reconnect to my remote session, Total Commander windows on non-primary monitors tend to jump and change size.
To be more specific, here's an experiment:
- I have 3 monitors connected to my local system. The monitor2 is in the center, this is the Windows "main monitor", and there's the Windows Taskbar on it.
- I connect to a remote system with the standard Windows RDP.
- Just in case, I open 1 TC instance, position it in the lower-half of the monitor1 (using the AHK script below)(this could be reproduced manually, but the pixel-perfect positioning is painful). I click "Configuration->Save Position" close TC and then reopen to make sure it remembers the position. Then I close this TC.
- I open 6 TC instances, position them like this:
- upper-half of the monitor1
- lower-half of the monitor1
- upper-half of the monitor2
- lower-half of the monitor2
- upper-half of the monitor3
- lower-half of the monitor3
- I close my RDP session window
- Almost immediately, I reconnect to the same RDP session (nothing changed in the local monitor config)
- As a result:
- remains almost in place, but shrinks a bit - now there are small gaps in between the window and the monitor edges
- jumps to the upper half of the monitor1, exactly the same position as the previous window
- everything looks OK - the window is exactly where it was
- everything looks OK - the window is exactly where it was
- remains almost in place, but shrinks a bit - now there are small gaps in between the window and the monitor edges
- jumps to the upper half of the monitor3, exactly the same position as the previous window
- I tried few other scenarios.. But the behavior seem to be erratic and not always reproducible. I'm not really sure why. Maybe I'm missing something.
- I try to reproduce the same with "notepad.exe" windows, but they keep their positions perfectly.
My monitor config is as follows:
Code: Select all
PS C:\temp> Add-Type -AssemblyName System.Windows.Forms
PS C:\temp> [System.Windows.Forms.Screen]::AllScreens
BitsPerPixel : 32
Bounds : {X=0,Y=0,Width=3840,Height=2160}
DeviceName : \\.\DISPLAY5
Primary : True
WorkingArea : {X=0,Y=0,Width=3778,Height=2160}
BitsPerPixel : 32
Bounds : {X=-1200,Y=0,Width=1200,Height=1920}
DeviceName : \\.\DISPLAY7
Primary : False
WorkingArea : {X=-1200,Y=0,Width=1200,Height=1920}
BitsPerPixel : 32
Bounds : {X=3840,Y=0,Width=1200,Height=1920}
DeviceName : \\.\DISPLAY6
Primary : False
WorkingArea : {X=3840,Y=0,Width=1200,Height=1920}
Code: Select all
UpDownSnap(Direction)
{
; WinMaximize("A")
WinGetPos(&x, &y, &w, &h, "a", , ,)
monitorCount := MonitorGetCount()
refArea := 0
Loop monitorCount
{
MonitorGetWorkArea(A_Index, &mLeft, &mTop, &mRight, &mBottom)
xo := Max(0, Min(x + w, mRight) - Max(x, mLeft))
yo := Max(0, Min(y + h, mBottom) - Max(y, mTop))
; SysGet, m, MonitorWorkArea, %A_Index%
;xo := Max(0, Min(x + w, mRight) - Max(x, mLeft))
;yo := Max(0, Min(y + h, mBottom) - Max(y, mTop))
area := xo * yo
if (area > refArea)
{
monTop := mTop
monBottom := mBottom
monLeft := mLeft
monRight := mRight
refArea := area
}
}
; If the refArea is still equal to 0, the window does
; not overlap with any monitors. Wat?
if (refArea > 0)
{
; Need some "boder width" to compensate for invisible window boders, for all sides except top
; https://autohotkey.com/boards/viewtopic.php?p=87378#p87378
bw := 7
if (direction = 1)
newY := monTop
Else
newY := (monBottom - monTop) / 2 + monTop
WinMove(monLeft-bw, newY, (monRight - monLeft)+bw*2, (monBottom - monTop) / 2 + bw, "a")
; Log("Moving to x=" monLeft)
; Log("Moving to monTop=" monTop)
}
}
^#Up::UpDownSnap(1)
^#Down::UpDownSnap(0)