changeset 1236:46de4dbe710d

Fixed clickdefault not triggering event for buttons on Mac.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 18 Oct 2011 00:37:07 +0000
parents 9327f684c9b8
children f8673299ec37
files mac/dw.m
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Mon Oct 17 16:15:13 2011 +0000
+++ b/mac/dw.m	Tue Oct 18 00:37:07 2011 +0000
@@ -1036,7 +1036,10 @@
     unichar vk = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
     if(clickDefault && vk == VK_RETURN)
     {
-        [[self window] makeFirstResponder:clickDefault];
+        if([clickDefault isKindOfClass:[NSButton class]])
+            [clickDefault buttonClicked:self];
+        else
+            [[self window] makeFirstResponder:clickDefault];
     } else
     {
         [super keyUp:theEvent];
@@ -1079,7 +1082,10 @@
 {
     if(clickDefault && [[theEvent charactersIgnoringModifiers] characterAtIndex:0] == VK_RETURN)
     {
-        [[self window] makeFirstResponder:clickDefault];
+        if([clickDefault isKindOfClass:[NSButton class]])
+            [clickDefault buttonClicked:self];
+        else
+            [[self window] makeFirstResponder:clickDefault];
     }
     else
     {