static bool _x_key_event_is_valid = false;
static Ecore_Timer *_resource_check_timer = NULL;
+static Ecore_Timer *_request_surrounding_text_timer = NULL;
static bool _need_wl_im_init = false;
static struct _wl_im *_wl_im_ctx = NULL;
#define WAYLAND_MODULE_CLIENT_ID (0)
#define MAX_PREEDIT_BUFSIZE 4000
+#define GET_SURROUNDING_TIMER_INTERVAL 0.2
#define MOD_SHIFT_MASK 0x01
#define MOD_CAPS_MASK 0x02
ecore_timer_del (_resource_check_timer);
_resource_check_timer = NULL;
+ if (_request_surrounding_text_timer)
+ ecore_timer_del (_request_surrounding_text_timer);
+ _request_surrounding_text_timer = NULL;
+
isf_wsc_context_del (wsc_ctx);
delete wsc_ctx;
_wl_im_ctx->wsc->wsc_ctx = NULL;
}
}
+static Eina_Bool
+get_surrounding_text_timer_cb (void *data)
+{
+ WSCContextISF* wsc_ctx = static_cast<WSCContextISF*>(data);
+ _request_surrounding_text_timer = NULL;
+
+ if (wsc_ctx)
+ remote_surrounding_get (wsc_ctx);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
static void
wsc_send_preedit (WSCContextISF* wsc_ctx, int32_t cursor)
{
wsc_ctx->preedit_str,
utf8_wcstombs (wsc_ctx->impl->commit_string).c_str ());
- if (_TV)
- remote_surrounding_get (wsc_ctx);
+ if (_TV) {
+ if (_request_surrounding_text_timer)
+ ecore_timer_del (_request_surrounding_text_timer);
+ _request_surrounding_text_timer = ecore_timer_add (GET_SURROUNDING_TIMER_INTERVAL, get_surrounding_text_timer_cb, wsc_ctx);
+ }
}
bool wsc_context_surrounding_get (WSCContextISF *wsc_ctx, char **text, int *cursor_pos)