aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-reader.c27
1 files changed, 27 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;