fix: second blacklist was too tall on some systems

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-08-26 02:45:04 +09:00
1 parent c344da700b
commit 522633b2eb
2 files changed
+4 -3

No files matched your search

@@ -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) {
@@ -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)
}
@@ -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],