Hello,>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 CSR_TYPE_PEN;> can we determine type based on cursor.name? Yes -> return CSR_TYPE_ERASER;
> return CSR_TYPE_OTHER;
>}
I worked on this code a little bit back in the day, I remember the detection stuff getting weird due to some odd ball drivers (non-wacom stuff doing strange things).Bug http://bugs.winehq.org/show_bug.cgi?id=11699 and specifically the log http://bugs.winehq.org/attachment.cgi?id=13358 of an Acecad table driver's settings.
Just thought it might be handy to consider if you were to take a shot at rewriting the detection code.Regards,--JohnOn Fri, Mar 21, 2014 at 4:09 AM, Michael Stefaniuc <mstefani@redhat.com> wrote:On 03/21/2014 10:04 AM, Eriks Dobelis wrote:In that case you could actually get rid of the is_* functions;
> 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
> CSR_TYPE_PEN;
> can we determine type based on cursor.name? Yes -> return
> CSR_TYPE_ERASER;
> 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;
> }
"get_cursor_type(cursor) == CSR_TYPE_PEN" is as readable.
bye
michael
--
>
>
> On 2014.03.21. 10:54, Alexandre Julliard wrote:
>> Eriks Dobelis <eriks.dobelis@biti.lv> 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.
>>
>
>
>
Michael Stefaniuc Tel.: +49-711-96437-199
Supervisor, APAC/EMEA IT Network Fax.: +49-711-96437-111
--------------------------------------------------------------------
Reg. Adresse: Red Hat GmbH, Werner-von-Siemens-Ring 14, 85630 Grasbrunn
Handelsregister: Amtsgericht Muenchen HRB 153243
Geschäftsführer: Mark Hegarty, Charlie Peters, Michael Cunningham,
Charles Cachera