[Vm-dev] OSX VM doesn't generate events for modifier keypresses (shift, ctrl, etc)

Ben Coman btc at openInWorld.com
Fri Nov 28 17:09:39 UTC 2014


I celebrate my first VM contribution :) :) :) with integration of [1] 
into pharo-vm on github.  Now how do I submit this for consideration for 
the SVN tree, to help keep things in syncd.
cheers -ben

Ben Coman wrote:
> 
> AliakseiSyrel reported that the OSX VM doesn't generate events on 
> shift/ctrl/command/options/capslock keypress, but Win32 and Linux do.
> (https://pharo.fogbugz.com/default.asp?14521)
> 
> I've submitted a fix to pharo-vm, but thought it might also be useful to 
> others, and was hoping for some review and discussion here...

> A diff can be seen here...
> [1] https://github.com/pharo-project/pharo-vm/pull/67/files
> 

> I discovered "recordCharEvent:fromView:" and "keyDown:" do not receive 
> modifier keypresses, however "flagsChanged:" does - as described by the 
> AppKit Reference "flagsChanged: informs the receiver that the user has 
> pressed or released a modifier key (Shift, Control, and so on)."
> 
> Just above "flagsChanged:" I noticed...
>     -(void)keyUp:(NSEvent*)theEvent {
>         [(sqSqueakOSXApplication *) gDelegateApp.squeakApplication
>             recordKeyUpEvent: theEvent fromView: self];
>     }
> 
> So I duplicated recordKeyUpEvent:fromView:
> as recordKeyDownEvent:fromView:
> changing only...
>         evt.pressCode = EventKeyUp;
> to...
>         evt.pressCode = EventKeyDown;
> 
> and called it from the bottom of flagsChanged:
> 
> ============
> Now in a test image, adding a debug Transcript after primGetNextEvent:
>     InputEventFetcher>>eventLoop
>         ...
>     [true] whileTrue: [
>         self waitForInput.
>         [self primGetNextEvent: eventBuffer.
>             Transcript crShow: Time now ; tab ; show: eventBuffer.
> 
> shows...
> 
> 11:41:18.9594 pm    #(2 182714 56 1 1 0 0 1) Shift down
> 11:41:18.959581 pm    #(0 0 0 0 0 0 0 0)
> 11:41:19.19321 pm    #(2 182948 56 1 0 0 0 1) Shift up
> 11:41:19.193543 pm    #(0 0 0 0 0 0 0 0)
> 11:41:21.04326 pm    #(2 184798 59 1 2 0 0 1) Control down
> 11:41:21.043494 pm    #(0 0 0 0 0 0 0 0)
> 11:41:21.346713 pm    #(2 185102 59 1 0 0 0 1) Control up
> 11:41:21.346934 pm    #(0 0 0 0 0 0 0 0)
> 11:41:21.814845 pm    #(2 185569 58 1 4 0 0 1) Option down
> 11:41:21.815136 pm    #(0 0 0 0 0 0 0 0)
> 11:41:22.137117 pm    #(2 185892 58 1 0 0 0 1) Option up
> 11:41:22.137374 pm    #(0 0 0 0 0 0 0 0)
> 11:43:28.593666 pm    #(2 312348 55 1 8 0 0 1) Cmd down
> 11:43:28.593854 pm    #(0 0 0 0 0 0 0 0)
> 11:43:29.014829 pm    #(2 312770 55 1 0 0 0 1) Cmd up
> 11:43:29.015011 pm    #(0 0 0 0 0 0 0 0)
> 11:41:43.762799 pm    #(2 207517 57 1 0 0 0 1) CapsLock down
> 
> CapsLock does not get a up-event per...
> https://bugzilla.mozilla.org/show_bug.cgi?id=259059
> 
> It perhaps can be simulated like...
> https://developer.apple.com/library/mac/qa/qa1519/_index.html
> 
> Thoughts?
> 



More information about the Vm-dev mailing list