Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[TC 8.0b20 x64] Changing themes cuses problems with menu bar

 
Post new topic   Reply to topic    Total Commander Forum Index -> TC Fixed bugs Printable version
View previous topic :: View next topic  
Author Message
umbra
Power Member
Power Member


Joined: 14 Jan 2012
Posts: 655

PostPosted: Mon Feb 20, 2012 4:35 am    Post subject: [TC 8.0b20 x64] Changing themes cuses problems with menu bar Reply with quote

This is probably an edge-case but whatever.

  1. Switch to Classic Windows theme
  2. Start TC8.0b20 x64
  3. Switch to Aero theme
  4. Switch to Classic Windows theme again

After step 3 there will be a redraw error in the menu (the white rectangle in the picture), but it will disappear if you move focus to TC's window. But after step 4, buttons in menu bar will shrink and it stays that way until you restart TC or switch back to Aero.
Image: http://i1057.photobucket.com/albums/t399/uumbra8/TC/bugs/changetheme.jpg

BTW, TCx32 makes funny colors during these changes but it always ends up in a correct state after a second or two.
_________________
Windows 7 Pro x64, Windows 8 Pro x64
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 24590
Location: Switzerland

PostPosted: Mon Feb 20, 2012 8:33 am    Post subject: Reply with quote

Indeed you need to restart the 64bit version after such changes, sorry. It's a problem somewhere deep in Lazarus, I don't have the time to debug that in detail. I will make a short check, but cannot promise anything.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 24590
Location: Switzerland

PostPosted: Wed Feb 22, 2012 11:10 am    Post subject: Reply with quote

Unfortunately I could not reproduce the problem. I tried with my own settings and with a fresh ini, and with beta 20, 15 and 10 (all 64-bit), no problem at all. It may be a timing problem on your system, e.g. TC gets the notification when the new theme isn't active yet. Or maybe it's a problem with your settings. Do you get this also with a fresh wincmd.ini?
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
umbra
Power Member
Power Member


Joined: 14 Jan 2012
Posts: 655

PostPosted: Thu Feb 23, 2012 9:58 am    Post subject: Reply with quote

Here is a screen-capture so you can see what I mean: video

There is TCx32, TCx64 and Notepad (for reference). Also I always test with clean ini.
Quote:
It may be a timing problem on your system

It is possible, because when I repeated it over 20 times, three or four times the error did not happen. Hard to tell why - as far as I can remember, every time I repeated the same steps.
However this applies only to the shrunk menu in TCx64. The other redraw errors happened every time.
_________________
Windows 7 Pro x64, Windows 8 Pro x64
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 24590
Location: Switzerland

PostPosted: Fri Feb 24, 2012 5:51 am    Post subject: Reply with quote

Unfortunately I could not reproduce the problem so far. I'm surprised that you can switch themes so quickly, here it takes about half a minute...
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
M0rpheuss
Junior Member
Junior Member


Joined: 15 Aug 2009
Posts: 9

PostPosted: Fri Feb 24, 2012 1:49 pm    Post subject: Reply with quote

I can reproduce this. The redraw error also occurs if I change the screen resolution.
Back to top
View user's profile Send private message
umbra
Power Member
Power Member


Joined: 14 Jan 2012
Posts: 655

PostPosted: Fri Feb 24, 2012 2:45 pm    Post subject: Reply with quote

Hmm, when I tried to reproduce it in a virtual machine (which is obviously a bit slower) I got inverted results - the shrunk menu buttons appeared only a few times, most of the time not. I'll try to get another real machine and test it there.

EDIT
On a different computer (different HW, same OS) it behaves similarly to my virtual machine - the bug appears only rarely.
_________________
Windows 7 Pro x64, Windows 8 Pro x64


Last edited by umbra on Fri Feb 24, 2012 4:32 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
umbra
Power Member
Power Member


Joined: 14 Jan 2012
Posts: 655

PostPosted: Fri Feb 24, 2012 3:49 pm    Post subject: Reply with quote

Ok, it's starting to be a little bit confusing here, so I've decided to create a separate bug report for the redraw issue (the upper half of image in my first post).

2M0rpheuss
If you meant that issue, please confirm it here: http://www.ghisler.ch/board/viewtopic.php?t=33777
_________________
Windows 7 Pro x64, Windows 8 Pro x64
Back to top
View user's profile Send private message Send e-mail
Sob
Power Member
Power Member


Joined: 19 Jan 2005
Posts: 626

PostPosted: Fri Feb 24, 2012 6:48 pm    Post subject: Reply with quote

About the shrinking menu items, I did a little debugging and I can answer the question, why they do it. But no, don't get excited, I don't have a solution. But for the record:

When the function for measuring item size is called after switching to Classic theme, sometimes Lazarus still thinks that themes are enabled. So it calls another function for measuring themed menu items, it fails and returns zero. I didn't investigate why, because that is not the source of the problem. Few strategicaly placed OutputDebugString() calls in WindowProc revealed, that sometimes WM_MEASUREITEM for all menubar items come before WM_THEMECHANGED. It explains it. But the real question is how it's possible. System sending messages in wrong order doesn't seem likely and I'm not sure if application has any chance to reoder them somehow. So unfortunately, no happy end yet.
Back to top
View user's profile Send private message Send e-mail
M0rpheuss
Junior Member
Junior Member


Joined: 15 Aug 2009
Posts: 9

PostPosted: Sat Feb 25, 2012 5:42 am    Post subject: Reply with quote

2umbra
I can confirm both issus.
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 24590
Location: Switzerland

PostPosted: Sun Feb 26, 2012 11:02 am    Post subject: Reply with quote

OK, I will try to call DrawMenuBar delayed with a timer after receiving WM_THEMECHANGED. I wonder whether these is any kind of MeasureMenuBar command which would force Windows to send again WM_MEASUREITEM for each item...
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
umbra
Power Member
Power Member


Joined: 14 Jan 2012
Posts: 655

PostPosted: Fri Mar 02, 2012 2:32 pm    Post subject: Reply with quote

I tried to reproduce this issue in TC8.0 beta 22 a few dozen times, but I wasn't successful. So I think it's fixed.
_________________
Windows 7 Pro x64, Windows 8 Pro x64
Back to top
View user's profile Send private message Send e-mail
Sob
Power Member
Power Member


Joined: 19 Jan 2005
Posts: 626

PostPosted: Fri Mar 02, 2012 4:59 pm    Post subject: Reply with quote

I can confirm that. I tried changing themes with running TC and separate Lazarus application. And menu in TC stayed correct even when the one in Lazarus application shrinked.
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 24590
Location: Switzerland

PostPosted: Mon Mar 05, 2012 8:33 am    Post subject: Reply with quote

That's great, thanks! I changed the Lazarus code to use the non-themed measureitem function when the themed one returned an error or 0 width.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> TC Fixed bugs All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group