MacOSX USB tablet support

Javier Diaz-Reinoso javier_diaz_r at mac.com
Sun Apr 11 16:39:22 UTC 2004


I trace the slowdown in the squeak UI to WorldState>>interCyclePause:  
which depending of the higherPerformance flag put a delay of 1 or 20  
mSec for each event (and the tablet sends a lot of events).

If I replace the lines in EventSensor>>fetchMoreEvents :
	type _ eventBuffer at: 1.
	type = EventTypeNone] whileFalse:[self processEvent: eventBuffer].
by:
	type _ eventBuffer at: 1.
  	type = EventTypeTablet ifTrue:[self processTabletEvent: eventBuffer].
	(type = EventTypeNone) or:[type = EventTypeTablet]] whileFalse:[
		self processEvent: eventBuffer].

Where processTabletEvent only update a array, wich is then used by  
EventSensor>>tabletPoint (replace Sensor>> tabletPoint),  
EventSensor>>tabletPressure, etc.. the slowdown is eliminated, the Pen  
tablet drawing examples work OK, but this solution is not Morphic  
clean.

On 11/04/2004, at 03:12, John M McIntosh wrote:

> Javier Diaz=Reinoso had sent me this note a month (or two) back  
> regarding support the USB tablets in the VM. He supplied some changes  
> to the VM source and the EventSensor logic.  I'm wondering if there is  
> broader interest? Mostly since I was in messing with sqMacUIEvents.c  
> all day yesterday and maybe we should integrate his changes.
>
> I'll note most of this is support by carbon events found starting here:
> http://developer.apple.com/documentation/Carbon/Reference/ 
> Carbon_Event_Manager_Ref/CarbonEventsRef/enum_group_10.html
>
>
>> Hello!, I have now a working VM with the USB tablet support working,  
>> I follow your advice and add a EventTypeTablet to the VM and the  
>> squeak image, the changes are very small and the tablet examples work  
>> very well.
>>
>> That is the good news, the bad news is that squeak UI now are very  
>> slow, sending the new event alone cause this slowdown, I see you have  
>> a ignoreLastEvent() optimization in the mouse events, I tested the VM  
>> commenting this routine, this cause squeak to burn CPU but the UI  
>> response to the clicks are fast, in the case of the tablet the  
>> response to a click are very slow (about 2 secs. in a dual 1.8Ghz G5)  
>> and also use more CPU, I am sending my changes so you can review if  
>> something is missing, specially I don't know if in the squeak image  
>> part some code is needed to process the new events faster.
>>
>> By the way I am using the NoEventSensorProcess-ar.3.cs with a  
>> Squeak3.6-5424 image, the VM sources I download from CVS about 2  
>> weeks ago.
>>
>> Regards.
>>
>> Javier Diaz-Reinoso
>> Web: http://homepage.mac.com/javier_diaz_r/
>
> PS the event which is created in C is:
>
> 		evt->type = EventTypeTablet;
> 		evt->timeStamp = ioMSecs() & 536870911;
> 		/* pack data to fit in 24 bytes*/
> 		evt->unused1 = tabletData->absX;
> 		evt->unused2 = tabletData->absY;
> 		evt->unused3 = tabletData->absZ;
> 		evt->unused4 = (tabletData->buttons << 16) | (tabletData->pressure);
> 		evt->unused5 = (tabletData->tiltX << 16) | (tabletData->tiltY);
> 		evt->unused6 = (tabletData->rotation << 16) |  
> (tabletData->tangentialPressure);
>
> See
> http://developer.apple.com/documentation/Carbon/Reference/ 
> Carbon_Event_Manager_Ref/CarbonEventsRef/data_type_31.html
>
> --
> ======================================================================= 
> ====
> John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ======================================================================= 
> ====
>
>
>
Javier Diaz-Reinoso
Web: http://homepage.mac.com/javier_diaz_r/




More information about the Squeak-dev mailing list