EVALUATION
http://hg.openjdk.java.net/hsx/hotspot-comp/jdk/rev/85f72a4f5f68
|
|
|
EVALUATION
In GTK LookAndFeel we should use MenuBar widget type (and so his color and font scheme) for top level menus.
|
|
|
EVALUATION
Comments in Launchpad reports mostly suggest that the bug is in the JRE's handling of the theme. Somehow "menu" and "menubar" are getting mixed up?
|
|
|
WORK AROUND
Besides using a different theme, Launchpad bug suggests working around in theme file:
--- /usr/share/themes/Ambiance/gtk-2.0/gtkrc 2012-04-12 09:24:22.000000000 -0400
+++ /usr/share/themes/Ambiance/gtk-2.0/gtkrc 2012-05-15 18:16:48.115264838 -0400
@@ -335,7 +335,7 @@
}
}
-style "menu" {
+style "menu" = "dark" {
xthickness = 0
ythickness = 0
No workaround yet known from the side of the Java application.
|
|
|
PUBLIC COMMENTS
Originally reported as https://bugs.launchpad.net/ubuntu/+source/light-themes/+bug/932274 (also https://bugs.launchpad.net/ubuntu/+source/light-themes/+bug/975894 marked as duplicate).
|
|
|
SUGGESTED FIX
The following may not be "right" but it works (at least in 12.04's Ambiance, and seems to do no harm in Radiance):
diff --git a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java
@@ -191,7 +191,11 @@
{
state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
- int rgb = nativeGetColorForState(widgetType, state,
+ int effectiveWidgetType = widgetType;
+ if (effectiveWidgetType == WidgetType.MENU.ordinal() && type == ColorType.FOREGROUND) {
+ effectiveWidgetType = WidgetType.MENU_BAR.ordinal();
+ }
+ int rgb = nativeGetColorForState(effectiveWidgetType, state,
type.getID());
return new ColorUIResource(rgb);
}
|
|
|
WORK AROUND
Works for the simple demo but causes CCEs (to GTKStyleFactory) in some cases:
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf != null && laf.getID().equals("GTK")) {
SynthLookAndFeel.setStyleFactory(new SynthStyleFactory() {
final SynthStyleFactory origFactory = SynthLookAndFeel.getStyleFactory();
@Override public SynthStyle getStyle(JComponent c, Region id) {
if (id == Region.MENU) {
return origFactory.getStyle(c, Region.MENU_BAR);
}
return origFactory.getStyle(c, id);
}
});
}
|
|
|