~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to PsychSourceGL/Source/Common/PsychHID/PsychHIDKbQueueFlush.c

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
                "If 'flushType' is 1, only events returned by KbQueueCheck will be flushed. This is the default.\n"
85
85
                "If 'flushType' is 2, only events returned by KbQueueGetEvent will be flushed.\n"
86
86
                "If 'flushType' is 3, events returned by both KbQueueCheck and KbQueueGetEvent will be flushed.\n"
 
87
        "If 'flushType' & 4, only the number of key-press events with valid, mapped ASCII CookedKey field will be returned.\n"
87
88
        "PsychHID('KbQueueCreate') must be called before this routine.\n"
88
89
        "On Linux, the optional 'deviceIndex' is the index of the device whose queue should be flushed. "
89
90
        "If omitted, the default devices queue will be flushed. On other systems, the last queue will be flushed.\n";
107
108
    PsychCopyInIntegerArg(2, kPsychArgOptional, &flushType);
108
109
        
109
110
        // Return current count of contained events pre-flush:
110
 
        PsychCopyOutDoubleArg(1, FALSE, (double) PsychHIDAvailEventBuffer((PSYCH_SYSTEM != PSYCH_OSX) ? deviceIndex : 0));
 
111
        PsychCopyOutDoubleArg(1, FALSE, (double) PsychHIDAvailEventBuffer((PSYCH_SYSTEM != PSYCH_OSX) ? deviceIndex : 0, (flushType & 4) ? 1 : 0));
111
112
 
112
113
    if (flushType & 1) PsychHIDOSKbQueueFlush(deviceIndex);
113
114
    if (flushType & 2) PsychHIDFlushEventBuffer((PSYCH_SYSTEM != PSYCH_OSX) ? deviceIndex : 0);
118
119
#if PSYCH_SYSTEM == PSYCH_OSX
119
120
#include "PsychHIDKbQueue.h"
120
121
 
 
122
extern UInt32 modifierKeyState;
121
123
extern AbsoluteTime *psychHIDKbQueueFirstPress;
122
124
extern AbsoluteTime *psychHIDKbQueueFirstRelease;
123
125
extern AbsoluteTime *psychHIDKbQueueLastPress;
161
163
                        psychHIDKbQueueLastRelease[i].hi=0;
162
164
                        psychHIDKbQueueLastRelease[i].lo=0;
163
165
                }
 
166
        
 
167
        modifierKeyState = 0;        
164
168
        }
165
169
        pthread_mutex_unlock(&psychHIDKbQueueMutex);
166
170
}