NSStatusItem fullscreen issues

I’m making a statusbar app that displays an NSPopover when the NSStatusItem is clicked, like this:

enter image description here

  • Why passing &error instead of error in Cocoa programming?
  • How to add buttons when NSVisualEffectView is used
  • Uncaught exception handler not called
  • How can I get Xcode to link and debug an app with Boost Filesystem?
  • mutating method sent to immutable object
  • Using delegates, operations, and queues
  • I have added the ability to resize the popover by dragging on the edges, by subclassing the popover’s view like this:

    class CMView: NSView {
        let tolerance : CGFloat = 10
        var state = false
    
        override func mouseDown(theEvent: NSEvent) {
            let point = self.convertPoint(theEvent.locationInWindow, fromView: nil)
            if (point.y <= tolerance) {
                state = true
            }
        }
        override func mouseDragged(theEvent: NSEvent) {
            if (state) {
                let point = self.convertPoint(theEvent.locationInWindow, fromView: nil)
                self.frame = NSRect(
                    x: self.frame.origin.x,
                    y: self.frame.origin.y,
                    width: self.frame.size.width,
                    height: self.frame.size.height-point.y)
                popover.contentSize = self.frame.size
            }
        }
        override func mouseUp(theEvent: NSEvent) {
            state = false
        }
    }
    

    This only works if the desktop isn’t in full screen. If I try to resize it in fullscreen, it simply doesn’t work, and the popover arrow disappears mysteriously.

    It seems like the popover isn’t redrawing when invoked in a fullscreen environment. Is there any way around this problem?

    Solutions Collect From Internet About “NSStatusItem fullscreen issues”

    Here at WWDC. Asking the same question. You have to have an app that’s an UIElement app – meaning no dock icon, no main menu.