diff src/search.c @ 448:a73cc0fa14d0

Use explicit names for mouse buttons instead of numbers. MOUSE_BUTTON_LEFT = 1 MOUSE_BUTTON_MIDDLE = 2 MOUSE_BUTTON_RIGHT = 3 It makes the code easier to read.
author zas_
date Sun, 20 Apr 2008 21:30:36 +0000
parents ddabc4873a3f
children 48c8e49b571c
line wrap: on
line diff
--- a/src/search.c	Sun Apr 20 20:35:26 2008 +0000
+++ b/src/search.c	Sun Apr 20 21:30:36 2008 +0000
@@ -1045,7 +1045,7 @@
 
 	sd->click_fd = mfd ? mfd->fd : NULL;
 
-	if (bevent->button == 3)
+	if (bevent->button == MOUSE_BUTTON_RIGHT)
 		{
 		GtkWidget *menu;
 
@@ -1055,14 +1055,14 @@
 
 	if (!mfd) return FALSE;
 
-	if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
+	if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_2BUTTON_PRESS)
 		{
 		layout_image_set_fd(NULL, mfd->fd);
 		}
 
-	if (bevent->button == 2) return TRUE;
-
-	if (bevent->button == 3)
+	if (bevent->button == MOUSE_BUTTON_MIDDLE) return TRUE;
+
+	if (bevent->button == MOUSE_BUTTON_RIGHT)
 		{
 		if (!search_result_row_selected(sd, mfd->fd))
 			{
@@ -1079,7 +1079,7 @@
 		return TRUE;
 		}
 
-	if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS &&
+	if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_BUTTON_PRESS &&
 	    !(bevent->state & GDK_SHIFT_MASK ) &&
 	    !(bevent->state & GDK_CONTROL_MASK ) &&
 	    search_result_row_selected(sd, mfd->fd))
@@ -1101,7 +1101,7 @@
 
 	MatchFileData *mfd = NULL;
 
-	if (bevent->button != 1 && bevent->button != 2) return TRUE;
+	if (bevent->button != MOUSE_BUTTON_LEFT && bevent->button != MOUSE_BUTTON_MIDDLE) return TRUE;
 
 	store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
 
@@ -1114,7 +1114,7 @@
 		gtk_tree_path_free(tpath);
 		}
 
-	if (bevent->button == 2)
+	if (bevent->button == MOUSE_BUTTON_MIDDLE)
 		{
 		if (mfd && sd->click_fd == mfd->fd)
 			{