[evolution/gnome-3-6] Bug #687442 - Magic spacebar avoids iTip formatter comment write
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-6] Bug #687442 - Magic spacebar avoids iTip formatter comment write
- Date: Fri, 2 Nov 2012 14:19:42 +0000 (UTC)
commit 95aa304d52a14fdcdb5c919150d955f2f9ffcf4d
Author: Milan Crha <mcrha redhat com>
Date: Fri Nov 2 15:19:14 2012 +0100
Bug #687442 - Magic spacebar avoids iTip formatter comment write
modules/itip-formatter/itip-view.c | 2 +-
modules/mail/e-mail-shell-view-private.c | 34 +++++++++++++++++++++++++++++-
2 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index 7e91f34..30de7f5 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -995,7 +995,7 @@ buttons_table_write_button (GString *buffer,
g_string_append_printf (
buffer,
- "<td><button type=\"button\" name=\"%s\" value=\"%d\" id=\"%s\" accesskey=\"%s\" hidden>"
+ "<td><button type=\"button\" name=\"%s\" value=\"%d\" id=\"%s\" accesskey=\"%s\" hidden disabled>"
"<div><img src=\"gtk-stock://%s?size=%d\"> <span>%s</span></div>"
"</button></td>\n",
name, response, name, access_key ? access_key : "" , icon,
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index f51f8f1..6cf83b9 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]