Repo // Disable NSRect.zero to suppress CoreGraphics errors.

This commit is contained in:
ShikiSuen 2022-09-11 11:09:32 +08:00
parent 4527e6f7ba
commit a846022f1b
6 changed files with 9 additions and 9 deletions

View File

@ -16,7 +16,7 @@ extension ctlInputMethod: KeyHandlerDelegate {
/// ///
public var isVerticalTyping: Bool { public var isVerticalTyping: Bool {
guard let client = client() else { return false } guard let client = client() else { return false }
var textFrame = NSRect.zero var textFrame = NSRect.seniorTheBeast
let attributes: [AnyHashable: Any]? = client.attributes( let attributes: [AnyHashable: Any]? = client.attributes(
forCharacterIndex: 0, lineHeightRectangle: &textFrame forCharacterIndex: 0, lineHeightRectangle: &textFrame
) )

View File

@ -160,7 +160,7 @@ public class ctlCandidate: NSWindowController, ctlCandidateProtocol {
var adjustedPoint = windowTopLeftPoint var adjustedPoint = windowTopLeftPoint
var delta = heightDelta var delta = heightDelta
var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.zero var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast
for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowTopLeftPoint) }) { for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowTopLeftPoint) }) {
screenFrame = frame screenFrame = frame
break break

View File

@ -167,7 +167,7 @@ public class ctlCandidateIMK: IMKCandidates, ctlCandidateProtocol {
var adjustedPoint = windowTopLeftPoint var adjustedPoint = windowTopLeftPoint
var adjustedHeight = height var adjustedHeight = height
var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.zero var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast
for screen in NSScreen.screens { for screen in NSScreen.screens {
let frame = screen.visibleFrame let frame = screen.visibleFrame
if windowTopLeftPoint.x >= frame.minX, windowTopLeftPoint.x <= frame.maxX, if windowTopLeftPoint.x >= frame.minX, windowTopLeftPoint.x <= frame.maxX,

View File

@ -600,7 +600,7 @@ extension ctlCandidateUniversal {
pageCounterLabel.isHidden = true pageCounterLabel.isHidden = true
} }
frameRect = window?.frame ?? NSRect.zero frameRect = window?.frame ?? NSRect.seniorTheBeast
let topLeftPoint = NSPoint(x: frameRect.origin.x, y: frameRect.origin.y + frameRect.size.height) let topLeftPoint = NSPoint(x: frameRect.origin.x, y: frameRect.origin.y + frameRect.size.height)
frameRect.size = newSize frameRect.size = newSize

View File

@ -90,7 +90,7 @@ public class NotifierController: NSWindowController, NotifierWindowDelegate {
} }
private init() { private init() {
let screenRect = NSScreen.main?.visibleFrame ?? NSRect.zero let screenRect = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast
let contentRect = NSRect(x: 0, y: 0, width: kWindowWidth, height: kWindowHeight) let contentRect = NSRect(x: 0, y: 0, width: kWindowWidth, height: kWindowHeight)
var windowRect = contentRect var windowRect = contentRect
windowRect.origin.x = screenRect.maxX - windowRect.width - 10 windowRect.origin.x = screenRect.maxX - windowRect.width - 10
@ -144,8 +144,8 @@ public class NotifierController: NSWindowController, NotifierWindowDelegate {
return return
} }
let lastLocation = NotifierController.lastLocation let lastLocation = NotifierController.lastLocation
let screenRect = NSScreen.main?.visibleFrame ?? NSRect.zero let screenRect = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast
var windowRect = window?.frame ?? NSRect.zero var windowRect = window?.frame ?? NSRect.seniorTheBeast
windowRect.origin.x = lastLocation.x windowRect.origin.x = lastLocation.x
windowRect.origin.y = lastLocation.y - 10 - windowRect.height windowRect.origin.y = lastLocation.y - 10 - windowRect.height
@ -157,7 +157,7 @@ public class NotifierController: NSWindowController, NotifierWindowDelegate {
} }
func moveIn() { func moveIn() {
let afterRect = window?.frame ?? NSRect.zero let afterRect = window?.frame ?? NSRect.seniorTheBeast
NotifierController.lastLocation = afterRect.origin NotifierController.lastLocation = afterRect.origin
var beforeRect = afterRect var beforeRect = afterRect
beforeRect.origin.y += 10 beforeRect.origin.y += 10

View File

@ -129,7 +129,7 @@ public class ctlTooltip: NSWindowController {
var adjustedPoint = windowTopLeftPoint var adjustedPoint = windowTopLeftPoint
var delta = heightDelta var delta = heightDelta
var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.zero var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast
for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowTopLeftPoint) }) { for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowTopLeftPoint) }) {
screenFrame = frame screenFrame = frame
break break