mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
Merge pull request #2422 from ghostty-org/push-nrnmvswvwlmz
macos: don't swallow flagsChanged events, breaks system bindings
This commit is contained in:
@ -136,16 +136,17 @@ class BaseTerminalController: NSWindowController,
|
|||||||
private func localEventFlagsChanged(_ event: NSEvent) -> NSEvent? {
|
private func localEventFlagsChanged(_ event: NSEvent) -> NSEvent? {
|
||||||
// Go through all our surfaces and notify it that the flags changed.
|
// Go through all our surfaces and notify it that the flags changed.
|
||||||
if let surfaceTree {
|
if let surfaceTree {
|
||||||
let surfaces: [Ghostty.SurfaceView] = surfaceTree.map { $0.surface }
|
var surfaces: [Ghostty.SurfaceView] = surfaceTree.map { $0.surface }
|
||||||
for surface in surfaces {
|
|
||||||
surface.flagsChanged(with: event)
|
// If we're the main window receiving key input, then we want to avoid
|
||||||
|
// calling this on our focused surface because that'll trigger a double
|
||||||
|
// flagsChanged call.
|
||||||
|
if NSApp.mainWindow == window {
|
||||||
|
surfaces = surfaces.filter { $0 != focusedSurface }
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will double call flagsChanged on our focused surface so
|
for surface in surfaces {
|
||||||
// if we are the main window and have a focused surface then we
|
surface.flagsChanged(with: event)
|
||||||
// do not forward it.
|
|
||||||
if NSApp.mainWindow == window && focusedSurface != nil {
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user