Re: [gedit-list] big thanks



On Thu, 2004-08-05 at 17:48 +0200, Robert Staudinger wrote:
> Thanks for the instant patch!
> 
> Unfortunately is this not what i meant :-/ sorry for being unclear.
> 

I see... oh well, I suppose that patch is useful anyway :-)

> I'm using mouseemu
> (http://www.geekounet.org/powerbook/files/mouseemu.tar.gz) on my iBook
> to pop up the context menu using F12 (emulate right-click). When i
> right-click (F12) on an incorrect word the popup-menu comes up and
> suggests a list of replacements. Left-clicking on a replacement doesn't
> have an effect using mouseemu. Right-clicking (F12 again) applies the
> correction.

Maybe it's a problem with mouseemu, note however that also without using
mouseemu gtk+ has a standard keybinding to activate the popup menu:
SHIFT+F10.
When testing it I discovered another buglet: the list of suggestion
wasn't updated properly. Patch attached.


ciao
	paolo
? spell_popup.patch
Index: gedit-automatic-spell-checker.c
===================================================================
RCS file: /cvs/gnome/gedit/plugins/spell/gedit-automatic-spell-checker.c,v
retrieving revision 1.6
diff -u -p -r1.6 gedit-automatic-spell-checker.c
--- gedit-automatic-spell-checker.c	5 Mar 2004 21:23:58 -0000	1.6
+++ gedit-automatic-spell-checker.c	5 Aug 2004 16:39:37 -0000
@@ -537,7 +537,8 @@ clear_session_cb (GeditSpellChecker     
  * since that prevents the use of edit functions on the context menu. 
  */
 static gboolean
-button_press_event (GtkTextView *view, GdkEventButton *event, gpointer data) 
+button_press_event (GtkTextView *view, GdkEventButton *event,
+		GeditAutomaticSpellChecker *spell) 
 {
 	if (event->button == 3) 
 	{
@@ -545,14 +546,13 @@ button_press_event (GtkTextView *view, G
 		GtkTextIter iter;
 		
 		GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
-		GeditAutomaticSpellChecker *spell = (GeditAutomaticSpellChecker*)data;
 
 		gtk_text_view_window_to_buffer_coords (view, 
 				GTK_TEXT_WINDOW_TEXT, 
 				event->x, event->y,
 				&x, &y);
 		
-		gtk_text_view_get_iter_at_location(view, &iter, x, y);
+		gtk_text_view_get_iter_at_location (view, &iter, x, y);
 
 		gtk_text_buffer_move_mark (buffer, spell->mark_click, &iter);
 	}
@@ -560,7 +560,22 @@ button_press_event (GtkTextView *view, G
 	return FALSE; /* false: let gtk process this event, too.
 			 we don't want to eat any events. */
 }
-	
+
+static gboolean
+popup_menu_event (GtkTextView *view, GeditAutomaticSpellChecker *spell) 
+{
+	GtkTextIter iter;
+	GtkTextBuffer *buffer;
+
+	buffer = gtk_text_view_get_buffer (view);
+
+	gtk_text_buffer_get_iter_at_mark (buffer, &iter,
+					  gtk_text_buffer_get_insert (buffer));
+	gtk_text_buffer_move_mark (buffer, spell->mark_click, &iter);
+
+	return FALSE;
+}
+
 GeditAutomaticSpellChecker *
 gedit_automatic_spell_checker_new (GeditDocument *doc, GeditSpellChecker *checker)
 {
@@ -757,6 +772,11 @@ gedit_automatic_spell_checker_attach_vie
 			  G_CALLBACK (button_press_event), 
 			  spell);
 
+	g_signal_connect (G_OBJECT (gedit_view_get_gtk_text_view (view)), 
+			  "popup-menu",
+			  G_CALLBACK (popup_menu_event), 
+			  spell);
+
 	g_signal_connect (G_OBJECT (view), 
 			  "populate-popup",
 			  G_CALLBACK (populate_popup), 
@@ -787,6 +807,4 @@ gedit_automatic_spell_checker_detach_vie
 
 	spell->views = g_slist_remove (spell->views, view);
 }
-
-
 


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