[evolution/gnome-3-24] Can't change the font color on caret in WebKitGTK+ 2.16
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-24] Can't change the font color on caret in WebKitGTK+ 2.16
- Date: Fri, 24 Mar 2017 09:56:32 +0000 (UTC)
commit c33892e6ba38e2746e4c0dfb0b8cc8bf09bdb0b9
Author: Tomas Popela <tpopela redhat com>
Date: Fri Mar 24 10:50:25 2017 +0100
Can't change the font color on caret in WebKitGTK+ 2.16
Only process the input event if it was triggered by the key press and not
i.e. by exexCommand. This behavior changed when the support for beforeinput
event was introduced in WebKit.
.../web-extension/e-editor-dom-functions.c | 10 +++++++++-
.../webkit-editor/web-extension/e-editor-page.c | 19 +++++++++++++++++++
.../webkit-editor/web-extension/e-editor-page.h | 5 +++++
3 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index f545c01..c1e01e0 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -2832,6 +2832,8 @@ body_keypress_event_cb (WebKitDOMElement *element,
g_return_if_fail (E_IS_EDITOR_PAGE (editor_page));
+ e_editor_page_set_is_processing_keypress_event (editor_page, TRUE);
+
document = webkit_dom_node_get_owner_document (WEBKIT_DOM_NODE (element));
dom_window = webkit_dom_document_get_default_view (document);
dom_selection = webkit_dom_dom_window_get_selection (dom_window);
@@ -3581,7 +3583,13 @@ body_input_event_cb (WebKitDOMElement *element,
{
g_return_if_fail (E_IS_EDITOR_PAGE (editor_page));
- e_editor_dom_body_input_event_process (editor_page, event);
+ /* Only process the input event if it was triggered by the key press
+ * and not i.e. by exexCommand. This behavior changed when the support
+ * for beforeinput event was introduced in WebKit. */
+ if (e_editor_page_is_processing_keypress_event (editor_page))
+ e_editor_dom_body_input_event_process (editor_page, event);
+
+ e_editor_page_set_is_processing_keypress_event (editor_page, FALSE);
}
void
diff --git a/src/modules/webkit-editor/web-extension/e-editor-page.c
b/src/modules/webkit-editor/web-extension/e-editor-page.c
index 9da8b8c..ddacdf1 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-page.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-page.c
@@ -62,6 +62,7 @@ struct _EEditorPagePrivate {
gboolean pasting_content_from_itself;
gboolean renew_history_after_coordinates;
gboolean allow_top_signature;
+ gboolean processing_keypress_event;
GHashTable *inline_images;
@@ -244,6 +245,7 @@ e_editor_page_init (EEditorPage *editor_page)
editor_page->priv->block_format = E_CONTENT_EDITOR_BLOCK_FORMAT_PARAGRAPH;
editor_page->priv->force_image_load = FALSE;
editor_page->priv->html_mode = TRUE;
+ editor_page->priv->processing_keypress_event = FALSE;
editor_page->priv->return_key_pressed = FALSE;
editor_page->priv->space_key_pressed = FALSE;
editor_page->priv->smiley_written = FALSE;
@@ -557,6 +559,23 @@ e_editor_page_set_alignment (EEditorPage *editor_page,
}
gboolean
+e_editor_page_is_processing_keypress_event (EEditorPage *editor_page)
+{
+ g_return_val_if_fail (E_IS_EDITOR_PAGE (editor_page), FALSE);
+
+ return editor_page->priv->processing_keypress_event;
+}
+
+void
+e_editor_page_set_is_processing_keypress_event (EEditorPage *editor_page,
+ gboolean processing_keypress_event)
+{
+ g_return_if_fail (E_IS_EDITOR_PAGE (editor_page));
+
+ editor_page->priv->processing_keypress_event = processing_keypress_event;
+}
+
+gboolean
e_editor_page_get_return_key_pressed (EEditorPage *editor_page)
{
g_return_val_if_fail (E_IS_EDITOR_PAGE (editor_page), FALSE);
diff --git a/src/modules/webkit-editor/web-extension/e-editor-page.h
b/src/modules/webkit-editor/web-extension/e-editor-page.h
index 201fb53..909e130 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-page.h
+++ b/src/modules/webkit-editor/web-extension/e-editor-page.h
@@ -112,6 +112,11 @@ void e_editor_page_set_alignment (EEditorPage *editor_page,
EContentEditorAlignment value);
gint e_editor_page_get_word_wrap_length
(EEditorPage *editor_page);
+gboolean e_editor_page_is_processing_keypress_event
+ (EEditorPage *editor_page);
+void e_editor_page_set_is_processing_keypress_event
+ (EEditorPage *editor_page,
+ gboolean processing_keypress_event);
gboolean e_editor_page_get_return_key_pressed
(EEditorPage *editor_page);
void e_editor_page_set_return_key_pressed
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]