From 80b39144b1d11b064b425ed82cc2c3cf8b83b5ea Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sat, 30 Sep 2023 18:02:47 +0200 Subject: [PATCH] fix: moved battery widget and popup view from dirtyRect to the frame --- Kit/Widgets/Battery.swift | 2 +- Modules/Battery/popup.swift | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Kit/Widgets/Battery.swift b/Kit/Widgets/Battery.swift index 1e0e7477c58..a89cb647308 100644 --- a/Kit/Widgets/Battery.swift +++ b/Kit/Widgets/Battery.swift @@ -130,7 +130,7 @@ public class BatteryWidget: WidgetWrapper { let batteryFrame = NSBezierPath(roundedRect: NSRect( x: x + borderWidth + offset, - y: ((dirtyRect.size.height - batterySize.height)/2) + offset, + y: ((self.frame.size.height - batterySize.height)/2) + offset, width: batterySize.width - borderWidth, height: batterySize.height - borderWidth ), xRadius: 2, yRadius: 2) diff --git a/Modules/Battery/popup.swift b/Modules/Battery/popup.swift index ee7f939be29..550bde6cc3d 100644 --- a/Modules/Battery/popup.swift +++ b/Modules/Battery/popup.swift @@ -374,10 +374,10 @@ internal class BatteryView: NSView { guard let ctx = NSGraphicsContext.current?.cgContext else { return } - let w: CGFloat = min(dirtyRect.width, 120) - let h: CGFloat = min(dirtyRect.height, 50) - let x: CGFloat = (dirtyRect.width - w)/2 - let y: CGFloat = (dirtyRect.size.height - h) / 2 + let w: CGFloat = min(self.frame.width, 120) + let h: CGFloat = min(self.frame.height, 50) + let x: CGFloat = (self.frame.width - w)/2 + let y: CGFloat = (self.frame.size.height - h) / 2 let batteryFrame = NSBezierPath(roundedRect: NSRect(x: x+1, y: y+1, width: w-8, height: h-2), xRadius: 3, yRadius: 3) NSColor.textColor.set()