Skip to content

Commit

Permalink
more removal of is3()
Browse files Browse the repository at this point in the history
  • Loading branch information
azvegint committed Jul 31, 2024
1 parent b7665a7 commit 6b7e2c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,13 @@ public void paintShadow(Graphics g, SynthContext context,
GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
int synthState = context.getComponentState();
Container parent = context.getComponent().getParent();
if(GTKLookAndFeel.is3()) {
if (parent != null && parent.getParent() instanceof JComboBox) {
if (parent.getParent().hasFocus()) {
synthState |= SynthConstants.FOCUSED;
}

if (parent != null && parent.getParent() instanceof JComboBox) {
if (parent.getParent().hasFocus()) {
synthState |= SynthConstants.FOCUSED;
}
}

int dir = getTextDirection(context);
int widget = getWidgetType(context.getComponent(), id).ordinal();
native_paint_shadow(widget, gtkState, shadowType.ordinal(), detail,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ int getIconDimension(SynthContext context) {

Region region = context.getRegion();
GTKStyle style = (GTKStyle) context.getStyle();
if (GTKLookAndFeel.is3() && region == Region.MENU) {
if (region == Region.MENU) {
Object value = style.getClassSpecificValue("arrow-scaling");
if (value instanceof Number) {
iconDimension = (int)(((Number) value).floatValue() *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ public void paintRadioButtonMenuItemBackground(SynthContext context,
int gtkState = GTKLookAndFeel.synthStateToGTKState(
id, context.getComponentState());
if (gtkState == SynthConstants.MOUSE_OVER) {
if (GTKLookAndFeel.is3()) {
paintComponentBackground(context, g, x, y, w, h);
}
paintComponentBackground(context, g, x, y, w, h);
}
}

Expand Down Expand Up @@ -559,9 +557,7 @@ public void paintMenuItemBackground(SynthContext context,
int gtkState = GTKLookAndFeel.synthStateToGTKState(
context.getRegion(), context.getComponentState());
if (gtkState == SynthConstants.MOUSE_OVER) {
if (GTKLookAndFeel.is3()) {
paintComponentBackground(context, g, x, y, w, h);
}
paintComponentBackground(context, g, x, y, w, h);
}
}

Expand Down Expand Up @@ -675,17 +671,14 @@ public void paintSeparatorBackground(SynthContext context,
} else {
h -= (insets.top + insets.bottom);
}
if (GTKLookAndFeel.is3()) {
if (id == Region.POPUP_MENU_SEPARATOR) {
detail = "menuitem";
h -= (insets.top + insets.bottom);
} else {
detail = "separator";
}

if (id == Region.POPUP_MENU_SEPARATOR) {
detail = "menuitem";
h -= (insets.top + insets.bottom);
} else {
detail = orientation == JSeparator.HORIZONTAL ?
"hseparator" : "vseparator";
detail = "separator";
}

synchronized (UNIXToolkit.GTK_LOCK) {
if (! ENGINE.paintCachedImage(g, x, y, w, h, id, state,
detail, orientation)) {
Expand Down Expand Up @@ -800,15 +793,15 @@ public void paintSliderTrackBackground(SynthContext context,
// The ubuntulooks engine paints slider troughs differently depending
// on the current slider value and its component orientation.
JSlider slider = (JSlider)context.getComponent();
if (GTKLookAndFeel.is3()) {
if (slider.getOrientation() == JSlider.VERTICAL) {
y += 1;
h -= 2;
} else {
x += 1;
w -= 2;
}

if (slider.getOrientation() == JSlider.VERTICAL) {
y += 1;
h -= 2;
} else {
x += 1;
w -= 2;
}

double value = slider.getValue();
double min = slider.getMinimum();
double max = slider.getMaximum();
Expand Down Expand Up @@ -842,7 +835,7 @@ public void paintSliderThumbBackground(SynthContext context,
Region id = context.getRegion();
int gtkState = GTKLookAndFeel.synthStateToGTKState(
id, context.getComponentState());
boolean hasFocus = GTKLookAndFeel.is3() &&
boolean hasFocus =
((context.getComponentState() & SynthConstants.FOCUSED) != 0);
synchronized (UNIXToolkit.GTK_LOCK) {
if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir,
Expand Down Expand Up @@ -1036,10 +1029,8 @@ private void paintTextBackground(SynthContext context, Graphics g,
int yThickness = style.getYThickness();

ENGINE.startPainting(g, x, y, w, h, id, state);
if (GTKLookAndFeel.is3()) {
ENGINE.paintBackground(g, context, id, gtkState, null,
x, y, w, h);
}
ENGINE.paintBackground(g, context, id, gtkState, null,
x, y, w, h);
ENGINE.paintShadow(g, context, id, gtkState,
ShadowType.IN, "entry", x, y, w, h);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ else if ("CheckBox.iconTextGap".equals(key) ||
int focusPad =
getClassSpecificIntValue(context, "focus-padding", 1);
return indicatorSpacing + focusSize + focusPad;
} else if (GTKLookAndFeel.is3() && "ComboBox.forceOpaque".equals(key)) {
} else if ("ComboBox.forceOpaque".equals(key)) {
return true;
} else if ("Tree.expanderSize".equals(key)) {
Object value = getClassSpecificValue("expander-size");
Expand Down

0 comments on commit 6b7e2c5

Please sign in to comment.