小编use*_*106的帖子

NSWindow 不接收键盘事件

我以编程方式创建 NSWindow,但无法收到任何键盘消息。我没有在 Xcode 编辑器中输入,但此时我的窗口处于焦点状态。我怎样才能拦截这个事件?

这是我的代码:

//// delegate
@interface MyDelegate : NSObject
@end
@implementation MyDelegate
@end

//// view
@interface MyView : NSView
@end

@implementation MyView

- (BOOL)isOpaque { return YES;}
- (BOOL)canBecomeKeyView { return YES;}
- (BOOL)acceptsFirstResponder { return YES;}

- (void)keyDown:(NSEvent *)event
{
    printf("PRESS\n"); // it's ignoring
}

@end

//// main
int main(int argc, const char **argv){
    [NSApplication sharedApplication];

    NSWindow *window = [[NSWindow alloc]
              initWithContentRect:NSMakeRect( 0, 0, 100, 100 )
              styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask
              backing:NSBackingStoreBuffered
              defer:NO];
    [window setContentView: [[MyView …
Run Code Online (Sandbox Code Playgroud)

keyboard events objective-c nswindow

6
推荐指数
1
解决办法
920
查看次数

Adreno 420驱动程序中的Android 6.0 Nexus 6 Crash

我正在使用OpenGL多个共享上下文GLSurfaceView.从一个活动切换到另一个活动后,adreno驱动程序崩溃.但我的应用程序在其他设备上运行良好.此外,如果我用正常上下文替换共享上下文,它也有效.它是驱动程序中的错误吗?

这是崩溃日志:

11-03 14:03:39.358: A/libc(7900): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x20c in tid 8012 (GLThread 1247)
11-03 14:03:39.460: A/DEBUG(1596): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-03 14:03:39.460: A/DEBUG(1596): Build fingerprint: 'google/shamu/shamu:6.0/MRA58K/2256973:user/release-keys'
11-03 14:03:39.460: A/DEBUG(1596): Revision: '0'
11-03 14:03:39.460: A/DEBUG(1596): ABI: 'arm'
11-03 14:03:39.461: A/DEBUG(1596): pid: 7900, tid: 8012, name: GLThread 1247  >>> com.example.app <<<
11-03 14:03:39.461: A/DEBUG(1596): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), …
Run Code Online (Sandbox Code Playgroud)

crash android opengl-es-2.0 android-6.0-marshmallow

5
推荐指数
0
解决办法
465
查看次数