diff options
author | Milan Crha <mcrha@redhat.com> | 2012-11-02 22:18:10 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-11-02 22:18:10 +0800 |
commit | 94eb069ea357d00826c5a99a181f8a7fe86c15cd (patch) | |
tree | 0c7e2c66a85c26156963141dc70bfab5f235c6d9 /modules/mail | |
parent | d3e3d93e8199793dd54ba86e9bd157778189c787 (diff) | |
download | gsoc2013-evolution-94eb069ea357d00826c5a99a181f8a7fe86c15cd.tar gsoc2013-evolution-94eb069ea357d00826c5a99a181f8a7fe86c15cd.tar.gz gsoc2013-evolution-94eb069ea357d00826c5a99a181f8a7fe86c15cd.tar.bz2 gsoc2013-evolution-94eb069ea357d00826c5a99a181f8a7fe86c15cd.tar.lz gsoc2013-evolution-94eb069ea357d00826c5a99a181f8a7fe86c15cd.tar.xz gsoc2013-evolution-94eb069ea357d00826c5a99a181f8a7fe86c15cd.tar.zst gsoc2013-evolution-94eb069ea357d00826c5a99a181f8a7fe86c15cd.zip |
Bug #687442 - Magic spacebar avoids iTip formatter comment write
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index f51f8f1005..6cf83b98a8 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -262,12 +262,16 @@ mail_shell_view_key_press_event_cb (EMailShellView *mail_shell_view, { EShellView *shell_view; EShellWindow *shell_window; + EShellContent *shell_content; + EMailView *mail_view; + EMailReader *reader; + EMailDisplay *mail_display; GtkAction *action; shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - if ((event->state & GDK_CONTROL_MASK) != 0) + if ((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)) != 0) return FALSE; switch (event->keyval) { @@ -283,6 +287,34 @@ mail_shell_view_key_press_event_cb (EMailShellView *mail_shell_view, return FALSE; } + shell_content = e_shell_view_get_shell_content (shell_view); + mail_view = e_mail_shell_content_get_mail_view (E_MAIL_SHELL_CONTENT (shell_content)); + reader = E_MAIL_READER (mail_view); + mail_display = e_mail_reader_get_mail_display (reader); + + if (gtk_widget_has_focus (GTK_WIDGET (mail_display))) { + WebKitWebFrame *frame; + WebKitDOMDocument *dom; + WebKitDOMElement *element; + gchar *name = NULL; + + frame = webkit_web_view_get_focused_frame (WEBKIT_WEB_VIEW (mail_display)); + 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); + } + gtk_action_activate (action); return TRUE; |