wintab: Incorrectly classifying cursor as stylus instead of eraser

Eriks Dobelis eriks.dobelis at
Fri Mar 21 04:04:03 CDT 2014

To be able to prioritize we have to change current functions into smth 
like this:

get_cursor_type(cursor) { //new function
     can we determine type based on cursor.device? Yes -> return 
     can we determine type based on Yes -> return 
     return CSR_TYPE_OTHER;

and rewriting is_stylus  and is_eraser into more simple functions like
is_stylus(cursor) {
   return get_cursor_type(cursor) == CSR_TYPE_PEN;

On 2014.03.21. 10:54, Alexandre Julliard wrote:
> Eriks Dobelis <eriks.dobelis at> writes:
>> The alternative - just to switch order of checks in
>> X11DRV_LoadTabletInfo. There is a code fragment:
>>              /* prefer finding TYPE_PEN(most capable) */
>>              if (is_stylus(target->name, device_type))
>>                  cursor.TYPE = CSR_TYPE_PEN;
>>              else if (is_eraser(target->name, device_type))
>>                  cursor.TYPE = CSR_TYPE_ERASER;
>>              else
>>                  cursor.TYPE = CSR_TYPE_OTHER;
>> I would need to switch order and check for ERASER first. Problems
>> would arise if for some device name would be "Pen & Eraser", and type
>> would be "STYLUS" , and then it would be detected as eraser. In the
>> proposed patch this problem would not arise as only device is checked
>> for ERASER. For my specific case both approaches work. Which one you
>> consider as better?
> Maybe a better way would be to restructure the checks, and give priority
> to the type over the name or something like that. The thing is that we
> don't want to have an is_stylus function that also checks for erasers,
> and then an is_eraser function with slightly different checks.

More information about the wine-devel mailing list