# HG changeset patch # User luchsh # Date 1339383151 -28800 # Node ID afa8e122dcce5a51a72ab6e5e3980b3f9c21495b # Parent beeb6378dd373d5e48dcef7d3ec305878cd07380 7155887: ComboBox does not display focus outline in GTK L&F Reviewed-by: rupashka diff -r beeb6378dd37 -r afa8e122dcce jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java Sat Jun 09 19:18:24 2012 +0400 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java Mon Jun 11 10:52:31 2012 +0800 @@ -926,9 +926,20 @@ int x, int y, int w, int h) { // Text is odd in that it uses the TEXT_BACKGROUND vs BACKGROUND. JComponent c = context.getComponent(); + Container container = c.getParent(); + Container containerParent = null; GTKStyle style = (GTKStyle)context.getStyle(); Region id = context.getRegion(); int state = context.getComponentState(); + + if (c instanceof ListCellRenderer && container != null) { + containerParent = container.getParent(); + if (containerParent instanceof JComboBox + && containerParent.hasFocus()) { + state |= SynthConstants.FOCUSED; + } + } + synchronized (UNIXToolkit.GTK_LOCK) { if (ENGINE.paintCachedImage(g, x, y, w, h, id, state)) { return; @@ -938,9 +949,10 @@ int focusSize = 0; boolean interiorFocus = style.getClassSpecificBoolValue( context, "interior-focus", true); + + focusSize = style.getClassSpecificIntValue(context, + "focus-line-width",1); if (!interiorFocus && (state & SynthConstants.FOCUSED) != 0) { - focusSize = style.getClassSpecificIntValue(context, - "focus-line-width",1); x += focusSize; y += focusSize; w -= 2 * focusSize; @@ -961,11 +973,25 @@ h - (2 * yThickness), ColorType.TEXT_BACKGROUND); - if (focusSize > 0) { - x -= focusSize; - y -= focusSize; - w += 2 * focusSize; - h += 2 * focusSize; + if (focusSize > 0 && (state & SynthConstants.FOCUSED) != 0) { + if (!interiorFocus) { + x -= focusSize; + y -= focusSize; + w += 2 * focusSize; + h += 2 * focusSize; + } else { + if (containerParent instanceof JComboBox) { + x += (focusSize + 2); + y += (focusSize + 1); + w -= (2 * focusSize + 1); + h -= (2 * focusSize + 2); + } else { + x += focusSize; + y += focusSize; + w -= 2 * focusSize; + h -= 2 * focusSize; + } + } ENGINE.paintFocus(g, context, id, gtkState, "entry", x, y, w, h); }