Browse Source

Add cmd-q on mac;fixed file drop.

Mark Sibly 9 years ago
parent
commit
38c31d1898

+ 4 - 0
VERSIONS.TXT

@@ -1,4 +1,8 @@
 
+Fixed macos drop file.
+
+Added cmd-q causes closewindow event for macos.
+
 Tidied up chipmunk module.
 
 Added List.RemoveIf and Stack.RemoveIf.

BIN
bin/mx2cc_macos


+ 10 - 3
modules/mojo/app/app.monkey2

@@ -674,10 +674,18 @@ Class AppInstance
 			
 			_window=Window.WindowForID( kevent->windowID )
 			If Not _window Return
+
+			Local key:=Keyboard.KeyCodeToKey( Int( kevent->keysym.sym ) )
 			
-			_key=Keyboard.KeyCodeToKey( Int( kevent->keysym.sym ) )
+#If __TARGET__="macos"
+			If key=Key.Q And (Keyboard.Modifiers & Modifier.Menu)
+				If kevent->repeat_ Return
+				SendWindowEvent( EventType.WindowClose )
+				Return
+			Endif
+#Endif
+			_key=key
 			_rawKey=Keyboard.ScanCodeToRawKey( Int( kevent->keysym.scancode ) )
-'			_modifiers=Keyboard.Modifiers
 			_keyChar=Keyboard.KeyName( _key )
 			
 			If kevent->repeat_
@@ -697,7 +705,6 @@ Class AppInstance
 			
 			_key=Keyboard.KeyCodeToKey( Int( kevent->keysym.sym ) )
 			_rawKey=Keyboard.ScanCodeToRawKey( Int( kevent->keysym.scancode ) )
-'			_modifiers=Keyboard.Modifiers
 			_keyChar=Keyboard.KeyName( _key )
 			
 			SendKeyEvent( EventType.KeyUp )

+ 1 - 1
modules/sdl2/SDL/src/video/cocoa/SDL_cocoawindow.m

@@ -135,7 +135,7 @@
     NSArray *array = [pasteboard propertyListForType:@"NSFilenamesPboardType"];
 
     for (NSString *path in array) {
-        NSURL *fileURL = [[NSURL fileURLWithPath:path] autorelease];
+        NSURL *fileURL = [NSURL fileURLWithPath:path];
         NSNumber *isAlias = nil;
 
         [fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil];

+ 5 - 0
src/ted2/fileactions.monkey2

@@ -62,10 +62,15 @@ Class FileActions
 		
 		quit=New Action( "Quit" )
 		quit.Triggered=OnQuit
+
 #if __HOSTOS__="macos"
 		quit.HotKey=Key.Q
 		quit.HotKeyModifiers=Modifier.Menu
+#Else
+		quit.HotKey=Key.F4
+		quit.HotKeyModifiers=Modifier.Alt
 #endif		
+
 	End
 	
 	Method Update()