Search
lxdream.org :: lxdream/src/cocoaui/cocoa_win.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/cocoaui/cocoa_win.c
changeset 780:4e4ea322cb84
prev757:2780bc393e7c
next786:8f6ece92500e
author nkeynes
date Mon Jul 28 10:13:13 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Move grab management to window
Clear grab if the window loses key focus (probably a good idea in general)
file annotate diff log raw
1.1 --- a/src/cocoaui/cocoa_win.c Mon Jul 21 00:16:09 2008 +0000
1.2 +++ b/src/cocoaui/cocoa_win.c Mon Jul 28 10:13:13 2008 +0000
1.3 @@ -131,8 +131,9 @@
1.4 return nil;
1.5 } else {
1.6 isGrabbed = NO;
1.7 - video = video_osx_create_drawable();
1.8 + video = (LxdreamVideoView *)video_osx_create_drawable();
1.9 [video setFrameOrigin: NSMakePoint(0.0,STATUSBAR_HEIGHT)];
1.10 + [video setDelegate: self];
1.11
1.12 status =
1.13 [[NSTextField alloc] initWithFrame: NSMakeRect(0.0,0.0,videoRect.size.width,STATUS_TEXT_HEIGHT)];
1.14 @@ -198,9 +199,25 @@
1.15 if( grab != isGrabbed ) {
1.16 isGrabbed = grab;
1.17 [self setRunning: dreamcast_is_running() ? YES : NO];
1.18 +
1.19 + if( isGrabbed ) {
1.20 + [NSCursor hide];
1.21 + CGAssociateMouseAndMouseCursorPosition(NO);
1.22 + } else {
1.23 + [NSCursor unhide];
1.24 + CGAssociateMouseAndMouseCursorPosition(YES);
1.25 + }
1.26 + [video setIsGrabbed: isGrabbed];
1.27 }
1.28 }
1.29 -
1.30 +- (void)viewRequestedGrab: (id)sender
1.31 +{
1.32 + [self setIsGrabbed: YES];
1.33 +}
1.34 +- (void)viewRequestedUngrab: (id)sender
1.35 +{
1.36 + [self setIsGrabbed: NO];
1.37 +}
1.38 @end
1.39
1.40 NSWindow *cocoa_gui_create_main_window()
.