[evolution/gnome-3-8] Fix for typing in ITIP comments when some keys triggered actions.



commit 2f1282d5700ed0ca2a1896a746c3c1d68ebadcb3
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Mar 28 15:02:37 2013 +0100

    Fix for typing in ITIP comments when some keys triggered actions.

 mail/e-mail-reader.c                     |   27 +++++++++++++++++++++++++++
 modules/mail/e-mail-shell-view-private.c |    2 ++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 64b8d78..63dac78 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 cf917f5..6373e57 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);


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