Re: [evolution-patches] Re: gtkhtml, patch for 63597, can't open link with keyboard when reading mail



On Wed, 2004-08-25 at 19:53 +0800, Eric Zhao wrote:
Hi Radek,
 
Thanks for your comment! I've changed the patch as you suggested. Is it 
OK now?
Well, I thought the while loop will not be needed, but when I look closer we have to traverse it down anyway. There's a method for that already though. We should also set retval to TRUE as in case we emitted the signal.

I am attaching diff to gtkhtml.c. Please update your patch according to that and commit. (best if done today as I will be making stable release in few hours)

Cheers
Radek

Regards,
Eric

Radek Doulik wrote:

> Hi Eric,
>
> I think it should be handled differently. The signal should be emitted 
> from iframe's gtkhtml widget key_press handler and pass top level html 
> to g_signal_emit (you may use gtk_html_get_top_html method or 
> html_engine_get_top_html engine). That's how we do it at other places.
>
> It means replacing
>
>     g_signal_emit (html, signals [LINK_CLICKED], 0, url);
>
> with
>
>     g_signal_emit (gtk_html_get_top_html (html), signals
>     [LINK_CLICKED], 0, url);
>
>
> Cheers
> Radek
>
> On Sun, 2004-08-22 at 20:31 +0800, Eric Zhao wrote:
>
>>Hi,
>>
>>The attachment is a patch for bug 
>>63597(http://bugs.ximian.com/show_bug.cgi?id=63597).
>>
>>It can be reproduced by:
>>
>>Steps to reproduce the problem:
>>1. start evolution
>>2. open a HTML format mail which contains link
>>3. press F7 to enable caret mode and move the cursor to the link
>>4. press Enter to activate the link.
>>
>>Actual Results:
>>nothing happens.
>>
>>The reason is that the mail message is placed in an iframe. 
>>And it is the focus object of the toplevel gtkhtml.
>>So in the signal hander of key pressed event, if the focus object
>>is a frame or an iframe,  we should check the frame's focus object 
>>recursively,
>>otherwise we can't get the link object properly.
>>
>>Could you help give the patch a review? Thanks!
>>
>>Regards,
>>Eric
>>
>>    
>>

Index: gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.574
diff -u -p -r1.574 gtkhtml.c
--- gtkhtml.c	11 Aug 2004 17:30:55 -0000	1.574
+++ gtkhtml.c	25 Aug 2004 14:50:56 -0000
@@ -893,16 +893,21 @@ key_press_event (GtkWidget *widget, GdkE
 	
 	/* FIXME: use bindings */
 	if (!html_engine_get_editable (html->engine)) {
+		HTMLObject *o;
+		gint offset;
+
 		switch (event->keyval) {
 		case GDK_Return:
 		case GDK_KP_Enter:
-			if (html->engine->focus_object) {
+			o = html_engine_get_focus_object (html->engine, &offset);
+			if (o) {
 				gchar *url;
-				url = html_object_get_complete_url (html->engine->focus_object, html->engine->focus_object_offset);
+				url = html_object_get_complete_url (o, offset);
 				if (url) {
 					/* printf ("link clicked: %s\n", url); */
-					g_signal_emit (html, signals [LINK_CLICKED], 0, url);
+					g_signal_emit (gtk_html_get_top_html (html), signals [LINK_CLICKED], 0, url);
 					g_free (url);
+					retval = TRUE;
 				}
 			}
 			break;


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