Re: [PATCH] Improve detection of input device source type



This is a multi-part message in MIME format.
Sven Neumann wrote:
> Hi,
> 
> On Mon, 2009-09-28 at 02:00 -0400, Thomas Jaeger wrote:
>> -  if (!strcmp (tmp_name, "pointer"))
>> -    gdkdev->info.source = GDK_SOURCE_MOUSE;
>> -  else if (!strcmp (tmp_name, "wacom") ||
>> -          !strcmp (tmp_name, "pen"))
>> -    gdkdev->info.source = GDK_SOURCE_PEN;
>> -  else if (!strcmp (tmp_name, "eraser"))
>> +  if (g_strrstr (tmp_name, "eraser"))
>>      gdkdev->info.source = GDK_SOURCE_ERASER;
>> -  else if (!strcmp (tmp_name, "cursor"))
>> +  else if (g_strrstr (tmp_name, "cursor"))
>>      gdkdev->info.source = GDK_SOURCE_CURSOR;
>> -  else
>> +  else if (g_strrstr (tmp_name, "wacom") ||
>> +          g_strrstr (tmp_name, "pen"))
>>      gdkdev->info.source = GDK_SOURCE_PEN;
>> +  else
>> +    gdkdev->info.source = GDK_SOURCE_MOUSE;
> 
> Is there a particular reason that your code is using g_strrstr()? It
> doesn't look as if you are interested in the last occurrence of the the
> searched string. Since you are looking for the needle anywhere in the
> hay, you should better use strstr().
> 
> 
> Sven

No particular reason, I just figured I should use one of the glib string
function since I was operating on a gchar and there was no g_strstr.
Patch attached.

Tom






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]