[evolution-patches] gtkhtml, patch for 63597, can't open link with keyboard when reading mail
- From: Eric Zhao <Eric Zhao Sun COM>
- To: evo-patches <evolution-patches ximian com>, rodo <rodo ximian com>
- Subject: [evolution-patches] gtkhtml, patch for 63597, can't open link with keyboard when reading mail
- Date: Sun, 22 Aug 2004 20:31:29 +0800
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: src/gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.574
diff -u -p -r1.574 gtkhtml.c
--- src/gtkhtml.c 11 Aug 2004 17:30:55 -0000 1.574
+++ src/gtkhtml.c 22 Aug 2004 12:03:17 -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,9 +897,19 @@ 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);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/ChangeLog,v
retrieving revision 1.277
diff -u -p -r1.277 ChangeLog
--- ChangeLog 21 Aug 2004 00:35:05 -0000 1.277
+++ ChangeLog 22 Aug 2004 12:03:18 -0000
@@ -1,3 +1,9 @@
+2004-08-22 Eric Zhao <eric zhao sun com>
+
+ * src/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-21 Kjartan Maraas <kmaraas gnome org>
* configure.in: Add «nb» to ALL_LINGUAS.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]