From 35a25a050fc1503a124efd73c6147fca5ba4895b Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Mon, 18 Jul 2022 17:29:36 +0200 Subject: [PATCH] fix: fixed resizing the widget view when it was resized but waiting for the main thread --- Kit/module/widget.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Kit/module/widget.swift b/Kit/module/widget.swift index 5214a8ff..9c19c792 100644 --- a/Kit/module/widget.swift +++ b/Kit/module/widget.swift @@ -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))