Drawing custom menu items for Menu Bar **Dark Theme Only**
Using gc to draw menu item, moving the responsibility from OS due to wrong scaling of menu bar horizontally in Dark Theme. Snippet 373 can be used to test menuItems with images.
Additional points covered in this PR:
- Changing the text color from a grayish tone to white.
- When ALT key is pressed mnemonics are underlined and work as a toggle, the behavior which was missing from dark theme previously.
Screenshot of the fix:
HOW TO TEST
- Run the
RunTimeWorkspacewith the following VM Arguments
-Dswt.autoScale=quarter
-Dswt.autoScale.updateOnRuntime=true
- Go to "Windows" -> "Preferences" -> "General" -> "Appearance"
- Change theme to "Dark"
- Click "Apply and Close"
- Move the window from 100 -> 175 (or anything 100+) zoom level
- See if menu bar is properly aligned.
EXPECTED BEHAVIOUR
The menu bar should be scaled properly.
contributes to https://github.com/eclipse-platform/eclipse.platform.swt/issues/62 and https://github.com/eclipse-platform/eclipse.platform.swt/issues/127
Test Results
486 files ±0 486 suites ±0 8m 30s :stopwatch: +53s 4 154 tests ±0 4 146 :white_check_mark: ±0 8 :zzz: ±0 0 :x: ±0 16 370 runs ±0 16 278 :white_check_mark: ±0 92 :zzz: ±0 0 :x: ±0
Results for commit bd3cf3a2. ± Comparison against base commit 4d61d1df.
:recycle: This comment has been updated with latest results.
Something seems to be wrong with the PR now. No matter whether I rebase on #1349, I see two issues:
- The left margin of each menu item is quite large
- There are unexpected menu items, like another "File" entry with only a single entry in the menu that opens up from it
Can you please check that, @ShahzaibIbrahim?
I retested and found that the faulty second "File" entry is because of a broken workbench.xmi on my side. Still, it shows some placement issue, as the text is cut off (hapenning for a "File" entry without a mnemonic, while the original "File" entry with mnemonic is not cut off). That may be investigated. You can easily reproduce by manually adding two menus (with at least one dummy menu item in each of them to have the menu shown) through the Model Spy:
Please check your latest commit. Only considering the diff, it does not seem to be in the intended/final state. There is a System.out.println() statement and some some added magic number in addition to the essential change:
Please check your latest commit. Only considering the diff, it does not seem to be in the intended/final state. There is a
System.out.println()statement and some some added magic number in addition to the essential change:
Yes sorry, that was a leftover.
I've quickly retested again, but still see the large left margin for every menu I have mentioned before. Is that intended and is it reproducible for you?
In addition, I see that when activating mnemonics mode (pressing Alt) only the texts but not the complete menus are highlighted. That's different to existing behavior and to behavior of the light theme. Anyway: is the behavior intended or is that by accident?
Unfortunately, it looks still almost the same. On 125% it became better/good, but with the primary monitor on 150% or above, I still see the issue. E.g., this is with primary monitor 175% on secondary monitor with 100%:
@HeikoKlare Sorry for all that back and forth, we need to improve the test protocol on our side, so you don't have that much work retesting changes. It is not yet properly working on all scenarios, as you mentioned. We'll have a look on that tomorrow.
This is how it looks when I start on 125%:
This is on 150%:
In each of the following screenshot there is an adapted version of Snippet373 started with commit 2fe01bf, 4 times each. The title gives the info of the configuration:
- autoscaleOnRuntime active or not
- autoscale mode: int200 or quarter
Setup: Primary 125%, secondary 175%
Primary:
Secondary:
Setup: Primary 175%, secondary 125%
Primary:
Secondary:
Setup: Primary 150%, secondary 200%
Primary:
Secondary:
Setup: Primary 200%, secondary 100%
Primary:
Secondary:
Is this supposed to be ready for another review? I have only taken a quick look into an SDK application, but horizontal spacing is still off. See this screenshot at 150% (top one is with current implementation, bottom one with this PR):
And at 175%/200%, vertical spacing also seems broken (scaling mode "integer200"):
Hmm, I cannot reproduce any vertical spacing issue, neither with quarter nor with int200.
100%
150%
175%
200%
Regarding the horizontal indentation: I agree, that int direct comparision positioning could be improved. I tweaked some statics in https://github.com/eclipse-platform/eclipse.platform.swt/pull/1405/commits/cd3bb9bd972b495995e1e4757f38db37d79afadc to achieve the following result
100%
150%
200%
I would like to merge this PR but I'm not sure that every check ran. I only see 7 on the Checks tab.
Other PRs have also checks from Jenkins
I also noticed that https://ci.eclipse.org/releng is currently offline
Is there a ~shortage~ outage? @merks / @laeubi / @akurtakov ?
Is there a shortage?
https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/5131
Is there a shortage?
you mean "outage"?
Jenkins is still unavailable, but (Jenkins) builds before latest update were successful and without new issues. Since only formatting changes have been performed since then, this is still safe to merge.

