+Search dialog: wrong maximized wnd placement

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

GunSmoker
Junior Member
Junior Member
Posts: 3
Joined: 2009-06-28, 16:08 UTC

+Search dialog: wrong maximized wnd placement

Post by *GunSmoker »

1. Unlock taskbar.
2. Move taskbar to the left vertical side of the Desktop. So, Start button should be in top-left corner of the screen, taskbar should occupy left side.
3. Lock taskbar.
4. Launch Total Commander and maximize it.
5. Open file search (Alt + F7). File search dialog should be empty/collapsed (i.e. there is no "Search Results" visible).
6. Maximize search dialog (if it is not maximized yet).

Expected: [so-called proper position] search dialog will be aligned to the right of the taskbar, so its left-top coords will be (X, 0), where X > 0.
Actual: [so-called wrong position] search dialog will be aligned to the top-left corner of the screen, so search dialog will be overlapped by taskbar window. I.e. left-top coords will be (0, 0).

7. Run any search.
8. Let search dialog expand with search results.
9. Notice that search dialog window will immediately resize itself to a proper position - even though you didn't move it by yourself, and you didn't change window's state.

10. Click on "New search" button.
11. Window will collapse, but remain in the proper position.
12. Normalize and maximize search dialog.
13. Search dialog is now in the wrong position again.

P.S. Could it be that this bug is caused by wrong usage of SetWindowPos instead of SetWindowPlacement?
SetWindowPos position a window by using absolute screen coordinates - which is (0, 0) for top-left corner (0, 0).
SetWindowPlacement position a window by using relative workspace coordinates (i.e. it takes the locations and sizes of application toolbars (including the taskbar) into account) - which is (X, 0) for top-left corner (0, 0), where X > 0. SetWindowPlacement also auto-corrects window pos/size if target window will be placed off-monitor.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I will try to reproduce it, thanks for your report.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I have just tried this on Windows 7, but I cannot reproduce it. I tried with TC 32-bit and 64-bit, and before and after starting a search in the search dialog - the dialog never resized below the task bar on the left.

Some questions:
1. Which Windows version do you use?
2. How exactly do you resize the dialog? I tried by double clicking on the title bar, by clicking on the maximize button, and by dragging the title bar to the top of the screen.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Can anyone else reproduce this problem? I can't - maybe it depends on specific settings?
Author of Total Commander
https://www.ghisler.com
Henrie
Member
Member
Posts: 194
Joined: 2006-09-03, 23:12 UTC
Location: Volkel, the Netherlands

Post by *Henrie »

I could reproduce the problem.

I followed the steps as described by GunSmoker.
After testing GunSmoker 's scenario I tried with my own configuration with the taskbar at the top. It then only shows the misplaced search dialog at first start. At step 13 it does not show displace.

I posted a video of my tries here http://youtu.be/YV4OkaR8p9k

Edit:
I just saw the youtube video and it is low quality. Here is a better quality (MP4 H264 1920*1200) to download http://www.filesnack.com/files/cdhp81to
My apologies for the big screen dimensions but this problem requires a full screen video. I have a 1920x1200 screen.

I would not be surprised if this is a Windows bug. I have some more programs that display their window behind the taskbar when I have locked it at the top of my screen.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for the video - it seems that it's a Windows 8 problem. I could reproduce it on Windows 8 only, and also with Delphi and Lazarus when maximizing the top window with the menu bar. It seems that Windows 8 fails to correctly maximize a window when it doesn't have the full height (restricted via WM_GETMINMAXINFO). The only solution seems to be to fully maximize the dialog, then resize it to the desired height.
Author of Total Commander
https://www.ghisler.com
Henrie
Member
Member
Posts: 194
Joined: 2006-09-03, 23:12 UTC
Location: Volkel, the Netherlands

Post by *Henrie »

My video capture was done on my system with Windows 7 Home Premium. I used Total Commander (x64) 8.50B3.
So not only on Windows 8.

And yes, resizing makes the window move the right position. I usually do it by pulling a window border (if possible).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, cannot reproduce on Windows 7. Maybe it needs special settings? For now I have added a fix for Windows 8 only.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

If you use Windows 8, please test my fix with beta 4! If you use Windows 7 or earlier and have this problem (I don't), then please try to find out what is causing it!
Author of Total Commander
https://www.ghisler.com
Henrie
Member
Member
Posts: 194
Joined: 2006-09-03, 23:12 UTC
Location: Volkel, the Netherlands

Post by *Henrie »

I can not reproduce it anymore with tc850x32_64_b3. Also not with the new tc850x32_64_b4 on my Windows Home Premium.
But because i can not reproduce it anymore with tc850x32_64_b3 this does not mean that is fixed with tc850x32_64_b4 on windows 7.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

OK, please let me know when it happens again. Maybe you can find out what is causing it.
Author of Total Commander
https://www.ghisler.com
Henrie
Member
Member
Posts: 194
Joined: 2006-09-03, 23:12 UTC
Location: Volkel, the Netherlands

Post by *Henrie »

I just tried it now again on tc850x32_64_b4 and could reproduce it. But after restarting TC I could not reproduce it again.
The only condition that changed is that I restarted TC? Weird.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

You must have done something inside TC which caused it to happen. Unfortunately it never happened here on Windows 7, so maybe you can find out what you were doing...
Author of Total Commander
https://www.ghisler.com
GunSmoker
Junior Member
Junior Member
Posts: 3
Joined: 2009-06-28, 16:08 UTC

Post by *GunSmoker »

Sorry, but fix in Beta 4 is not complete.

1. Open file search (Alt + F7) in maximized (and collapsed) state.

Expected: correct position.
Actual: Beta 3: wrong position; Beta 4: correct position (i.e. FIXED).

2. Restore search dialog to non-maximized position.
3. Maximize search dialog.

Expected: correct position.
Actual: Beta 3: wrong position; Beta 4: wrong position (NOT FIXED).

In other words, your fix seems to work only when opening already maximized search dialog. Fix does not work when maximizing window during work.

Yes, I'm using Windows 8, but I remember having this problem before (on WinVista/Win7). May be not so often, so I did not bother reporting. But it happens constantly on Win8.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The problem is that step 3 is handled entirely by Windows itself - I doubt that I can change this behaviour. :(
Author of Total Commander
https://www.ghisler.com
Post Reply