Re: [PATCH] Improve detection of input device source type
- From: Sven Neumann <sven gimp org>
- To: Thomas Jaeger <thjaeger gmail com>
- Cc: gtk-devel-list gnome org
- Subject: Re: [PATCH] Improve detection of input device source type
- Date: Mon, 28 Sep 2009 21:15:45 +0200
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]