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



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




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