[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46383] trunk/blender/intern/ghost/intern: GHOST/Cocoa: detect tablet event to disable continuous grab.

Brecht Van Lommel brechtvanlommel at pandora.be
Mon May 7 14:21:32 CEST 2012


Campbell added code for this on X11 and added a note to implement it
for Mac/Windows. I can revert the code, but can't see any existing
code that is already doing this, where is it?

Brecht.

On Mon, May 7, 2012 at 2:06 PM, Jens Verwiebe <info at jensverwiebe.de> wrote:
> No, it disables nothing cause continous grab was disabled since ever on OSX for tablet to avoid flickering objects :)
> Dunno why you inroduced this now, afaik we don´t need it, but i now got odd behaviour with mouse and tablet attached.
>
> Guess we should take all this back on OSX ?
>
> Jens
>
>
>
> Am 07.05.2012 um 12:53 schrieb Brecht Van Lommel:
>
>> Revision: 46383
>>          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46383
>> Author:   blendix
>> Date:     2012-05-07 10:53:12 +0000 (Mon, 07 May 2012)
>> Log Message:
>> -----------
>> GHOST/Cocoa: detect tablet event to disable continuous grab. Don't have tablet
>> to test it though, can someone with Mac + tablet confirm if continuous grab
>> gets automatically disabled when using the tablet?
>>
>> Modified Paths:
>> --------------
>>    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
>>    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
>>
>> Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
>> ===================================================================
>> --- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h     2012-05-07 10:53:09 UTC (rev 46382)
>> +++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h     2012-05-07 10:53:12 UTC (rev 46383)
>> @@ -247,6 +247,7 @@
>>        * @return Indication whether the event was handled.
>>        */
>>       GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType);
>> +     bool handleTabletEvent(void *eventPtr);
>>
>>       /**
>>        * Handles a mouse event.
>>
>> Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
>> ===================================================================
>> --- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm    2012-05-07 10:53:09 UTC (rev 46382)
>> +++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm    2012-05-07 10:53:12 UTC (rev 46383)
>> @@ -1421,7 +1421,24 @@
>>       return GHOST_kSuccess;
>> }
>>
>> +bool GHOST_SystemCocoa::handleTabletEvent(void *eventPtr)
>> +{
>> +     NSEvent *event = (NSEvent *)eventPtr;
>>
>> +     switch ([event subtype]) {
>> +             case NX_SUBTYPE_TABLET_POINT:
>> +                     handleTabletEvent(eventPtr, NSTabletPoint);
>> +                     return true;
>> +             case NX_SUBTYPE_TABLET_PROXIMITY:
>> +                     handleTabletEvent(eventPtr, NSTabletProximity);
>> +                     return true;
>> +             default:
>> +                     //No tablet event included : do nothing
>> +                     return false;
>> +     }
>> +
>> +}
>> +
>> GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
>> {
>>       NSEvent *event = (NSEvent *)eventPtr;
>> @@ -1432,6 +1449,8 @@
>>               //printf("\nW failure for event 0x%x",[event type]);
>>               return GHOST_kFailure;
>>       }
>> +
>> +     bool is_tablet = false;
>>
>>       switch ([event type])
>>     {
>> @@ -1440,17 +1459,7 @@
>>               case NSOtherMouseDown:
>>                       pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber])));
>>                       //Handle tablet events combined with mouse events
>> -                     switch ([event subtype]) {
>> -                             case NX_SUBTYPE_TABLET_POINT:
>> -                                     handleTabletEvent(eventPtr, NSTabletPoint);
>> -                                     break;
>> -                             case NX_SUBTYPE_TABLET_PROXIMITY:
>> -                                     handleTabletEvent(eventPtr, NSTabletProximity);
>> -                                     break;
>> -                             default:
>> -                                     //No tablet event included : do nothing
>> -                                     break;
>> -                     }
>> +                     is_tablet = handleTabletEvent(event);
>>                       break;
>>
>>               case NSLeftMouseUp:
>> @@ -1458,45 +1467,21 @@
>>               case NSOtherMouseUp:
>>                       pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber])));
>>                       //Handle tablet events combined with mouse events
>> -                     switch ([event subtype]) {
>> -                             case NX_SUBTYPE_TABLET_POINT:
>> -                                     handleTabletEvent(eventPtr, NSTabletPoint);
>> -                                     break;
>> -                             case NX_SUBTYPE_TABLET_PROXIMITY:
>> -                                     handleTabletEvent(eventPtr, NSTabletProximity);
>> -                                     break;
>> -                             default:
>> -                                     //No tablet event included : do nothing
>> -                                     break;
>> -                     }
>> +                     is_tablet = handleTabletEvent(event);
>>                       break;
>>
>>               case NSLeftMouseDragged:
>>               case NSRightMouseDragged:
>>               case NSOtherMouseDragged:
>>                       //Handle tablet events combined with mouse events
>> -                     switch ([event subtype]) {
>> -                             case NX_SUBTYPE_TABLET_POINT:
>> -                                     handleTabletEvent(eventPtr, NSTabletPoint);
>> -                                     break;
>> -                             case NX_SUBTYPE_TABLET_PROXIMITY:
>> -                                     handleTabletEvent(eventPtr, NSTabletProximity);
>> -                                     break;
>> -                             default:
>> -                                     //No tablet event included : do nothing
>> -                                     break;
>> -                     }
>> +                     is_tablet = handleTabletEvent(event);
>>
>>               case NSMouseMoved:
>>                       {
>>                               GHOST_TGrabCursorMode grab_mode = window->getCursorGrabMode();
>>
>> -                             /* TODO: CHECK IF THIS IS A TABLET EVENT */
>> -                             bool is_tablet = false;
>> -
>> -                             if (is_tablet && window->getCursorGrabModeIsWarp()) {
>> +                             if (is_tablet && window->getCursorGrabModeIsWarp())
>>                                       grab_mode = GHOST_kGrabDisable;
>> -                             }
>>
>>                               switch (grab_mode) {
>>                                       case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move
>>
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
> _____________________________________
>
> Jens Verwiebe  -  Komposition - Audiotechnik -
> Allerskehre 44  -  22309 Hamburg
>
> Tel.: +49 40 68 78 50
> mobil: +49 172 400 49 07
> mailto: info at jensverwiebe.de
> web:  http://www.jensverwiebe.de
> _____________________________________
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers


More information about the Bf-committers mailing list