[evolution/gnome-3-18] EHTMLEditorView - Replace the preedit-* signals with compositionstart and compositionend HTML events



commit 71c626ad5a3f1b939ffff1007912881c35847b98
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Dec 7 21:37:51 2015 +0100

    EHTMLEditorView - Replace the preedit-* signals with compositionstart and compositionend HTML events
    
    GtkIMContext won't be exposed in WK2 anyway.

 e-util/e-html-editor-view.c |   57 ++++++++++++++++++++++++-------------------
 1 files changed, 32 insertions(+), 25 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 59f006c..ab8c76b 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -7739,6 +7739,24 @@ clear_attributes (WebKitDOMDocument *document)
 }
 
 static void
+im_context_preedit_start_cb (WebKitDOMElement *element,
+                             WebKitDOMUIEvent *event,
+                             EHTMLEditorView *view)
+{
+       view->priv->im_input_in_progress = TRUE;
+       remove_input_event_listener_from_body (view);
+}
+
+static void
+im_context_preedit_end_cb (WebKitDOMElement *element,
+                           WebKitDOMUIEvent *event,
+                           EHTMLEditorView *view)
+{
+       view->priv->im_input_in_progress = FALSE;
+       register_input_event_listener_on_body (view);
+}
+
+static void
 register_html_events_handlers (EHTMLEditorView *view,
                                WebKitDOMHTMLElement *body)
 {
@@ -7762,6 +7780,20 @@ register_html_events_handlers (EHTMLEditorView *view,
                G_CALLBACK (body_keyup_event_cb),
                FALSE,
                view);
+
+       webkit_dom_event_target_add_event_listener (
+               WEBKIT_DOM_EVENT_TARGET (body),
+               "compositionstart",
+               G_CALLBACK (im_context_preedit_start_cb),
+               FALSE,
+               view);
+
+       webkit_dom_event_target_add_event_listener (
+               WEBKIT_DOM_EVENT_TARGET (body),
+               "compositionend",
+               G_CALLBACK (im_context_preedit_end_cb),
+               FALSE,
+               view);
 }
 
 static void
@@ -11041,22 +11073,6 @@ html_editor_view_drag_end_cb (EHTMLEditorView *view,
 }
 
 static void
-im_context_preedit_start_cb (GtkIMContext *context,
-                           EHTMLEditorView *view)
-{
-       view->priv->im_input_in_progress = TRUE;
-       remove_input_event_listener_from_body (view);
-}
-
-static void
-im_context_preedit_end_cb (GtkIMContext *context,
-                           EHTMLEditorView *view)
-{
-       view->priv->im_input_in_progress = FALSE;
-       register_input_event_listener_on_body (view);
-}
-
-static void
 html_editor_view_owner_change_clipboard_cb (GtkClipboard *clipboard,
                                             GdkEventOwnerChange *event,
                                             EHTMLEditorView *view)
@@ -11096,7 +11112,6 @@ e_html_editor_view_init (EHTMLEditorView *view)
        WebKitWebSettings *settings;
        GSettings *g_settings;
        GSettingsSchema *settings_schema;
-       GtkIMContext *im_context;
        ESpellChecker *checker;
        gchar **languages;
        gchar *comma_separated;
@@ -11202,14 +11217,6 @@ e_html_editor_view_init (EHTMLEditorView *view)
                (GDestroyNotify) g_free,
                (GDestroyNotify) g_free);
 
-       g_object_get (WEBKIT_WEB_VIEW (view), "im-context", &im_context, NULL);
-       g_signal_connect (
-               im_context, "preedit-start",
-               G_CALLBACK (im_context_preedit_start_cb), view);
-       g_signal_connect (
-               im_context, "preedit-end",
-               G_CALLBACK (im_context_preedit_end_cb), view);
-
        view->priv->im_input_in_progress = FALSE;
 
        g_signal_connect (


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