mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: fixed resizing the widget view when it was resized but waiting for the main thread
This commit is contained in:
@@ -152,9 +152,12 @@ open class WidgetWrapper: NSView, widget_p {
|
||||
|
||||
public var widthHandler: (() -> Void)? = nil
|
||||
|
||||
public var shadowSize: CGSize
|
||||
|
||||
public init(_ type: widget_t, title: String, frame: NSRect) {
|
||||
self.type = type
|
||||
self.title = title
|
||||
self.shadowSize = frame.size
|
||||
|
||||
super.init(frame: frame)
|
||||
}
|
||||
@@ -164,9 +167,8 @@ open class WidgetWrapper: NSView, widget_p {
|
||||
}
|
||||
|
||||
public func setWidth(_ width: CGFloat) {
|
||||
if self.frame.width == width {
|
||||
return
|
||||
}
|
||||
guard self.shadowSize.width != width else { return }
|
||||
self.shadowSize.width = width
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.setFrameSize(NSSize(width: width, height: self.frame.size.height))
|
||||
|
||||
Reference in New Issue
Block a user