Thanks We should definitively invest in this part of the infrastructure. I wanted to know on your machine the mouse wheel does not work because on mac in the latest version I can use it. Stef On Feb 20, 2010, at 11:55 AM, Ch Lamprecht wrote:
Stéphane Ducasse schrieb:
Thanks chris. I never got the time to sit and read all the changes mike did for the inputEvent logic so my knowledge is bad in that area. Now I was wondering when your mouse wheel turns to get button down events?
Hello,
See comment on MouseWheelEvent class - thats why I thought mapping to (ctrl+up/down arrow) is the pharo way to do it. Also that's what I can see coming in (examining InputEventFetcher) on WinXP when I use a mousewheel. I think MouseWheel is not cross platform compatible. Linux/X11 uses Buttons 4-5 instead.
BTW "mouse event" ((eventBuffer at: 5) anyMask: 1)
do you know if it would be possible to have eventBuffer isMouseEvent instead of the above?
unfortunately the object assigned to eventBuffer is an ordinary Array containing 'raw' event information. ( Described in comment on InputEventFetcher ). That is why I thought, there could be a place to make such things configurable on a higher level (dealing with event objects rather than raw data). Btw. I got confused with the Button colours: Comments should refer to blue Button not yellow.
Thanks, Chris
Stef
Running Pharo on an IBM Thinkpad with a trackpoint input device, I was a bit disappointed, that the autoscroll feature does not work in Pharo (pressing Button-2 and moving the mouse pointer should scroll the window below the mouse pointer). I took it as an exercise and the attached code does what I want, but it does not feel right (like not at the the right 'level'): Is there a place in the Morph hierarchy where such behavior changes could be plugged in? Or did I overlook a preference setting ;) ?
:)
Cheers, Chris
Object subclass: #InputEventFetcher instanceVariableNames: 'eventHandlers fetcherProcess inputSemaphore mousewheel ycoord' classVariableNames: 'Default' poolDictionaries: 'EventSensorConstants' category: 'Kernel-Processes'
InputEventFetcher>> signalEvent: eventBuffer "Signal the event buffer to all registered event handlers. Handlers need make sure to copy the buffer or extract the data otherwise, as the buffer will be reused."
self simulateMousewheel: eventBuffer.
self eventHandlers do: [:handler | handler handleEvent: eventBuffer]
InputEventFetcher>> simulateMousewheel: eventBuffer "MOusewheel up: 2 time 30 0 2 0 0 1 MOusewheel down: 2 time 31 0 2 0 0 1 "
| ycur keysym up down | keysym := nil. up := 30. down := 31. (eventBuffer at: 1) = 1 ifTrue: [ "mouse event" ((eventBuffer at: 5) anyMask: 1) ifTrue: [ "yellow button down" mousewheel ifFalse: [ "first time: do nothing" mousewheel := true. ycoord := eventBuffer at: 4 ] ifTrue: [ "handle movement" ycur := eventBuffer at: 4. ycur - ycoord > 1 ifTrue: [ keysym := down. ycoord := ycur ]. ycur - ycoord < -1 ifTrue: [ keysym := up. ycoord := ycur ]. keysym isNil ifTrue: [ "make it a Null event" eventBuffer at: 1 put: 0 ] ifFalse: [ eventBuffer at: 1 put: 2. eventBuffer at: 3 put: keysym. eventBuffer replaceFrom: 4 to: 8 with: #(0 2 0 0 1) ] ] ] ifFalse: [ "yellowbutton up" mousewheel := false ] ]. ^ eventBuffer_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project