Skip to content

Commit

Permalink
fix: second blacklist was too tall on some systems
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Aug 25, 2020
1 parent c344da7 commit 522633b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/ui/generic-components/text/TextArea.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Cocoa

class TextArea: NSTextField, NSTextFieldDelegate {
static let padding = CGFloat(5)
static let interLineFactor = CGFloat(1.6)
var callback: (() -> Void)!

convenience init(_ nCharactersWide: CGFloat, _ nLinesHigh: Int, _ placeholder: String, _ callback: (() -> Void)? = nil) {
Expand All @@ -10,7 +11,7 @@ class TextArea: NSTextField, NSTextFieldDelegate {
delegate = self
cell = TextFieldCell(placeholder, nLinesHigh == 1)
let width: CGFloat = (font!.xHeight * nCharactersWide + TextArea.padding * 2).rounded()
let height: CGFloat = (fittingSize.height * CGFloat(nLinesHigh) + TextArea.padding * 2).rounded()
let height: CGFloat = (NSFont.systemFontSize * TextArea.interLineFactor * CGFloat(nLinesHigh) + TextArea.padding * 2).rounded()
fit(width, height)
}

Expand Down
4 changes: 2 additions & 2 deletions src/ui/preferences-window/tabs/BlacklistsTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import Sparkle
class BlacklistsTab {
static func initTab() -> NSView {
let dontShowBlacklistLabel = NSTextField(labelWithString: NSLocalizedString("Don’t show windows from these apps", comment: ""))
let dontShowBlacklist = LabelAndControl.makeTextArea(50, 3, Preferences.dontShowBlacklist.joined(separator: "\n"), "dontShowBlacklist")
let dontShowBlacklist = LabelAndControl.makeTextArea(50, 6, Preferences.dontShowBlacklist.joined(separator: "\n"), "dontShowBlacklist")
let disableShortcutsBlacklistLabel = NSTextField(labelWithString: NSLocalizedString("Ignore shortcuts while a window from these apps is active", comment: ""))
let disableShortcutsBlacklistCheckbox = LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Only if the window is fullscreen", comment: ""), "disableShortcutsBlacklistOnlyFullscreen", labelPosition: .right)
let disableShortcutsBlacklist = LabelAndControl.makeTextArea(50, 3, Preferences.disableShortcutsBlacklist.joined(separator: "\n"), "disableShortcutsBlacklist")
let disableShortcutsBlacklist = LabelAndControl.makeTextArea(50, 6, Preferences.disableShortcutsBlacklist.joined(separator: "\n"), "disableShortcutsBlacklist")

let grid = GridView([
[dontShowBlacklistLabel],
Expand Down

0 comments on commit 522633b

Please sign in to comment.