[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [265] branches/fusegl/fuse
Brought to you by:
fredm
From: <fr...@us...> - 2006-12-26 06:31:13
|
Revision: 265 http://svn.sourceforge.net/fuse-for-macosx/?rev=265&view=rev Author: fredm Date: 2006-12-25 22:31:11 -0800 (Mon, 25 Dec 2006) Log Message: ----------- * Restore mouse support * Enforce standard aspect ratio when window is resized Modified Paths: -------------- branches/fusegl/fuse/TODO branches/fusegl/fuse/fusepb/controllers/FuseController.h branches/fusegl/fuse/fusepb/controllers/FuseController.m branches/fusegl/fuse/fusepb/main.mm branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/info.nib branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m branches/fusegl/fuse/ui/cocoa/cocoaui.h branches/fusegl/fuse/ui/cocoa/cocoaui.m Modified: branches/fusegl/fuse/TODO =================================================================== --- branches/fusegl/fuse/TODO 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/TODO 2006-12-26 06:31:11 UTC (rev 265) @@ -7,11 +7,15 @@ X Add native keyboard processing (removes SDL keyboard input dependency from Fuse) X Add native CoreAudio sound processing (removes SDL sound dependency from Fuse) -* Fix menus, preferences etc. -* Fix scalers +X Fix menus, preferences etc. +X Add native mouse processing (removes SDL mouse input dependency from Fuse) +X Make it possible to constrain Speccy image to "correct" aspect ratio * Add native joystick processing (removes SDL joystick input dependency from Fuse) -* Add native mouse processing (removes SDL mouse input dependency from Fuse) * Restore fullscreen support +* Fix scalers +* Use sheets rather than modal dialogs +* Run emulation in seperate thread to avoid sound glitches when menus are + selected $Id: TODO,v 1.4 2004/03/02 13:38:08 pak21 Exp $ Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.h =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.h 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.h 2006-12-26 06:31:11 UTC (rev 265) @@ -161,4 +161,6 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; +- (void)setAcceptsMouseMovedEvents:(BOOL)flag; + @end Modified: branches/fusegl/fuse/fusepb/controllers/FuseController.m =================================================================== --- branches/fusegl/fuse/fusepb/controllers/FuseController.m 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/fusepb/controllers/FuseController.m 2006-12-26 06:31:11 UTC (rev 265) @@ -1406,6 +1406,11 @@ return YES; } +- (void)setAcceptsMouseMovedEvents:(BOOL)flag +{ + [window setAcceptsMouseMovedEvents:flag]; +} + @end static char* Modified: branches/fusegl/fuse/fusepb/main.mm =================================================================== --- branches/fusegl/fuse/fusepb/main.mm 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/fusepb/main.mm 2006-12-26 06:31:11 UTC (rev 265) @@ -45,14 +45,6 @@ int error = settings_defaults( &settings_current ); if( error ) return error; -#if 0 - // FIXME: Do all the stuff that SDLMain.mm used - // to do command line wise, drag-n-drop etc. here? - if( fuse_init( argc, argv ) ) { - fprintf( stderr, "%s: error initialising -- giving up!\n", fuse_progname ); - return 1; - } -#endif /* This is passed if we are launched by double-clicking */ if ( argc >= 2 && strncmp( argv[1], "-psn", 4 ) == 0 ) { Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/info.nib =================================================================== --- branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/info.nib 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/info.nib 2006-12-26 06:31:11 UTC (rev 265) @@ -13,8 +13,8 @@ <string>446.1</string> <key>IBOpenObjects</key> <array> + <integer>877</integer> <integer>29</integer> - <integer>877</integer> </array> <key>IBSystem Version</key> <string>8L2127</string> Modified: branches/fusegl/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.h 2006-12-26 06:31:11 UTC (rev 265) @@ -66,6 +66,14 @@ -(id) initWithFrame:(NSRect)frameRect; -(void) awakeFromNib; +-(void) mouseMoved:(NSEvent *)theEvent; +-(void) mouseDown:(NSEvent *)theEvent; +-(void) mouseUp:(NSEvent *)theEvent; +-(void) rightMouseDown:(NSEvent *)theEvent; +-(void) rightMouseUp:(NSEvent *)theEvent; +-(void) otherMouseDown:(NSEvent *)theEvent; +-(void) otherMouseUp:(NSEvent *)theEvent; + -(void) initKeyboard; -(void) modifierChange:(input_event_type)theType oldState:(BOOL)old newState:(BOOL)new; -(void) flagsChanged:(NSEvent *)theEvent; Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2006-12-26 06:31:11 UTC (rev 265) @@ -140,9 +140,9 @@ -(void) awakeFromNib { - /* FIXME: Do all the stuff that SDLMain.mm used - * to do command line wise, drag-n-drop etc. here? - */ + /* keep the window in the standard aspect ratio if the user resizes */ + [[self window] setContentAspectRatio:NSMakeSize(4.0,3.0)]; + /* FIXME: Don't really like the argc, argv stuff being here... */ if( fuse_init( ac, av ) ) { fprintf( stderr, "%s: error initialising -- giving up!\n", fuse_progname ); @@ -334,14 +334,52 @@ userInfo:self repeats:true] retain]; } --(void) mouseDragged:(NSEvent *)theEvent +-(void) mouseMoved:(NSEvent *)theEvent { + if( ui_mouse_grabbed ) { + int dx = [theEvent deltaX]; + int dy = [theEvent deltaY]; + + if( dx < -128 ) dx = -128; + else if( dx > 128 ) dx = 128; + + if( dy < -128 ) dy = -128; + else if( dy > 128 ) dy = 128; + + ui_mouse_motion( dx, dy ); + } } -(void) mouseDown:(NSEvent *)theEvent { + ui_mouse_button( 1, 1 ); } +-(void) mouseUp:(NSEvent *)theEvent +{ + ui_mouse_button( 1, 0 ); +} + +-(void) rightMouseDown:(NSEvent *)theEvent +{ + ui_mouse_button( 3, 1 ); +} + +-(void) rightMouseUp:(NSEvent *)theEvent +{ + ui_mouse_button( 3, 0 ); +} + +-(void) otherMouseDown:(NSEvent *)theEvent +{ + ui_mouse_button( 2, 1 ); +} + +-(void) otherMouseUp:(NSEvent *)theEvent +{ + ui_mouse_button( 2, 0 ); +} + -(void) initKeyboard { keysyms_map_t *ptr3; @@ -420,6 +458,10 @@ } fuse_event.type = type; + if( unicode_keysym == INPUT_KEY_NONE ) + fuse_event.types.key.native_key = fuse_keysym; + else + fuse_event.types.key.native_key = unicode_keysym; fuse_event.types.key.spectrum_key = fuse_keysym; input_event( &fuse_event ); Modified: branches/fusegl/fuse/ui/cocoa/cocoaui.h =================================================================== --- branches/fusegl/fuse/ui/cocoa/cocoaui.h 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/ui/cocoa/cocoaui.h 2006-12-26 06:31:11 UTC (rev 265) @@ -24,5 +24,4 @@ */ -void cocoaui_quit( void ); int cocoaui_confirm( const char *message ); Modified: branches/fusegl/fuse/ui/cocoa/cocoaui.m =================================================================== --- branches/fusegl/fuse/ui/cocoa/cocoaui.m 2006-12-25 04:27:24 UTC (rev 264) +++ branches/fusegl/fuse/ui/cocoa/cocoaui.m 2006-12-26 06:31:11 UTC (rev 265) @@ -40,10 +40,13 @@ #include "tape.h" #include "ui/scaler/scaler.h" +/* Last position of the cursor before we hide it */ +static NSPoint position; + int ui_init( int *argc, char ***argv ) { - int error; + ui_mouse_present = 1; return 0; } @@ -57,8 +60,6 @@ int ui_end( void ) { - int error; - return 0; } @@ -71,12 +72,32 @@ int ui_mouse_grab( int startup ) { - return 0; + if( startup ) return 0; + + position = [NSEvent mouseLocation]; + + [NSCursor hide]; + + [[FuseController singleton] setAcceptsMouseMovedEvents:YES]; + + return 1; } int -ui_mouse_release( int suspend ) +ui_mouse_release( int suspend GCC_UNUSED ) { + [[FuseController singleton] setAcceptsMouseMovedEvents:NO]; + + /* This seems to be the only API to put the cursor back where it was when + we hid it. The CGSetLocalEventsSuppressionInterval is a magic workaround + to prevent the cursor freezing for a couple of seconds following the + warp */ + CGPoint pos; pos.x = position.x; pos.y = position.y; + CGSetLocalEventsSuppressionInterval(0.0); + CGWarpMouseCursorPosition(pos); + + [NSCursor unhide]; + return 0; } @@ -85,10 +106,6 @@ ui_widgets_reset( void ) { pokefinder_clear(); + return 0; } - -void -cocoaui_quit( void ) -{ -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |