Coder Social home page Coder Social logo

axstatusitempopup's People

Contributors

acidlynx avatar adamhartford avatar amccloud avatar aschuch avatar boyvanamstel avatar copa avatar mduvall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

axstatusitempopup's Issues

Problems with 10.10

The icon in the status bar will not appear. This code should solve the issue.

- (void)drawRect:(NSRect)dirtyRect{
    [self.statusItem drawStatusBarBackgroundInRect:dirtyRect withHighlight:self.isActive];

    NSImage *icon = self.isActive ? self.alternateImage : self.image;
    NSSize iconSize = [icon size];
    NSRect bounds = self.bounds;
    CGFloat iconX = roundf((NSWidth(bounds) - iconSize.width) / 2);
    CGFloat iconY = roundf((NSHeight(bounds) - iconSize.height) / 2);
    NSPoint iconPoint = NSMakePoint(iconX, iconY);

    [icon drawAtPoint:iconPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
    }

In addition I would change the declaration of the private interface. I saw this code in PR #7

Flicker when closing

Clicking the close button in the demo causes popover to fade out, then in again, then out.

To see it more clearly, close the settings window when it opens.

Running Yosemite 10.10.2

Close when losing focus

Hi,

Is there a simple way to hide the popover when it loses focus? For example if the user clicks anywhere else but inside the window or on another status bar item?

Crash if user double clicks to close

Hi there,

The component crashes if the user (for what ever reason) double clicks the NSStatusItem to close the popover. This is a fixed hidePopover method:

- (void)hidePopover
{
    if (_popover && _popover.isShown && self.active) {
        [_popover close];
        [NSEvent removeMonitor:_popoverTransiencyMonitor];
    }

    self.active = NO;

}

Issue with fullscreen apps

Hello,
I'm making little app using your class, and when enter full screen with some application then the status bar hides and popover remains there and when i change the contentviewcontroller the popover just slides to left. Can you help me?
Thanks for help, have a nice day

Fast clicking on OSX causes over-releasing of _popoverTransiencyMonitor

I noticed that triple-clicking on the menu bar icon causes a crash in the UI thread. After some debugging, I have found the cause & a (potential) fix.

Original:

- (void)hidePopover
{
    self.active = NO;

    if (_popover && _popover.isShown) {
        [_popover close];
        [NSEvent removeMonitor:_popoverTransiencyMonitor];
    }
}

Fix:

- (void)hidePopover
{
    self.active = NO;
    if (_popover && _popover.isShown) {
        [_popover close];
        if (nil != _popoverTransiencyMonitor) {
            [NSEvent removeMonitor:_popoverTransiencyMonitor];
            _popoverTransiencyMonitor = nil;
        }
    }
}

From the Apple Docs:

_Remove the specified event monitor. You must ensure that eventMonitor is removed only once. Removing the same eventMonitor instance multiple times results in an over-release condition, even in a Garbage Collected environment._

Swift usage

I'm wondering if you could give a quick example of how to use this from inside Swift? I have created the MyProject-Bridging-Header.h containing #import "AXStatusItemPopup.h" and can now do the following:

var image = NSImage(named: "cloud")
var altImage = NSImage(named: "cloudgrey")

var myPopup = AXStatusItemPopup()

but that's as far as I can work out. Xcode's autocomplete suggests the following, which makes no sense to me and doesn't seem to align with any of the methods defined on AXStatusItemPopup:

myPopup.view(<#view: NSView?#>, stringForToolTip: <#NSToolTipTag#>, point: NSPoint, userData: <#CMutableVoidPointer#>)

Swift issue (EXC_BAD_ACCESS)

I've used AXStatusItemPopup in my Swift app and it worked great until Xcode 6 b5, where it still compiles fine, but when I click the icon in the menubar, my app crashes with EXC_BAD_ACCESS at the following line in AXStatusItemPopup.m:

[_popover showRelativeToRect:self.frame ofView:self preferredEdge:NSMinYEdge];

I'd be incredibly grateful if someone had a moment to pull in my code and have a look. I've tried everything I can think of without success.

The code is at https://github.com/jeff-h/duckdns

Popover not selected

Hey, thanks for sharing this great class! It's very helpful for me to figure out NSPopover, as I'm still unfamiliar with obj-c. I'm running into a bit of a problem trying to use it though. Buttons, text fields, etc. in the popover remain inactive after the popover gets shown. In fact, text fields seem to be completely uneditable.

I'm pretty sure this isn't anything specific to my project, since the same problem occurs when I add a text field to the demo project (see screenshot).

screenshot

I've spent a while trying to figure out what's going wrong, but I have no idea. My only thought right now is that perhaps it's because the NSPopover is being called by an NSViewController, rather than an NSWindowController <NSPopoverDelegate> (but again, I'm unfamiliar with obj-c, so this may be irrelevant).

Dark mode bar Yosemite problem and popover view

Hello first forgive me if this issue is completely irrelevant with the AXStatusItemPopup, but i have a problem in yosemite.
i have made 2 views inside the popover viewcontroller , an apple's ABPersonView and ABPeoplePickerView so i can select and display a contact.
When i switch to dark mode From general -> Use dark menu bar and Dock, these 2 views are not displayed correctly. (They have black artifacts or the letters are not shown correctly)

https://www.dropbox.com/s/4wsx18uno4zh672/nodarkmode.png?dl=0
https://www.dropbox.com/s/ocwh7fxrot7ziak/darkmode.png?dl=0
https://www.dropbox.com/s/4cjxcmivetsjqyi/issue.zip?dl=0

Do you know or have any hints as why this is happening?
I am quite new to cocoa and unable to figure this out, Is it a view drawing issue or something else.

I ve shared the project file and 2 before and after pictures that show the issue.

Yosemite / 10.10 initial window positioning wrong

I've just installed 10.10 and notice that my popup window is opening on first run in the lower left hand side of the screen. When I click the icon in my menubar things revert to correct behaviour, with the popup positioned directly underneath the icon in the menubar.

Is anyone else seeing this?

Crashing when using Pod, working fine if copied to project.

Fair warning: I'm new to Obj-C and all that it entails.

I have made a minimum example here using CocoaPods: https://github.com/rasmuslp/AXStatusItemPopupCrash
Just download zip, open workspace, build/run, and press on cloud in menubar.
For me, this stalls on line 161:

        [_popover showRelativeToRect:self.frame ofView:self preferredEdge:NSMinYEdge];

With the message

2014-01-06 21:30:40.791 AXStatusItemPopupCrash[12696:303] -[NSLock view]: unrecognized selector sent to instance 0x6000000deca0
2014-01-06 21:30:40.792 AXStatusItemPopupCrash[12696:303] -[NSLock view]: unrecognized selector sent to instance 0x6000000deca0
2014-01-06 21:30:40.795 AXStatusItemPopupCrash[12696:303] (
    0   CoreFoundation                      0x00007fff8d71b41c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff880f1e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8d71e2ed -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff8d6795b2 ___forwarding___ + 1010
    4   CoreFoundation                      0x00007fff8d679138 _CF_forwarding_prep_0 + 120
    5   AppKit                              0x00007fff926b83a2 -[NSPopover showRelativeToRect:ofView:preferredEdge:] + 172
    6   AXStatusItemPopupCrash              0x0000000100001d61 -[AXStatusItemPopup showPopoverAnimated:] + 513
    7   AXStatusItemPopupCrash              0x0000000100001b57 -[AXStatusItemPopup showPopover] + 55
    8   AXStatusItemPopupCrash              0x0000000100001655 -[AXStatusItemPopup mouseDown:] + 101
    9   AppKit                              0x00007fff92614d9a forwardMethod + 122
    10  AppKit                              0x00007fff92697373 -[NSControl mouseDown:] + 1080
    11  AppKit                              0x00007fff92618d08 -[NSWindow sendEvent:] + 11296
    12  AppKit                              0x00007fff9271411b -[NSStatusBarWindow sendEvent:] + 247
    13  AppKit                              0x00007fff92a8b461 -[NSStatusItemReplicant _retargetEvent:fromWindow:] + 765
    14  AppKit                              0x00007fff927140f5 -[NSStatusBarWindow sendEvent:] + 209
    15  AppKit                              0x00007fff925b7744 -[NSApplication sendEvent:] + 2021
    16  AppKit                              0x00007fff92407a29 -[NSApplication run] + 646
    17  AppKit                              0x00007fff923f2803 NSApplicationMain + 940
    18  AXStatusItemPopupCrash              0x0000000100001042 main + 34
    19  libdyld.dylib                       0x00007fff88ff75fd start + 1
)

Sometimes, instead of NSLock, I get the error on the runloop queue:

2014-01-06 21:32:41.093 AXStatusItemPopupCrash[12776:303] -[OS_dispatch_queue_runloop view]: unrecognized selector sent to instance 0x6080000ca100
<snip>

If I remove the Pod of AXStatusItemPopup, and add the two files to the root group of the project, then it works like expected. Hence, it seems to be related to the podspec or a consequence thereof.

Any idea whats going on here ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.