[gimp/metadata-browser] app: sanitize event->button checking in GimpNavigationView
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: sanitize event->button checking in GimpNavigationView
- Date: Wed, 28 Sep 2011 10:49:16 +0000 (UTC)
commit ad3dc4b82b5b60e95dfa0a92ae6284f31e651114
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 18 01:29:51 2011 +0200
app: sanitize event->button checking in GimpNavigationView
Use if() instead of switch() with one case:, and ignore
double and triple clicks.
app/widgets/gimpnavigationview.c | 14 ++------------
1 files changed, 2 insertions(+), 12 deletions(-)
---
diff --git a/app/widgets/gimpnavigationview.c b/app/widgets/gimpnavigationview.c
index 298898b..06bb08e 100644
--- a/app/widgets/gimpnavigationview.c
+++ b/app/widgets/gimpnavigationview.c
@@ -246,9 +246,8 @@ gimp_navigation_view_button_press (GtkWidget *widget,
tx = bevent->x;
ty = bevent->y;
- switch (bevent->button)
+ if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 1)
{
- case 1:
if (! (tx > nav_view->p_x &&
tx < (nav_view->p_x + nav_view->p_width) &&
ty > nav_view->p_y &&
@@ -276,10 +275,6 @@ gimp_navigation_view_button_press (GtkWidget *widget,
}
gimp_navigation_view_grab_pointer (nav_view);
- break;
-
- default:
- break;
}
return TRUE;
@@ -291,18 +286,13 @@ gimp_navigation_view_button_release (GtkWidget *widget,
{
GimpNavigationView *nav_view = GIMP_NAVIGATION_VIEW (widget);
- switch (bevent->button)
+ if (bevent->button == 1 && nav_view->has_grab)
{
- case 1:
nav_view->has_grab = FALSE;
gtk_grab_remove (widget);
gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
GDK_CURRENT_TIME);
- break;
-
- default:
- break;
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]