mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: avoid crashing in rare cases
This commit is contained in:
@@ -138,6 +138,7 @@ They helped [localize the app](https://poeditor.com/join/project/8AOEZ0eAZE):
|
||||
* Lcwhhh
|
||||
* Lester
|
||||
* Loïc
|
||||
* Loic. peron
|
||||
* LostInCompilation
|
||||
* Lumaxis
|
||||
* lwouis
|
||||
@@ -197,6 +198,7 @@ They helped [localize the app](https://poeditor.com/join/project/8AOEZ0eAZE):
|
||||
* shlomo
|
||||
* Sippawit Thammawiset
|
||||
* Sjur Moshagen
|
||||
* Sjur.n. moshagen
|
||||
* Stan Smits
|
||||
* Stefan
|
||||
* Svetoslav Stefanov
|
||||
|
||||
@@ -15,16 +15,20 @@ class PopupButtonLikeSystemSettings: NSPopUpButton {
|
||||
}
|
||||
|
||||
override var intrinsicContentSize: NSSize {
|
||||
let fakePopUpButton = NSPopUpButton()
|
||||
fakePopUpButton.addItem(withTitle: title)
|
||||
fakePopUpButton.selectedItem!.image = selectedItem!.image
|
||||
let fakeCell = fakePopUpButton.cell! as! NSPopUpButtonCell
|
||||
let currentCell = cell! as! NSPopUpButtonCell
|
||||
fakeCell.bezelStyle = currentCell.bezelStyle
|
||||
fakeCell.arrowPosition = currentCell.arrowPosition
|
||||
fakeCell.imagePosition = currentCell.imagePosition
|
||||
fakePopUpButton.showsBorderOnlyWhileMouseInside = showsBorderOnlyWhileMouseInside
|
||||
fakePopUpButton.sizeToFit()
|
||||
return fakePopUpButton.intrinsicContentSize
|
||||
if let selectedItem = selectedItem {
|
||||
let fakePopUpButton = NSPopUpButton()
|
||||
fakePopUpButton.addItem(withTitle: title)
|
||||
fakePopUpButton.item(at: 0)!.image = selectedItem.image
|
||||
let fakeCell = fakePopUpButton.cell! as! NSPopUpButtonCell
|
||||
let currentCell = cell! as! NSPopUpButtonCell
|
||||
fakeCell.bezelStyle = currentCell.bezelStyle
|
||||
fakeCell.arrowPosition = currentCell.arrowPosition
|
||||
fakeCell.imagePosition = currentCell.imagePosition
|
||||
fakePopUpButton.showsBorderOnlyWhileMouseInside = showsBorderOnlyWhileMouseInside
|
||||
fakePopUpButton.sizeToFit()
|
||||
return fakePopUpButton.intrinsicContentSize
|
||||
} else {
|
||||
return super.intrinsicContentSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user