Skip to content

Commit f400262

Browse files
committed
Fix blur and focus events when the MainFlutterWindow extends from NSPanel
1 parent 92357e1 commit f400262

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

macos/Classes/WindowManager.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,18 @@ public class WindowManager: NSObject, NSWindowDelegate {
542542
_emitEvent("moved")
543543
}
544544

545+
public func windowDidBecomeKey(_ notification: Notification) {
546+
if (mainWindow is NSPanel) {
547+
_emitEvent("focus");
548+
}
549+
}
550+
551+
public func windowDidResignKey(_ notification: Notification) {
552+
if (mainWindow is NSPanel) {
553+
_emitEvent("blur");
554+
}
555+
}
556+
545557
public func windowDidBecomeMain(_ notification: Notification) {
546558
_emitEvent("focus");
547559
}

0 commit comments

Comments
 (0)