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



commit c58abf599c582f38a4dcc3d3fa9c315bb9898723
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 5835f0b..d22b0c6 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -7773,6 +7773,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)
 {
@@ -7796,6 +7814,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
@@ -11075,22 +11107,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)
@@ -11130,7 +11146,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;
@@ -11236,14 +11251,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]