[Cuis-dev] Pythagoras Tree Morph

Mariano Montone marianomontone at gmail.com
Fri Nov 4 09:08:44 PDT 2022


Ok. I don't know how horizontall scrolling is supposed to work. But 
let's say that horizontall scrolling is enabled when mouse scroll + 
modifier key.

Then, if I insert this hack, I can have it for Ctrl key here on Linux:

generateMouseScrollEvent: evtBuf
     "Generate the appropriate mouse wheel event for the given raw event 
buffer

     Copied from Sqeak 5.3 and modifed."

     | buttons modifiers stamp deltaX deltaY direction oldButtons |
     stamp 
 evtBuf second.
     stamp = 0 ifTrue: [stamp := Time millisecondClockValue ].
     deltaX 
 evtBuf third.
     deltaY 
 evtBuf fourth.
     "This implementation deliberatly ignores movements in both dimensions:"
     direction 

         deltaY negative
             ifTrue: [ #down ]
             ifFalse: [ deltaY strictlyPositive
                 ifTrue: [ #up ]
                 ifFalse: [ deltaX negative
                     ifTrue: [ #left ]
                     ifFalse: [ deltaX strictlyPositive
                         ifTrue: [ #right ]
                         ifFalse: [ 
 nil "No movement, bailing out" ] ] 
] ].
     modifiers 
 evtBuf fifth.
     buttons 
 (modifiers bitShift: 3) bitOr: (lastMouseEvent buttons 
bitAnd: 7).
     oldButtons 
 lastEventBuffer fifth
         bitOr: (lastEventBuffer sixth bitShift: 3).
     lastEventBuffer := evtBuf.
     "Hack"
     evtBuf sixth = 2 ifTrue: [
         direction = #up ifTrue: [direction 
 #right].
         direction = #down ifTrue: [direction 
 #left]].
     "End of hack"
     
 MouseScrollEvent new
         setType: #mouseScroll
         position: self morphPosition
         direction: direction
         buttons: (oldButtons bitXor: buttons)
         hand: self
         stamp: stamp


What I mean is, modifier keys are available in evtBuf. But I'm probably 
making up when an horizontal scrolling should be enabled.


     Mariano

El 4/11/22 a las 12:45, Mariano Montone escribió:
> El 4/11/22 a las 12:27, Juan Vuletich escribió:
>>> One thing: can you look at the code for changing the depth via 
>>> scroll + ctrl? Doesn't work here on Linux, and I don't know what I 
>>> may be doing wrong. It'd be great you can fix that detail.
>>
>> This seems to be a VM issue. If you hack #generateMouseScrollEvent: 
>> to do `evtBuf print`, you'll see that on the Mac it correctly reports 
>> both positive and negative deltas both in Y and X. On Linux it only 
>> reports negative X and positive Y. On Windows, it seems not to 
>> generate scroll events at all.
>>
>> I think this is worth discussing in vm-dev. 
>
> When I press Ctrl, or Alt, or Shift, plus MouseScroll, I see a 
> different mode indicator in the evtBuf. So, it is working, the 
> difference in the event is there. But I think it is not translated to 
> #left, #right to the Scroll event in Cuis. I'll try to have a closer look.
>
>
>     Mariano
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20221104/a9841fdc/attachment-0001.htm>


More information about the Cuis-dev mailing list