The window that works is a big MTKView. The one that doesn't is a complicated stack of Cocoa windows, including an NSOutlineView and an NSTableView -- a timeline basically. There are no overrides for either sendEvent or performKeyEquivalent.
In order to not have to activate each window before using the mouse/pen in it, I have this override in the MTKView and the NSOutlineView. Not sure if that makes any difference.
override func acceptsFirstMouse(for event: NSEvent?) -> Bool {
return true
}
Also this one in the outline view:
override var needsPanelToBecomeKey:Bool { get { return false } }
Maybe NSOutlineView or NSTableView or the pile of associated scroller subviews intercept the space bar for some reason?
.
.
.
Ahh! Okay, so from this stack overflow thread I found that NSTableView *does* capture the spacebar.
https://stackoverflow.com/questions/27954538/nstableview-how-to-remove-the-spacebar-event-listener
I was able to get it to work by overriding keyDown for the NSTableView. I added in overrides for the outline view in case it did the same thing.