diff --git a/gtk2/fcitximcontext.cpp b/gtk2/fcitximcontext.cpp index fa7525e..5b3d7b3 100644 --- a/gtk2/fcitximcontext.cpp +++ b/gtk2/fcitximcontext.cpp @@ -509,14 +509,13 @@ static gboolean fcitx_im_context_filter_keypress(GtkIMContext *context, if (fcitxcontext->client_window == NULL && event->window != NULL) { gtk_im_context_set_client_window((GtkIMContext *)fcitxcontext, event->window); - - /* set_cursor_location_internal() will get origin from X server, - * it blocks UI. So delay it to idle callback. */ - gdk_threads_add_idle_full( - G_PRIORITY_DEFAULT_IDLE, - (GSourceFunc)_set_cursor_location_internal, - g_object_ref(fcitxcontext), (GDestroyNotify)g_object_unref); } + + /* set_cursor_location_internal() will get origin from X server, + * it blocks UI. So delay it to idle callback. */ + gdk_threads_add_idle_full( + G_PRIORITY_DEFAULT_IDLE, (GSourceFunc)_set_cursor_location_internal, + g_object_ref(fcitxcontext), (GDestroyNotify)g_object_unref); } if (event->state & (guint64)HandledMask) { diff --git a/gtk3/fcitximcontext.cpp b/gtk3/fcitximcontext.cpp index 4706e7f..c07870e 100644 --- a/gtk3/fcitximcontext.cpp +++ b/gtk3/fcitximcontext.cpp @@ -567,14 +567,13 @@ static gboolean fcitx_im_context_filter_keypress(GtkIMContext *context, if (fcitxcontext->client_window == NULL && event->window != NULL) { gtk_im_context_set_client_window((GtkIMContext *)fcitxcontext, event->window); - - /* set_cursor_location_internal() will get origin from X server, - * it blocks UI. So delay it to idle callback. */ - gdk_threads_add_idle_full( - G_PRIORITY_DEFAULT_IDLE, - (GSourceFunc)_set_cursor_location_internal, - g_object_ref(fcitxcontext), (GDestroyNotify)g_object_unref); } + + /* set_cursor_location_internal() will get origin from X server, + * it blocks UI. So delay it to idle callback. */ + gdk_threads_add_idle_full( + G_PRIORITY_DEFAULT_IDLE, (GSourceFunc)_set_cursor_location_internal, + g_object_ref(fcitxcontext), (GDestroyNotify)g_object_unref); } if (event->state & (guint64)HandledMask) {