summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
diff options
context:
space:
mode:
authorJihoon Kim <imfine98@gmail.com>2012-01-18 04:38:04 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-01-18 04:38:04 +0000
commitc652e4e78a89999aaa76769aac8d7f600368ab50 (patch)
tree59c15627a774d61447816b2c4ffa9487941f943e /legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
parent537bc81acbdef82c74b2887ef3becf90c48c8483 (diff)
From: Jihoon Kim <imfine98@gmail.com>
Long time ago, in http://www.mail-archive.com/enlightenment-devel@lists.sourceforge.net/msg32795.html mail thread and IRC, I talked with about problem of asynchronous event API such as ecore_imf_context_commit_event_add, ecore_imf_context_preedit_changed_event_add, so on. In short, The problem is that key event and text_set APIs are processed immediately, but commit event and preedit changed event is processed asynchronously because those APIs add each event to ecore event queue. To fix these problems, I've decided to create synchronous event APIs such as ecore_imf_context_event_callback_add, del and call. For considering compatibility, sync and async event callback functions are used in xim and scim immodule. SVN revision: 67290
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp45
1 files changed, 38 insertions, 7 deletions
diff --git a/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp b/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
index b4edfe4400..6cb72c2954 100644
--- a/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
+++ b/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
@@ -806,8 +806,10 @@ isf_imf_context_reset (Ecore_IMF_Context *ctx)
806 if (context_scim->impl->need_commit_preedit) 806 if (context_scim->impl->need_commit_preedit)
807 { 807 {
808 if (wstr.length ()) 808 if (wstr.length ())
809 ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); 809 {
810 810 ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ());
811 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
812 }
811 _panel_client.prepare (context_scim->id); 813 _panel_client.prepare (context_scim->id);
812 _panel_client.send (); 814 _panel_client.send ();
813 } 815 }
@@ -951,8 +953,10 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx)
951 if (context_scim->impl->need_commit_preedit) 953 if (context_scim->impl->need_commit_preedit)
952 { 954 {
953 if (wstr.length ()) 955 if (wstr.length ())
954 ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); 956 {
955 957 ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ());
958 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
959 }
956 _panel_client.prepare (context_scim->id); 960 _panel_client.prepare (context_scim->id);
957 _panel_client.send (); 961 _panel_client.send ();
958 } 962 }
@@ -1520,6 +1524,7 @@ panel_slot_commit_string (int context, const WideString &wstr)
1520 return; 1524 return;
1521 1525
1522 ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (wstr).c_str ()); 1526 ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (wstr).c_str ());
1527 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
1523 } 1528 }
1524} 1529}
1525 1530
@@ -1818,7 +1823,9 @@ turn_on_ic (EcoreIMFContextISF *ic)
1818 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 1823 if (ic->impl->use_preedit && ic->impl->preedit_string.length ())
1819 { 1824 {
1820 ecore_imf_context_preedit_start_event_add (ic->ctx); 1825 ecore_imf_context_preedit_start_event_add (ic->ctx);
1826 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
1821 ecore_imf_context_preedit_changed_event_add (ic->ctx); 1827 ecore_imf_context_preedit_changed_event_add (ic->ctx);
1828 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1822 ic->impl->preedit_started = true; 1829 ic->impl->preedit_started = true;
1823 } 1830 }
1824 } 1831 }
@@ -1848,7 +1855,9 @@ turn_off_ic (EcoreIMFContextISF *ic)
1848 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 1855 if (ic->impl->use_preedit && ic->impl->preedit_string.length ())
1849 { 1856 {
1850 ecore_imf_context_preedit_changed_event_add (ic->ctx); 1857 ecore_imf_context_preedit_changed_event_add (ic->ctx);
1858 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1851 ecore_imf_context_preedit_end_event_add (ic->ctx); 1859 ecore_imf_context_preedit_end_event_add (ic->ctx);
1860 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
1852 ic->impl->preedit_started = false; 1861 ic->impl->preedit_started = false;
1853 } 1862 }
1854 } 1863 }
@@ -2183,7 +2192,9 @@ open_specific_factory (EcoreIMFContextISF *ic,
2183 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 2192 if (ic->impl->use_preedit && ic->impl->preedit_string.length ())
2184 { 2193 {
2185 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2194 ecore_imf_context_preedit_changed_event_add (ic->ctx);
2195 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2186 ecore_imf_context_preedit_end_event_add (ic->ctx); 2196 ecore_imf_context_preedit_end_event_add (ic->ctx);
2197 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
2187 ic->impl->preedit_started = false; 2198 ic->impl->preedit_started = false;
2188 } 2199 }
2189 } 2200 }
@@ -2452,6 +2463,7 @@ slot_show_preedit_string (IMEngineInstanceBase *si)
2452 if (!ic->impl->preedit_started) 2463 if (!ic->impl->preedit_started)
2453 { 2464 {
2454 ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); 2465 ecore_imf_context_preedit_start_event_add (_focused_ic->ctx);
2466 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2455 ic->impl->preedit_started = true; 2467 ic->impl->preedit_started = true;
2456 } 2468 }
2457 } 2469 }
@@ -2502,10 +2514,14 @@ slot_hide_preedit_string (IMEngineInstanceBase *si)
2502 if (ic->impl->use_preedit) 2514 if (ic->impl->use_preedit)
2503 { 2515 {
2504 if (emit) 2516 if (emit)
2505 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2517 {
2518 ecore_imf_context_preedit_changed_event_add (ic->ctx);
2519 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2520 }
2506 if (ic->impl->preedit_started) 2521 if (ic->impl->preedit_started)
2507 { 2522 {
2508 ecore_imf_context_preedit_end_event_add (ic->ctx); 2523 ecore_imf_context_preedit_end_event_add (ic->ctx);
2524 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
2509 ic->impl->preedit_started = false; 2525 ic->impl->preedit_started = false;
2510 } 2526 }
2511 } 2527 }
@@ -2551,9 +2567,11 @@ slot_update_preedit_caret (IMEngineInstanceBase *si, int caret)
2551 if (!ic->impl->preedit_started) 2567 if (!ic->impl->preedit_started)
2552 { 2568 {
2553 ecore_imf_context_preedit_start_event_add (ic->ctx); 2569 ecore_imf_context_preedit_start_event_add (ic->ctx);
2570 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2554 ic->impl->preedit_started = true; 2571 ic->impl->preedit_started = true;
2555 } 2572 }
2556 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2573 ecore_imf_context_preedit_changed_event_add (ic->ctx);
2574 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2557 } 2575 }
2558 else 2576 else
2559 _panel_client.update_preedit_caret (ic->id, caret); 2577 _panel_client.update_preedit_caret (ic->id, caret);
@@ -2578,11 +2596,13 @@ slot_update_preedit_string (IMEngineInstanceBase *si,
2578 if (!ic->impl->preedit_started) 2596 if (!ic->impl->preedit_started)
2579 { 2597 {
2580 ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); 2598 ecore_imf_context_preedit_start_event_add (_focused_ic->ctx);
2599 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2581 ic->impl->preedit_started = true; 2600 ic->impl->preedit_started = true;
2582 } 2601 }
2583 ic->impl->preedit_caret = str.length (); 2602 ic->impl->preedit_caret = str.length ();
2584 ic->impl->preedit_updating = true; 2603 ic->impl->preedit_updating = true;
2585 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2604 ecore_imf_context_preedit_changed_event_add (ic->ctx);
2605 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2586 ic->impl->preedit_updating = false; 2606 ic->impl->preedit_updating = false;
2587 } 2607 }
2588 else 2608 else
@@ -2614,7 +2634,10 @@ slot_commit_string (IMEngineInstanceBase *si,
2614 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2634 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2615 2635
2616 if (ic && ic->ctx) 2636 if (ic && ic->ctx)
2617 ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (str).c_str ()); 2637 {
2638 ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (str).c_str ());
2639 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str());
2640 }
2618} 2641}
2619 2642
2620static void 2643static void
@@ -2761,7 +2784,12 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si,
2761 2784
2762 if (ic && ic->impl && _focused_ic == ic) 2785 if (ic && ic->impl && _focused_ic == ic)
2763 { 2786 {
2787 Ecore_IMF_Event_Delete_Surrounding ev;
2788 ev.ctx = _focused_ic->ctx;
2789 ev.n_chars = len;
2790 ev.offset = offset;
2764 ecore_imf_context_delete_surrounding_event_add (_focused_ic->ctx, offset, len); 2791 ecore_imf_context_delete_surrounding_event_add (_focused_ic->ctx, offset, len);
2792 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev);
2765 return true; 2793 return true;
2766 } 2794 }
2767 return false; 2795 return false;
@@ -2803,6 +2831,9 @@ fallback_commit_string_cb (IMEngineInstanceBase *si __UNUSED__,
2803 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2831 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2804 2832
2805 if (_focused_ic && _focused_ic->impl) 2833 if (_focused_ic && _focused_ic->impl)
2806 ecore_imf_context_commit_event_add (_focused_ic->ctx, utf8_wcstombs (str).c_str ()); 2834 {
2835 ecore_imf_context_commit_event_add (_focused_ic->ctx, utf8_wcstombs (str).c_str ());
2836 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str());
2837 }
2807} 2838}
2808 2839