aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-reader.c27
-rw-r--r--modules/mail/e-mail-shell-view-private.c2
2 files changed, 29 insertions, 0 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 69bb388d72..1556481d62 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2612,6 +2612,33 @@ mail_reader_key_press_event_cb (EMailReader *reader,
GtkAction *action;
const gchar *action_name;
+ if (!gtk_widget_has_focus (GTK_WIDGET (reader))) {
+ WebKitWebFrame *frame;
+ WebKitDOMDocument *dom;
+ WebKitDOMElement *element;
+ EMailDisplay *display;
+ gchar *name = NULL;
+
+ display = e_mail_reader_get_mail_display (reader);
+ frame = webkit_web_view_get_focused_frame (WEBKIT_WEB_VIEW (display));
+
+ if (frame) {
+ dom = webkit_web_frame_get_dom_document (frame);
+ /* intentionally used "static_cast" */
+ element = webkit_dom_html_document_get_active_element ((WebKitDOMHTMLDocument*) dom);
+
+ if (element)
+ name = webkit_dom_node_get_node_name (WEBKIT_DOM_NODE (element));
+
+ /* if INPUT or TEXTAREA has focus, then any key press should go there */
+ if (name && (g_ascii_strcasecmp (name, "INPUT") == 0 || g_ascii_strcasecmp (name, "TEXTAREA") == 0)) {
+ g_free (name);
+ return FALSE;
+ }
+ g_free (name);
+ }
+ }
+
if ((event->state & GDK_CONTROL_MASK) != 0)
goto ctrl;
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index cf917f5251..6373e571a2 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -265,6 +265,8 @@ mail_shell_view_mail_display_needs_key (EMailDisplay *mail_display,
gchar *name = NULL;
frame = webkit_web_view_get_focused_frame (WEBKIT_WEB_VIEW (mail_display));
+ if (!frame)
+ return FALSE;
dom = webkit_web_frame_get_dom_document (frame);
/* intentionally used "static_cast" */
element = webkit_dom_html_document_get_active_element ((WebKitDOMHTMLDocument *) dom);