Make sure to show input panel regardless of launching completion 68/101268/7
authorInHong Han <inhong1.han@samsung.com>
Wed, 30 Nov 2016 12:57:40 +0000 (21:57 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 1 Dec 2016 07:40:19 +0000 (23:40 -0800)
Change-Id: I6e457f2bedd3f115e65a095c0ee668207681b3e6

src/e_mod_input_panel.c
src/e_mod_main.h

index 2360e57..ebdd237 100644 (file)
@@ -37,6 +37,20 @@ struct _E_Input_Panel_Surface
 
 E_Input_Panel *g_input_panel = NULL;
 Eina_List *handlers = NULL;
+static Eina_Bool panel_show_need_rerun = EINA_FALSE;
+
+static void
+_e_input_panel_surface_append(E_Input_Panel *input_panel, E_Input_Panel_Surface *ips)
+{
+   if (!input_panel || !ips) return;
+
+   input_panel->surfaces = eina_list_append(input_panel->surfaces, ips);
+
+   /* When a new input panel surface is created and if we have failed
+    * showing input panel previously, try to show it again here */
+   if (input_panel->surfaces && panel_show_need_rerun)
+     e_input_panel_visibility_change(EINA_TRUE);
+}
 
 static void
 _e_input_panel_surface_cb_toplevel_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *output_resource EINA_UNUSED, uint32_t position EINA_UNUSED)
@@ -54,7 +68,7 @@ _e_input_panel_surface_cb_toplevel_set(struct wl_client *client EINA_UNUSED, str
 
    if (!(input_panel = ips->input_panel)) return;
 
-   input_panel->surfaces = eina_list_append(input_panel->surfaces, ips);
+   _e_input_panel_surface_append(input_panel, ips);
    ips->panel = EINA_FALSE;
 }
 
@@ -74,7 +88,7 @@ _e_input_panel_surface_cb_overlay_panel_set(struct wl_client *client EINA_UNUSED
 
    if (!(input_panel = ips->input_panel)) return;
 
-   input_panel->surfaces = eina_list_append(input_panel->surfaces, ips);
+   _e_input_panel_surface_append(input_panel, ips);
    ips->panel = EINA_TRUE;
 }
 
@@ -246,6 +260,10 @@ _e_input_panel_surface_visible_update(E_Input_Panel_Surface *ips)
 
    if ((ips->showing) && (e_pixmap_usable_get(ec->pixmap)))
      {
+        /* Now we can assure that previous SHOW request actually succeeded,
+         * no need for trying re-run panel show command */
+        if (panel_show_need_rerun)
+          e_input_panel_show_need_rerun_set(EINA_FALSE);
 #ifdef _TV
         _e_input_panel_position_set(ec, ec->client.w, ec->client.h);
         ec->visible = EINA_TRUE;
@@ -504,7 +522,7 @@ _e_input_panel_cb_surface_get(struct wl_client *client, struct wl_resource *reso
    ips->ec = ec;
    ips->input_panel = input_panel;
 
-   input_panel->surfaces = eina_list_append(input_panel->surfaces, ips);
+   _e_input_panel_surface_append(input_panel, ips);
 
    wl_resource_set_implementation(cdata->shell.surface,
                                   &_e_input_panel_surface_implementation,
@@ -584,6 +602,11 @@ e_input_panel_visibility_change(Eina_Bool visible)
    E_Input_Panel_Surface *ips;
    Eina_List *l;
 
+   /* Here, if we are trying to show input panel, we can't guarantee our SHOW request
+    * will succeed or not at this point (input panel may not have created its surface)
+    * so set panel_show_need_rerun to TRUE to try showing it again afterwards */
+   e_input_panel_show_need_rerun_set(visible);
+
    if (!g_input_panel) return;
 
    EINA_LIST_FOREACH(g_input_panel->surfaces, l, ips)
@@ -818,3 +841,9 @@ e_input_panel_transient_for_set(E_Client *parent)
         EC_CHANGED(child);
      }
 }
+
+void
+e_input_panel_show_need_rerun_set(Eina_Bool need_rerun)
+{
+   panel_show_need_rerun = need_rerun;
+}
index bfa324e..9fa2d05 100644 (file)
@@ -10,5 +10,6 @@ Eina_Bool   e_input_panel_client_find(E_Client *ec);
 Eina_Bool   e_input_panel_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h);
 EINTERN void   e_input_panel_wait_update_set(Eina_Bool wait_update);
 EINTERN void   e_input_panel_transient_for_set(E_Client *parent);
+void        e_input_panel_show_need_rerun_set(Eina_Bool need_rerun);
 
 #endif