Community
Participate
Working Groups
Created attachment 274556 [details] Zip file contains a ready to use plugin project with example code in view After starting the example plugin (see attached zip file) and showing up the "Example view" the drag rendering is having a white background in eclipse dark theme. (there will be an image uploaded too) This happens (at least) on Windows 7 and on Linux (GTK) too.
Created attachment 274557 [details] A screenshot from the example plugin showing the problem
Albert, IIRC you also found the place in the code in which the color is hard-coded? If that is true, can you point us to this place?
Roland, as master of all color issues, can you have a look? (In reply to Lars Vogel from comment #2) > Albert, IIRC you also found the place in the code in which the color is > hard-coded? If that is true, can you point us to this place? I think the problem is in the CoolBar#onPaint method. In line 712 /* Draw gripper. */ where it goes into the following code path. if (!nativeGripper) { int grabberTrim = 2; int grabberHeight = bounds.height - (2 * grabberTrim) - 1; gc.setForeground(shadowColor); etc. @Roland, as master of all color issues, can you please have a look?
> (In reply to Lars Vogel from comment #2) > > Albert, IIRC you also found the place in the code in which the color is > > hard-coded? If that is true, can you point us to this place? > > I think the problem is in the CoolBar#onPaint method. In line 712 /* Draw > gripper. */ where it goes into the following code path. > > if (!nativeGripper) { > int grabberTrim = 2; > int grabberHeight = bounds.height - (2 * grabberTrim) - 1; > gc.setForeground(shadowColor); Does the following workaround improve things for you as well ? In ExampleView#createToolBar() below 'CoolBar coolbar = coolBarManager.createControl(topComposite); Color bgcolor = colorRegistry.get(JFacePreferences.INFORMATION_BACKGROUND_COLOR); if (bgcolor == null) { bgcolor = JFaceColors.getInformationViewerForegroundColor(Display.getDefault()); } coolbar.setBackground(bgcolor); After asking Eric about this, it seems like this is actually a bug in CoolBar, which you can see by launching into SWT's ControlExample, selecting the CoolBar tab, and attempting to set the background colour. The CoolBar separators don't seem to respect the background. This seems to be a bug on Windows and Linux GTK2 & GTK3, but for some reason works on MacOS. I can file a bug for this in SWT but there may be some more investigation needed on that side.
After some more investigation, it looks like this can be fixed simply by starting to theme CoolBar like other widgets in eclipse.platform.ui/bundles/org.eclipse.ui.themes/css/dark/e4-dark_globalstyle.css . I can push a patch for this. However, before the patch is ready to be pushed, I need to confirm that the fix that will go on the SWT side doesn't affect this one. To clarify, there are 2 issues here : 1) CoolBar not being styled 2) CoolBar items not inheriting colour from parent We can fix (1), and that's all this bug really needs, but given that (2) is still an issue (possibly for others) it would be good to verify (2) doesn't break (1) (on all platforms).
New Gerrit change created: https://git.eclipse.org/r/124907
Lars, sorry about the late response, As mentioned inside https://github.com/de-jcup/eclipse-asciidoctor-editor/issues/68#issuecomment-397469714 I also recognized the onPaint method did not handle themes, but used system colors. But I recognized this only at debugging org.eclipse.swt.gtk.linux.x86_64.source_3.105.3.v20170228-0512.jar When trying to find the problem inside org.eclipse.swt.win32.win32.x86_64_3.105.2.v20161122-0613.jar (with decompiler jad and also fernflower) on a windows machine I did not found even a onPaint method?!?! So I was very confused about my former results on linux... and being not very familier with SWT I wanted to check my last results on my linux machine again before giving any wrong information.
No worries Albert. Could you test Roland's patch? You need latest I-build for that and clone eclipse.platform.ui from git.eclipse.org/r. Same setup as I described in my email for the team contribution.
Hello Roland, does adding a CSS style really solve this? when looking at https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org.eclipse.swt/Eclipse%20SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java#n697 It seems that e.g. the highlight color is directly used: ``` Color highlightColor = display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW); ... /* Draw gripper. */ ... gc.setForeground(highlightColor); ... ``` So I don't know if the theming does override this behaviour but ... I wouldn't expect that.
Okay Lars, I will try to test the patch - but being an absolute beginner with testing swt changes at all I would recommend that another person should do test it also... ;-) I try to test it on linux and windows this weekend.
(In reply to Albert Tregnaghi from comment #10) > Okay Lars, I will try to test the patch - but being an absolute beginner > with testing swt changes at all I would recommend that another person should > do test it also... ;-) Here is how you can test this: 1.) Download latest I-build from http://download.eclipse.org/eclipse/downloads/ or use latest 4.9 from http://download.eclipse.org/eclipse/downloads/drops4/I20180621-2000/ 2.) Install EGit into this download 3.) Clone eclipse.platform.ui Clone URI can be found here: https://git.eclipse.org/r/#/admin/projects/platform/eclipse.platform.ui 4.) Import at least org.eclipse.ui.themes into your workspace 5.) Ctrl+3 -> Fetch from Gerrit -> 124907 6.) Right click org.eclipse.ui.themes and select Run-As-> Eclipse Appliation This should start a runtime Eclipse with the patch, if you have your example in the workspace your test view should also be available. If you have problems please let me know via this bug or via email.
Change is, luckily, not in SWT, as SWT testing is a bit more complex. :-)
(In reply to Albert Tregnaghi from comment #9) > Hello Roland, does adding a CSS style really solve this? From my testing on Linux, styling the CoolBar in org.eclipse.ui.themes fixes the issue. Once a widget is themed I don't think individual setting of background colours can override that, which explains why manually setting it works even on dark theme currently. I still have to test on other platforms but am just blocked on a few other minor things. > when looking at > https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org. > eclipse.swt/Eclipse%20SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar. > java#n697 > > It seems that e.g. the highlight color is directly used: > > ``` > Color highlightColor = > display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW); > ... > /* Draw gripper. */ > ... > gc.setForeground(highlightColor); > ... > ``` This doesn't actually set the background colour of the separator. From my understanding (hugely thanks to Eric) the area that looks like a separator is actually just showing the underlying composite that makes up the CoolBar. The drawGripper logic simply gets the bounds of that area and draws some vertical lines on it to make it look like it protrudes and can be "gripped" / dragged. You can confirm this yourself by debugging, overriding those colours to something like red/blue.
I've tested on Windows and Mac. This improves the look of the CoolBar on all of these.
Thanks Roland. Once Albert confirms I plan to merge.
Created attachment 274591 [details] Screenshot shows patch working on windows 7 Tested on windows 7 - patch looks very good (see pciture)
Created attachment 274592 [details] Screenshot shows patch working on linux GTK
I tested with Windows 7 and at Linux. The patch is working well on both OS - see attached pictures. (Just one thing: the nice looking drag icon from windows 7 is much more beautiful than icon respectively the rendering on linux - compare screenshots, but it's okay).
Lars, I tested with http://download.eclipse.org/eclipse/downloads/drops4/I20180611-0500/ IMHO the patch is working well and should be merged.
Thanks Roland for the patch and Albert for the validation.
Gerrit change https://git.eclipse.org/r/124907 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=8d56ce081cd8c4f7a22fa36cb42be05a75b32750
Verified the fix with attachment 274556 [details] on Win7 using Build id: I20180731-2000