Search code examples
cocoaosx-lionspacesnsmenuitemnspanel

NSPanel Popping up in the wrong space


So, I'm looking through this source, trying to make one of those status bar applications with a custom popover using an NSPanel -

All works fine and dandy. Clicking the menulet calls [panel makeKeyandOrderFront:nil] which works in most cases - the window usually pops up in the correct space in front of everything else.

However, if I move to a fullscreen space (e.g. Xcode in fullscreen mode) and try to use the menu application there, the panel pops up in the wrong space (the one it was previously brought up in) and nothing shows up in the intended space. Only after clicking a second time does it come up in the right place.

Does anyone have an explanation for this phenomenon?


Solution

  • I noticed that too, and while I don't have an explanation, I found a fix. On line 249 in PanelController.m, in the closePanel method, you have to change [self close] to [self.window orderOut:self].