Re: [evolution-patches] Re: gtkhtml, patch for 63597, can't open link with keyboard when reading mail
- From: Eric Zhao <Eric Zhao Sun COM>
- To: Radek Doulik <rodo ximian com>
- Cc: Patches <evolution-patches ximian com>
- Subject: Re: [evolution-patches] Re: gtkhtml, patch for 63597, can't open link with keyboard when reading mail
- Date: Wed, 25 Aug 2004 19:53:32 +0800
Hi Radek,
Thanks for your comment! I've changed the patch as you suggested. Is it 
OK now?
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 11:49:34 -0000
@@ -864,6 +864,7 @@ key_press_event (GtkWidget *widget, GdkE
 	GtkHTML *html = GTK_HTML (widget);
 	GtkHTMLClass *html_class = GTK_HTML_CLASS (GTK_WIDGET_GET_CLASS (html));
 	gboolean retval, update = TRUE;
+	HTMLEngine *e;
 
 	html->binding_handled = FALSE;
 	html->priv->update_styles = FALSE;
@@ -896,12 +897,23 @@ key_press_event (GtkWidget *widget, GdkE
 		switch (event->keyval) {
 		case GDK_Return:
 		case GDK_KP_Enter:
-			if (html->engine->focus_object) {
+			e = html->engine;
+			/* the toplevel gtkhtml's focus object may be a frame or ifame */
+			while (e->focus_object) {
+				if (HTML_IS_FRAME (e->focus_object))
+					e = GTK_HTML (HTML_FRAME (e->focus_object)->html)->engine;
+				else if (HTML_IS_IFRAME (e->focus_object))
+					e = GTK_HTML (HTML_IFRAME (e->focus_object)->html)->engine;
+				else
+					break;
+			}
+			if (e->focus_object) {
 				gchar *url;
-				url = html_object_get_complete_url (html->engine->focus_object, html->engine->focus_object_offset);
+				url = html_object_get_complete_url (e->focus_object, e->focus_object_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);
 				}
 			}
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2034
diff -u -p -r1.2034 ChangeLog
--- ChangeLog	16 Aug 2004 16:49:49 -0000	1.2034
+++ ChangeLog	25 Aug 2004 11:50:41 -0000
@@ -1,3 +1,8 @@
+2004-08-25  Eric Zhao  <eric zhao sun com>
+
+	* gtkhtml.c: (key_press_event): the focus object may be a frame or an
+	iframe, if so, check its focus object recursively. Fixes bug #63597.
+
 2004-08-16  Radek Doulik  <rodo ximian com>
 
 	* htmlgdkpainter.c (begin): fix from Robert McQueen, make sure
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]