Post

Replies

Boosts

Views

Activity

Reply to RegisterEventHotKey failed
Registration failed, check your inHotKeyModifiers parameter UInt32 keyCode = kVK_ANSI_Keypad1;   EventHotKeyID gMyHotKeyID;   gMyHotKeyID.signature = (FourCharCode)'1234';   gMyHotKeyID.id = 1;   EventHotKeyRef hotKeyRef;   OSStatus status = RegisterEventHotKey(keyCode, cmdKey, gMyHotKeyID, GetApplicationEventTarget(), 0, &hotKeyRef);   if (status == noErr) {     NSLog(@"success!");   } else {     NSLog(@"fail:%d", status);   }
Jun ’22
Reply to Make NSWindow show up on every workspace, even newly created ones after
1.Use NSPanel instead of NSWindow: window = [[NSPanel alloc] initWithContentRect:CGRectMake(100, 100, 400, 300) styleMask:NSWindowStyleMaskBorderless | NSWindowStyleMaskNonactivatingPanel backing:NSBackingStoreBuffered defer:NO];   window.level = NSMainMenuWindowLevel;   window.collectionBehavior = NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorFullScreenAuxiliary; 2.Watching NSWorkspaceActiveSpaceDidChangeNotification: [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(notifyChange) name:NSWorkspaceActiveSpaceDidChangeNotification object:nil]; - (void)notifyChange {   [window makeKeyAndOrderFront:nil]; }
Topic: UI Frameworks SubTopic: AppKit Tags:
May ’22
Reply to RegisterEventHotKey failed
Registration failed, check your inHotKeyModifiers parameter UInt32 keyCode = kVK_ANSI_Keypad1;   EventHotKeyID gMyHotKeyID;   gMyHotKeyID.signature = (FourCharCode)'1234';   gMyHotKeyID.id = 1;   EventHotKeyRef hotKeyRef;   OSStatus status = RegisterEventHotKey(keyCode, cmdKey, gMyHotKeyID, GetApplicationEventTarget(), 0, &hotKeyRef);   if (status == noErr) {     NSLog(@"success!");   } else {     NSLog(@"fail:%d", status);   }
Replies
Boosts
Views
Activity
Jun ’22
Reply to Make NSWindow show up on every workspace, even newly created ones after
1.Use NSPanel instead of NSWindow: window = [[NSPanel alloc] initWithContentRect:CGRectMake(100, 100, 400, 300) styleMask:NSWindowStyleMaskBorderless | NSWindowStyleMaskNonactivatingPanel backing:NSBackingStoreBuffered defer:NO];   window.level = NSMainMenuWindowLevel;   window.collectionBehavior = NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorFullScreenAuxiliary; 2.Watching NSWorkspaceActiveSpaceDidChangeNotification: [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(notifyChange) name:NSWorkspaceActiveSpaceDidChangeNotification object:nil]; - (void)notifyChange {   [window makeKeyAndOrderFront:nil]; }
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
May ’22