#include <input-method-server-protocol.h>
#define WTI_WARNING(resource, code, msg) (_e_input_panel_log_show((resource), (code), (msg), __func__))
+#define WAIT_UPDATE_TIMER_INTERVAL 2.0f
typedef struct _E_Input_Panel E_Input_Panel;
typedef struct _E_Input_Panel_Surface E_Input_Panel_Surface;
E_Input_Panel_Floating_Info *g_floating_info = NULL;
Eina_List *handlers = NULL;
static Eina_Bool panel_show_need_rerun = EINA_FALSE;
+static Ecore_Timer *g_timer_wait_update = NULL;
static void
_e_input_panel_log_show(struct wl_resource *resource, uint32_t code, const char *msg, const char *warning_msg)
}
static void
-_e_input_panel_surface_cb_ready_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t state EINA_UNUSED)
+_e_input_panel_surface_show(E_Input_Panel_Surface *ips)
{
- E_Input_Panel_Surface *ips = wl_resource_get_user_data(resource);
+ Eina_List *l = NULL;
+ E_Input_Panel_Surface *surface = NULL;
E_Client *focused_ec = NULL;
if (!g_input_panel) return;
+ /* When NULL passed, find the most appropriate surface */
if (!ips)
{
- WTI_WARNING(resource,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "No Input Panel Surface For Surface");
- return;
+ EINA_LIST_FOREACH(g_input_panel->surfaces, l, surface)
+ {
+ if (surface && surface->ec)
+ {
+ if (surface->ec->parent == e_client_focused_get())
+ {
+ ips = surface;
+ }
+ }
+ }
}
+ if (!ips) return;
+
+ LOGD("parent:%p, focus:%p, wait_update %d\n",
+ ips->ec ? ips->ec->parent : NULL, e_client_focused_get(), g_input_panel->wait_update);
+
if (g_input_panel->wait_update)
{
focused_ec = e_client_focused_get();
- LOGD("IPS::SHOW::READY (parent:%p, focus:%p)\n", ips->ec ? ips->ec->parent:NULL, focused_ec);
e_input_panel_wait_update_set(EINA_FALSE);
if (ips->ec->parent)
{
}
}
+static void _wait_update_timer_del()
+{
+ if (g_timer_wait_update)
+ {
+ LOGD("deleting wait_update timer");
+ ecore_timer_del(g_timer_wait_update);
+ g_timer_wait_update = NULL;
+ }
+}
+
+static Eina_Bool
+_wait_update_timer_handler(void *data)
+{
+ LOGE("TIMED OUT while waiting for ready_set");
+
+ _e_input_panel_surface_show(NULL);
+
+ g_timer_wait_update = NULL;
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_e_input_panel_surface_cb_ready_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t state EINA_UNUSED)
+{
+ E_Input_Panel_Surface *ips = wl_resource_get_user_data(resource);
+
+ if (!g_input_panel) return;
+
+ if (!ips)
+ {
+ WTI_WARNING(resource,
+ WL_DISPLAY_ERROR_INVALID_OBJECT,
+ "No Input Panel Surface For Surface");
+ return;
+ }
+
+ LOGD("IPS::SHOW::READY\n");
+
+ _e_input_panel_surface_show(ips);
+}
+
static void
_e_input_panel_surface_cb_floating_panel_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t state)
{
ips->showing = visible;
_e_input_panel_surface_visible_update(ips);
}
+
+ if (!visible) _wait_update_timer_del();
}
Eina_Bool
/* If we are in wait_update mode, the input panel surfaces have to be updated forcibly */
if (wait_update)
{
+ LOGD("Registering wait_update_timer");
+ _wait_update_timer_del();
+ g_timer_wait_update = ecore_timer_add(WAIT_UPDATE_TIMER_INTERVAL,
+ _wait_update_timer_handler, NULL);
+
EINA_LIST_FOREACH(g_input_panel->surfaces, l, ips)
{
if (!ips->ec) continue;