Skip to content

Commit

Permalink
Honor the NSScroller.Style.overlay scrollbar style
Browse files Browse the repository at this point in the history
This makes sure that, after the recent UI overhaul (PR #385, #383), we
now honor the "Scroll bar behavior" settings in System Preferences >
Appearance. This also fixes the problem with the .legacy style: that the
scroll bar is always visible and always gets in the highlighted item.
  • Loading branch information
lukhnos committed Nov 27, 2023
1 parent 84bd19f commit 35b41f5
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,6 @@ extension VerticalCandidateController: NSTableViewDataSource, NSTableViewDelegat
}

keyLabelStripView.setNeedsDisplay(keyLabelStripView.frame)

// fix a subtle OS X "bug" that, since we force the scroller to appear,
// scrolling sometimes shows a temporarily "broken" scroll bar
// (but quickly disappears)
if scrollView.hasVerticalScroller {
scrollView.verticalScroller?.setNeedsDisplay()
}
}
}

Expand Down Expand Up @@ -450,8 +443,10 @@ extension VerticalCandidateController: NSTableViewDataSource, NSTableViewDelegat
scrollView.hasVerticalScroller = true
let verticalScroller = scrollView.verticalScroller
verticalScroller?.controlSize = controlSize
verticalScroller?.scrollerStyle = .legacy
scrollerWidth = NSScroller.scrollerWidth(for: controlSize, scrollerStyle: .legacy)
verticalScroller?.scrollerStyle = NSScroller.preferredScrollerStyle
if NSScroller.preferredScrollerStyle == .legacy {
scrollerWidth = NSScroller.scrollerWidth(for: controlSize, scrollerStyle: NSScroller.preferredScrollerStyle)
}
}

keyLabelStripView.keyLabelFont = keyLabelFont
Expand Down

0 comments on commit 35b41f5

Please sign in to comment.