osx - OS X / cocoa - How get event on lock screen session -
#import "appdelegate.h" @interface appdelegate () @property (weak) iboutlet nswindow *jj; @end @implementation appdelegate @synthesize jj; - (void)applicationdidfinishlaunching:(nsnotification *)anotification { // insert code here initialize application [nsevent addlocalmonitorforeventsmatchingmask:nseventmaskswipe | nseventmaskbegingesture | nseventmaskgesture | nseventmaskendgesture handler:^(nsevent *event) { nslog(@"local"); return event; }]; [nsevent addglobalmonitorforeventsmatchingmask:nseventmaskswipe | nseventmaskbegingesture | nseventmaskgesture | nseventmaskendgesture handler:^(nsevent *event) { nslog(@"global"); }]; nsdistributednotificationcenter* center; center = [nsdistributednotificationcenter defaultcenter]; [center addobserver:self selector:@selector(a) name:@"com.apple.screenislocked" object:nil]; nswindow* = [[nsapplication sharedapplication] windows].firstobject; [a makekeyandorderfront:nil]; [a setlevel:kcgmaximumwindowlevel]; } - (void)a { nslog(@"sibar"); [[nsapplication sharedapplication] activateignoringotherapps:yes]; [nsevent addlocalmonitorforeventsmatchingmask:nseventmaskswipe | nseventmaskbegingesture | nseventmaskgesture | nseventmaskendgesture handler:^(nsevent *event) { nslog(@"local"); return event; }]; } - (void)applicationwillterminate:(nsnotification *)anotification { // insert code here tear down application } @end
i want touch event when on lock screen
i want develop custom lock screen
so try show screen on lock screen , event
show screen slove [window makekeyandorderfront:nil];
but event not received
it because window , app can't focus
please me
// upload app on app store, need non-sandbox-violance solution
Comments
Post a Comment