[Kazehakase-cvs] CVS update: kazehakase/src

Back to archive index

Kouhei Sutou kous****@users*****
Thu May 18 13:56:26 JST 2006


Index: kazehakase/src/kz-window.c
diff -u kazehakase/src/kz-window.c:1.267 kazehakase/src/kz-window.c:1.268
--- kazehakase/src/kz-window.c:1.267	Wed Apr 26 10:17:55 2006
+++ kazehakase/src/kz-window.c	Thu May 18 13:56:26 2006
@@ -231,9 +231,11 @@
 					       KzWindow        *kz);
 static void     cb_find_keyword               (GtkWidget       *widget,
 					       KzWindow        *kz);
-static gboolean cb_find_key_release           (GtkWidget       *widget,
+static gboolean cb_find_key_press_event       (GtkWidget       *widget,
 					       GdkEventKey     *event,
 					       KzWindow        *kz);
+static void     cb_find_changed               (GtkWidget       *widget,
+					       KzWindow        *kz);
 #if 0
 static void     cb_find_grab_focus            (GtkWidget       *widget,
 					       KzWindow        *kz);
@@ -717,8 +719,11 @@
 		gtk_box_pack_start(GTK_BOX(kz->statusbar_area), kz->find_area,
 				   FALSE, FALSE, 0); 
 		g_signal_connect(kz->find_area, 
-				 "key-release-event",
-				 G_CALLBACK(cb_find_key_release), kz);
+				 "key-press-event",
+				 G_CALLBACK(cb_find_key_press_event), kz);
+		g_signal_connect(kz->find_area, 
+				 "changed",
+				 G_CALLBACK(cb_find_changed), kz);
 		/*
 		g_signal_connect(kz->find_area, 
 				 "grab-focus",
@@ -2608,6 +2613,8 @@
 	const gchar *text = gtk_entry_get_text(GTK_ENTRY(widget));
 	gboolean back = gtk_toggle_button_get_active(toggle);
 	KzWindowPrivate *priv = KZ_WINDOW_GET_PRIVATE (kz);
+	gint x, y;
+	GdkModifierType modifier;
 
 	if (!embed) return;
 
@@ -2617,6 +2624,9 @@
 		return;
 	}
 
+	gdk_window_get_pointer(NULL, &x, &y, &modifier);
+	if (modifier & GDK_SHIFT_MASK)
+		back = !back;
 	priv->did_find = kz_embed_find(embed, text, back);
 	if(priv->did_find)
 		search_found(widget, kz);
@@ -2625,17 +2635,33 @@
 }
 
 static gboolean
-cb_find_key_release (GtkWidget *widget, GdkEventKey *event, KzWindow *kz)
+cb_find_key_press_event (GtkWidget *widget, GdkEventKey *event, KzWindow *kz)
 {
-	KzEmbed *embed ;
+	if ((event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) &&
+	    event->state & GDK_SHIFT_MASK)
+	{
+		gtk_widget_activate(widget);
+		return TRUE;
+	}
+	else
+	{
+		return FALSE;
+	}
+}
+
+static void
+cb_find_changed (GtkWidget *widget, KzWindow *kz)
+{
+	KzEmbed *embed;
 	GtkToggleButton *toggle;
 	const gchar *text;
 	KzWindowPrivate *priv;
+	gboolean back;
 
-	g_return_val_if_fail(KZ_IS_WINDOW(kz), FALSE);
+	g_return_if_fail(KZ_IS_WINDOW(kz));
 
 	embed = KZ_EMBED(KZ_WINDOW_CURRENT_PAGE(kz));
-	if (!embed) return FALSE;
+	if (!embed) return;
 
 	priv = KZ_WINDOW_GET_PRIVATE (kz);
 	toggle = GTK_TOGGLE_BUTTON(kz->find_direction);
@@ -2643,35 +2669,17 @@
 	if (!text || !(*text))
 	{
 		search_found(widget,kz);
-		return FALSE;
+		return;
 	}
 
-	if (event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter)
-	{
-		if (event->state & GDK_SHIFT_MASK)
-		{
-			gboolean back;
-			back = !gtk_toggle_button_get_active(toggle);
-			priv->did_find
-				= kz_embed_find(embed, text, back);
-		}
-	}
-	else
-	{
-		if (!(event->state & GDK_SHIFT_MASK))
-		{
-			gboolean back;
-			back = gtk_toggle_button_get_active(toggle);
-			priv->did_find
-				= kz_embed_incremental_search(embed, text, back);
-		}
-	}
+	back = gtk_toggle_button_get_active(toggle);
+	priv->did_find = kz_embed_incremental_search(embed, text, back);
 
 	if(priv->did_find)
 		search_found(widget, kz);
 	else
 		search_not_found(widget, kz);
-	return FALSE;
+	return;
 }
 
 #if 0


More information about the Kazehakase-cvs mailing list
Back to archive index