| View previous topic :: View next topic |
| Author |
Message |
umbra Power Member

Joined: 14 Jan 2012 Posts: 658
|
Posted: Mon Feb 20, 2012 4:35 am Post subject: [TC 8.0b20 x64] Changing themes cuses problems with menu bar |
|
|
This is probably an edge-case but whatever.
- Switch to Classic Windows theme
- Start TC8.0b20 x64
- Switch to Aero theme
- 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 |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 24602 Location: Switzerland
|
Posted: Mon Feb 20, 2012 8:33 am Post subject: |
|
|
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 |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 24602 Location: Switzerland
|
Posted: Wed Feb 22, 2012 11:10 am Post subject: |
|
|
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 |
|
 |
umbra Power Member

Joined: 14 Jan 2012 Posts: 658
|
Posted: Thu Feb 23, 2012 9:58 am Post subject: |
|
|
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 |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 24602 Location: Switzerland
|
Posted: Fri Feb 24, 2012 5:51 am Post subject: |
|
|
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 |
|
 |
M0rpheuss Junior Member

Joined: 15 Aug 2009 Posts: 9
|
Posted: Fri Feb 24, 2012 1:49 pm Post subject: |
|
|
| I can reproduce this. The redraw error also occurs if I change the screen resolution. |
|
| Back to top |
|
 |
umbra Power Member

Joined: 14 Jan 2012 Posts: 658
|
Posted: Fri Feb 24, 2012 2:45 pm Post subject: |
|
|
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 |
|
 |
umbra Power Member

Joined: 14 Jan 2012 Posts: 658
|
Posted: Fri Feb 24, 2012 3:49 pm Post subject: |
|
|
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 |
|
 |
Sob Power Member

Joined: 19 Jan 2005 Posts: 626
|
Posted: Fri Feb 24, 2012 6:48 pm Post subject: |
|
|
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 |
|
 |
M0rpheuss Junior Member

Joined: 15 Aug 2009 Posts: 9
|
Posted: Sat Feb 25, 2012 5:42 am Post subject: |
|
|
2umbra
I can confirm both issus. |
|
| Back to top |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 24602 Location: Switzerland
|
Posted: Sun Feb 26, 2012 11:02 am Post subject: |
|
|
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 |
|
 |
umbra Power Member

Joined: 14 Jan 2012 Posts: 658
|
Posted: Fri Mar 02, 2012 2:32 pm Post subject: |
|
|
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 |
|
 |
Sob Power Member

Joined: 19 Jan 2005 Posts: 626
|
Posted: Fri Mar 02, 2012 4:59 pm Post subject: |
|
|
| 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 |
|
 |
ghisler(Author) Site Admin


Joined: 04 Feb 2003 Posts: 24602 Location: Switzerland
|
Posted: Mon Mar 05, 2012 8:33 am Post subject: |
|
|
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 |
|
 |
|