Changeset 434

Show
Ignore:
Timestamp:
07/18/07 00:26:00 (1 year ago)
Author:
krobillard
Message:

GLView GLV_EVENT_MOTION now reports button state on Mac.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/orca/gl/glv/mac/glv.c

    r238 r434  
    2525#define FLAG_FULLSCREEN_MODE        0x0040 
    2626#define FLAG_FILTER_REPEAT          0x0080 
     27 
     28 
     29static UInt32 mouseButtonModifier[3] = 
     30{ 
     31    0, GLV_MASK_LEFT, GLV_MASK_RIGHT, GLV_MASK_MIDDLE 
     32}; 
    2733 
    2834 
     
    7177        ve.type  = t; \ 
    7278        ve.code  = code; \ 
    73         ve.state = modifiers; \ 
     79        ve.state = modifiers | view->buttonsHeld; \ 
    7480        ve.x     = 0; \ 
    7581        ve.y     = 0; 
     
    147153            case kEventMouseDown: 
    148154                //printf( "KR mouse down\n" ); 
     155 
     156                // Let system widgets get first crack at event. 
     157                result = CallNextEventHandler( myHandler, event ); 
     158                if( eventNotHandledErr != result ) 
     159                    break; 
    149160 
    150161                GetEventParameter( event, kEventParamMouseButton, 
     
    158169                                   sizeof(UInt32), NULL, &modifiers ); 
    159170 
     171                if( button < 4 ) 
     172                    view->buttonsHeld |= mouseButtonModifier[ button ]; 
     173 
    160174                ve.type  = GLV_EVENT_BUTTON_DOWN; 
    161175                ve.code  = button; 
    162                 ve.state = modifiers
     176                ve.state = modifiers | view->buttonsHeld
    163177                ve.x     = ((int) location.x) - view->bound.left; 
    164178                ve.y     = ((int) location.y) - view->bound.top; 
    165179                view->eventHandler( view, &ve ); 
    166180 
    167                 // result remains eventNotHandledErr so it can propagate. 
     181                result = noErr; 
    168182                break; 
    169183 
     
    181195                                   sizeof(UInt32), NULL, &modifiers ); 
    182196 
     197                if( button < 4 ) 
     198                    view->buttonsHeld &= ~mouseButtonModifier[ button ]; 
     199 
    183200                ve.type  = GLV_EVENT_BUTTON_UP; 
    184201                ve.code  = button; 
    185                 ve.state = modifiers
     202                ve.state = modifiers | view->buttonsHeld
    186203                ve.x     = ((int) location.x) - view->bound.left; 
    187204                ve.y     = ((int) location.y) - view->bound.top; 
     
    207224                ve.type  = GLV_EVENT_MOTION; 
    208225                ve.code  = button; 
    209                 ve.state = modifiers
     226                ve.state = modifiers | view->buttonsHeld
    210227                ve.x     = ((int) location.x) - view->bound.left; 
    211228                ve.y     = ((int) location.y) - view->bound.top; 
     
    504521    view->windowEventUUP = NewEventHandlerUPP( windowEventHandler ); 
    505522    view->modifiers      = 0; 
     523    view->buttonsHeld    = 0; 
    506524 
    507525 
  • trunk/orca/gl/glv/mac/glv.h

    r238 r434  
    4949    unsigned short flags; 
    5050    UInt32 modifiers; 
     51    UInt32 buttonsHeld; 
    5152    int modeId; 
    5253    Rect bound;