File name column width on RDP reconnect

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

browny
Senior Member
Senior Member
Posts: 287
Joined: 2007-09-10, 13:19 UTC

File name column width on RDP reconnect

Post by *browny »

TC 10.51 64-bit and earlier, running on Windows Server 2019.
Connect to the server using RDP.
The whole TC's window is about 800 by 600, brief file list format; there are no tab headers and no dividing vertical lines.
Hence long file names usually were displayed in one column.
But on RDP session disconnect and re-connect these long file names were truncated to about one third of file pane width (with ellipsis).
As if TC uses default three columns for brief format.
It is sufficient to switch tabs on the same side of TC to show long names normally.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: File name column width on RDP reconnect

Post by *ghisler(Author) »

This happens because RDP seems to resize its window during connection. Try choosing Configuration - "Save position" manually, which should allow TC to restore the tabs after such a resize. Unfortunately there isn't much else you can do to fix this behaviour, sorry.
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 287
Joined: 2007-09-10, 13:19 UTC

Re: File name column width on RDP reconnect

Post by *browny »

In my configuration panel size, panel tabs and window position are not save automatically. All this was saved manually in Save Position and Save Settings a long time ago; and apparently it does not help.
If TC was minimized to task bar, after reconnect the file names were long in restored window.
Should there be WM_DISPLAYCHANGE event to signal about resized desktop?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: File name column width on RDP reconnect

Post by *ghisler(Author) »

Have you tried saving the position again with TC 10.51?
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 287
Joined: 2007-09-10, 13:19 UTC

Re: File name column width on RDP reconnect

Post by *browny »

I tried now, and names column is still narrow.
By the way, I rechecked with TC minimized to taskbar, and names are getting short on reconnect too.
The issue is present for normal and minimized windows, except minimizing to system area.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: File name column width on RDP reconnect

Post by *ghisler(Author) »

Seems like TC doesn't get sent a WM_DISPLAYCHANGE message, so it doesn't adjust its columns.
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 287
Joined: 2007-09-10, 13:19 UTC

Re: File name column width on RDP reconnect

Post by *browny »

This was logged with MS Spy++ 64-bit on the main TC's window

Code: Select all

<000179> 00000000000A032A S WM_DISPLAYCHANGE cBitsPerPixel:32 cxScreen:1280 cyScreen:1024
<000180> 00000000000A032A R WM_DISPLAYCHANGE
<000181> 00000000000A032A S WM_SYSCOLORCHANGE
<000182> 00000000000A032A R WM_SYSCOLORCHANGE
<000183> 00000000000A032A P WM_DWMCOLORIZATIONCOLORCHANGED clrNew:E3006FC7 fBlended:True
<000184> 00000000000A032A P WM_WTSSESSION_CHANGE nStatusCode:WTS_SESSION_UNLOCK nSessionID:2
<000185> 00000000000A032A P message:0x052C [User-defined:WM_USER+300] wParam:00000020 lParam:04000500
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: File name column width on RDP reconnect

Post by *ghisler(Author) »

Unfortunately I don't know what else could be wrong. I can only test RDP with Windows 10 Pro as the target (on which Server 2019 is based), and there are no problems. Even if I set a custom size for the remote desktop in the RDP connect dialog, the Total Commander window is resized just fine.

The only solution I see here would be to close and re-open Total Commander. If you can wait a few days for Total Commander 10.52 final, it will have a new command
CM_EXIT 1
which you can put on a button to restart the program.
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 287
Joined: 2007-09-10, 13:19 UTC

Re: File name column width on RDP reconnect

Post by *browny »

Clicking on a different tab header and returning back to the original tab is an easier "fix".

Have you tried logging events after reconnect?
Once upon a time I had issues with display of bottom line in list control.
Logging uncovered the weird fact, that smooth scrolling was implemented in Windows "twice", having two independent setting to turn it on and off. Processing the right event and making adjustment at the right time fixed the problem.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: File name column width on RDP reconnect

Post by *ghisler(Author) »

I don't see any problems also when I manually disconnect and reconnect. But this is probably because the target is a PC (either my laptop or a virtual machine) with a real screen size. My guess is that when you disconnect, there is no screen to revert to, so it sets a very small dummy screen size (e.g. 640x480).
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 287
Joined: 2007-09-10, 13:19 UTC

Re: File name column width on RDP reconnect

Post by *browny »

ghisler(Author) wrote: 2022-10-20, 15:32 UTC I don't see any problems also when I manually disconnect and reconnect. But this is probably because the target is a PC (either my laptop or a virtual machine) with a real screen size.
The problem could be seen always in my case.
RDP usually disregards real or virtual screen size on a remote server and uses screen settings of the connecting client.
ghisler(Author) wrote: 2022-10-20, 15:32 UTCMy guess is that when you disconnect, there is no screen to revert to, so it sets a very small dummy screen size (e.g. 640x480).
There is only one WM_DISPLAYCHANGE event in the log; and it gives the correct screen size. Processing this event is necessary for an application with DPI awareness.
My guess would be that forced resizing of TC on received WM_DISPLAYCHANGE event should do the trick.
At least, tab flipping manages to get the right size for display.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: File name column width on RDP reconnect

Post by *ghisler(Author) »

Well, Total Commander does react to WM_DISPLAYCHANGE - maybe you can try sending this message manually (e.g. via AutoHotkey) and see what happens?
https://www.autohotkey.com/docs/commands/PostMessage.htm
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 287
Joined: 2007-09-10, 13:19 UTC

Re: File name column width on RDP reconnect

Post by *browny »

ghisler(Author) wrote: 2022-10-18, 12:40 UTC Seems like TC doesn't get sent a WM_DISPLAYCHANGE message, so it doesn't adjust its columns.
How to match this with the offer to send a message manually?
The message was logged, so it surely had been sent (but should have been processed in a different message loop, maybe?)

By the way, Windows 10 Enterprise 22H2 32-bit and TC - the issue is present.
It seems that file count should be small enough to fit into one panel height; for larger directory if was fine somehow - this was rechecked twice.
What's more, on reconnect I first saw long names, and then it got repainted with truncated ones (many thanks to slow processsor and video). 17 files and double dots in the pane.
browny
Senior Member
Senior Member
Posts: 287
Joined: 2007-09-10, 13:19 UTC

Re: File name column width on RDP reconnect

Post by *browny »

Tested with TC 10.52 64-bit and AutoHotkey
TC window is 911x686, font Segoe 10 and usually it has 2 columns, screen parameters could be seen above in logged WM_DISPLAYCHANGE.
This setting allows about 25 files or directoris to be displayed in one column; 22 was in my case.

WM_DISPLAYCHANGE redraws the window and forces truncation of long names in both left and right panels.
For example, Windows-classic-samples-master.zip becomes Windows-classic-samples-mast..; directory names got truncated too.
Going to a different tab on the same side and back or changing directory in the same panel reverts to non-truncated names.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: File name column width on RDP reconnect

Post by *ghisler(Author) »

Did you send the right screen size in lparam?
https://learn.microsoft.com/en-us/windows/win32/gdi/wm-displaychange
Author of Total Commander
https://www.ghisler.com
Post Reply