+
+#ifdef _F_DEICONIFY_APPROVE_
+static void
+_e_border_window_pending_destroy_event_free(void *data __UNUSED__,
+ void *ev)
+{
+ Ecore_X_Event_Window_Destroy *e;
+
+ e = ev;
+ E_FREE(e);
+}
+
+static void
+_e_border_window_pending_hide_event_free(void *data __UNUSED__,
+ void *ev)
+{
+ Ecore_X_Event_Window_Hide *e;
+
+ e = ev;
+ E_FREE(e);
+}
+
+static void
+_e_border_window_pending_hide_event_send(E_Border *bd)
+{
+ Ecore_X_Event_Window_Hide *e;
+
+ if (!bd) return;
+
+ e = E_NEW(Ecore_X_Event_Window_Hide, 1);
+ if (e)
+ {
+ e->win = bd->client.e.state.pending_event.hide.win;
+ e->event_win = bd->client.e.state.pending_event.hide.event_win;
+ e->time = ecore_x_current_time_get();
+ e->send_event = bd->client.e.state.pending_event.hide.send_event;
+
+ ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e,
+ _e_border_window_pending_hide_event_free, NULL);
+
+ ELB(ELBT_BD, "Send pended HIDE event", e->win);
+ }
+}
+
+static void
+_e_border_window_pending_destroy_event_send(E_Border *bd)
+{
+ Ecore_X_Event_Window_Destroy *e;
+
+ if (!bd) return;
+
+ e = E_NEW(Ecore_X_Event_Window_Destroy, 1);
+ if (e)
+ {
+ e->win = bd->client.e.state.pending_event.destroy.win;
+ e->event_win = bd->client.e.state.pending_event.destroy.event_win;
+ e->time = ecore_x_current_time_get();
+
+ ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e,
+ _e_border_window_pending_destroy_event_free, NULL);
+
+ ELB(ELBT_BD, "Send pended DESTROY event", e->win);
+ }
+}
+
+static void
+_e_border_msg_handler(void *data,
+ const char *name,
+ const char *info,
+ int val,
+ E_Object *obj,
+ void *msgdata)
+{
+ E_Manager *man = (E_Manager *)obj;
+ E_Manager_Comp_Source *src = (E_Manager_Comp_Source *)msgdata;
+
+ // handle only comp.manager msg
+ if (strncmp(name, "comp.manager", sizeof("comp.manager"))) return;
+
+ if (!strncmp(info, "visibility.src", sizeof("visibility.src")))
+ {
+ Ecore_X_Window win;
+ E_Border *bd;
+ Eina_Bool visible;
+
+ win = e_manager_comp_src_window_get(man, src);
+ bd = e_border_find_by_window(win);
+
+ if (!bd) return;
+ if (!bd->client.e.state.deiconify_approve.pending_bd) return;
+
+ visible = e_manager_comp_src_visible_get(man, src);
+ if (visible)
+ {
+ E_Border *pending_bd = bd->client.e.state.deiconify_approve.pending_bd;
+ if (!pending_bd->client.e.state.pending_event.pending)
+ {
+ bd->client.e.state.deiconify_approve.pending_bd = NULL;
+ return;
+ }
+
+ pending_bd->client.e.state.pending_event.done = 1;
+ pending_bd->client.e.state.pending_event.hold_bd = NULL;
+
+ if (pending_bd->client.e.state.pending_event.hide.pending)
+ {
+ _e_border_window_pending_hide_event_send(pending_bd);
+
+ // clear hide event data
+ pending_bd->client.e.state.pending_event.hide.pending = 0;
+ pending_bd->client.e.state.pending_event.hide.win = 0;
+ pending_bd->client.e.state.pending_event.hide.event_win = 0;
+ pending_bd->client.e.state.pending_event.hide.send_event = 0;
+ }
+
+ if (pending_bd->client.e.state.pending_event.destroy.pending)
+ {
+ _e_border_window_pending_destroy_event_send(pending_bd);
+
+ // clear destroy event data
+ pending_bd->client.e.state.pending_event.destroy.pending = 0;
+ pending_bd->client.e.state.pending_event.destroy.win = 0;
+ pending_bd->client.e.state.pending_event.destroy.event_win = 0;
+ }
+
+ bd->client.e.state.deiconify_approve.pending_bd = NULL;
+ ELBF(ELBT_ROT, 0, bd->client.win, "RESET pending_bd:%x", bd->client.e.state.deiconify_approve.pending_bd);
+ }
+ }
+}
+#endif