开发者

Handling events in NSWindow

开发者 https://www.devze.com 2023-03-22 22:32 出处:网络
I\'m trying to handle key events of full-screen NSWindow. I\'ve subclassed NSWindow and realized methods keyDown and canBecomeKeyWindow (which is returning YES). But my key events are not handling. He

I'm trying to handle key events of full-screen NSWindow. I've subclassed NSWindow and realized methods keyDown and canBecomeKeyWindow (which is returning YES). But my key events are not handling. Here is how i'm creating window:

    mainWindow = [[FullScreenWindow alloc] initWithContentRect:screenRect
                                             styleMask:NSBorderlessWindowMask
                                               backing:NSBackingStoreBuffered
                                                 defer:NO screen:[NSScreen m开发者_StackOverflow社区ainScreen]];

    [mainWindow setLevel:windowLevel];

    [mainWindow setBackgroundColor:[NSColor blackColor]];
    [mainWindow makeKeyAndOrderFront:nil];

Where FullScreenWindow is a subclass of NSWindow. What am i doing wrong?


The esc key already exists fullscreen by default, you don't have to implement It (tested on 10.10.4).

0

精彩评论

暂无评论...
验证码 换一张
取 消