[Vm-dev] OSX VM doesn't generate events for modifier keypresses
(shift, ctrl, etc)
Ben Coman
btc at openInWorld.com
Sat Nov 29 02:22:00 UTC 2014
Eliot Miranda wrote:
> So Ben please send a change set if you can.
Is the attached file sufficient?
cheers -ben
-------------- next part --------------
diff --git a/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m b/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m
index ee794dd..f861db9 100644
--- a/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m
+++ b/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m
@@ -73,6 +73,7 @@
ioProcessEvents();
id event = [eventQueue returnAndRemoveOldest];
if (event) {
+ /* NSLog(@"ioGetNextEvent:"); */
NSAutoreleasePool * pool = [NSAutoreleasePool new];
[self processAsOldEventOrComplexEvent: event placeIn: evt];
[event release];
diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.h b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.h
index 1d2aa7c..1cbc2db 100644
--- a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.h
+++ b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.h
@@ -43,6 +43,7 @@
@interface sqSqueakOSXApplication (events)
- (void) recordCharEvent:(NSString *) unicodeString fromView: (NSView<sqSqueakOSXView> *) mainView;
+- (void) recordKeyDownEvent:(NSEvent *)theEvent fromView: (NSView<sqSqueakOSXView> *) aView ;
- (void) recordKeyUpEvent:(NSEvent *)theEvent fromView: (NSView<sqSqueakOSXView> *) aView ;
- (void) recordMouseEvent: (NSEvent*) theEvent fromView: (NSView<sqSqueakOSXView> *) aView;
- (void) recordWheelEvent: (NSEvent*) theEvent fromView: (NSView<sqSqueakOSXView> *) aView;
diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m
index f3d6d32..b3e1580 100644
--- a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m
+++ b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m
@@ -157,6 +157,8 @@ static int buttonState=0;
- (void) pushEventToQueue: (sqInputEvent *) evt {
NSMutableArray* data = [NSMutableArray new];
+
+// NSLog(@"sqSqueakOSXApplication+events.m>>pushEventToQueue:");
[data addObject: [NSNumber numberWithInteger: 1]];
[data addObject: [NSData dataWithBytes:(const void *) evt length: sizeof(sqInputEvent)]];
[eventQueue addItem: data];
@@ -171,6 +173,7 @@ static int buttonState=0;
NSRange picker;
NSUInteger totaLength;
+// NSLog(@"sqSqueakOSXApplication+events>>recordCharEvent:fromView:");
evt.type = EventTypeKeyboard;
evt.timeStamp = (int) ioMSecs();
picker.location = 0;
@@ -227,6 +230,22 @@ static int buttonState=0;
}
+- (void) recordKeyDownEvent:(NSEvent *)theEvent fromView: (NSView<sqSqueakOSXView>*) aView {
+ sqKeyboardEvent evt;
+
+ evt.type = EventTypeKeyboard;
+ evt.timeStamp = (int) ioMSecs();
+ evt.charCode = [theEvent keyCode];
+ evt.pressCode = EventKeyDown;
+ evt.modifiers = [self translateCocoaModifiersToSqueakModifiers: [theEvent modifierFlags]];
+ evt.utf32Code = 0;
+ evt.reserved1 = 0;
+ evt.windowIndex = (int)[[aView windowLogic] windowIndex];
+ [self pushEventToQueue: (sqInputEvent *) &evt];
+
+ interpreterProxy->signalSemaphoreWithIndex(gDelegateApp.squeakApplication.inputSemaphoreIndex);
+}
+
- (void) recordKeyUpEvent:(NSEvent *)theEvent fromView: (NSView<sqSqueakOSXView>*) aView {
sqKeyboardEvent evt;
diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m b/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
index 0a1f9fe..5a9480e 100644
--- a/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
+++ b/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
@@ -339,6 +339,7 @@ lastSeenKeyBoardModifierDetails,dragInProgress,dragCount,dragItems,windowLogic,s
NSArray *down = [[NSArray alloc] initWithObjects: theEvent,nil];
@synchronized(self) {
lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;
+
NSString *possibleConversion = [theEvent characters];
if ([possibleConversion length] > 0) {
@@ -357,6 +358,7 @@ lastSeenKeyBoardModifierDetails,dragInProgress,dragCount,dragItems,windowLogic,s
aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
NSArray *down = [[NSArray alloc] initWithObjects: theEvent,nil];
+// NSLog(@"sqSqueakOSXCGView.m>>keyDown:");
@synchronized(self) {
lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;
[self interpretKeyEvents: down];
@@ -373,19 +375,24 @@ lastSeenKeyBoardModifierDetails,dragInProgress,dragCount,dragItems,windowLogic,s
- (void)insertText:(id)aString
{
+// NSLog(@"sqSqueakOSXCGView.m>>insertText:");
+
[(sqSqueakOSXApplication *) gDelegateApp.squeakApplication recordCharEvent: aString fromView: self];
}
- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
{
+// NSLog(@"sqSqueakOSXCGView.m>>insertText:replacementRange:");
[(sqSqueakOSXApplication *) gDelegateApp.squeakApplication recordCharEvent: aString fromView: self];
}
- (void)flagsChanged:(NSEvent *)theEvent {
+// NSLog(@"sqSqueakOSXCGView.m>>flagsChanged -- %d, %d", [theEvent keyCode], [theEvent modifierFlags] );
keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[keyBoardStrokeDetails alloc] init];
aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
self.lastSeenKeyBoardModifierDetails = aKeyBoardStrokeDetails;
+ [(sqSqueakOSXApplication *) gDelegateApp.squeakApplication recordKeyDownEvent: theEvent fromView: self];
[aKeyBoardStrokeDetails release];
}
@@ -677,4 +684,4 @@ lastSeenKeyBoardModifierDetails,dragInProgress,dragCount,dragItems,windowLogic,s
}
}
- at end
\ No newline at end of file
+ at end
More information about the Vm-dev
mailing list