Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/org/violetlib/jnr/aqua/impl/AquaNativePainter.java
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ public void configureAppearance(@NotNull VAppearance appearance)
}

// NSSlider appears to figure out the orientation from the bounds.
// Note: w/h are modified here so that configureLayout picks up the adjusted dimensions.
// getPainter() saves and restores w/h to prevent these changes from leaking.

if (sw == SliderWidget.SLIDER_HORIZONTAL || sw == SliderWidget.SLIDER_HORIZONTAL_RIGHT_TO_LEFT) {
if (h >= w) {
Expand Down
17 changes: 13 additions & 4 deletions src/org/violetlib/jnr/aqua/impl/AquaUIPainterBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,19 @@ public int getSliderRenderingVersion()
public @NotNull Painter getPainter(@NotNull Configuration g)
throws UnsupportedOperationException
{
LayoutInfo layoutInfo = uiLayout.getLayoutInfo((LayoutConfiguration) g);
Renderer r = getRenderer(g);
Painter p = getPainter(layoutInfo, g, r);
return customizePainter(p, g, layoutInfo);
// Save and restore w/h because getRenderer may adjust them (see getSliderRenderer)
// and those adjustments must not leak beyond this call.
int savedW = w;
int savedH = h;
try {
LayoutInfo layoutInfo = uiLayout.getLayoutInfo((LayoutConfiguration) g);
Renderer r = getRenderer(g);
Painter p = getPainter(layoutInfo, g, r);
return customizePainter(p, g, layoutInfo);
} finally {
w = savedW;
h = savedH;
}
}

protected @NotNull Painter customizePainter(@NotNull Painter p, @NotNull Configuration g, @NotNull LayoutInfo layoutInfo)
Expand Down