Eina_List *hooks;
Eina_List *comp_object_intercept_hooks;
Eina_List *added_outputs;
+ E_Output_Hook *output_connect_status_hook;
/* Internal output data */
E_Output *output_primary;
return ECORE_CALLBACK_PASS_ON;
}
-static void
-_e_eom_deinit()
-{
- Ecore_Event_Handler *h = NULL;
-
- if (g_eom == NULL) return;
-
- if (g_eom->handlers)
- {
- EINA_LIST_FREE(g_eom->handlers, h)
- ecore_event_handler_del(h);
-
- g_eom->handlers = NULL;
- }
-
- _e_eom_output_deinit();
-
- if (g_eom->dpy)
- g_eom->dpy = NULL;
-
- if (g_eom->global)
- wl_global_destroy(g_eom->global);
- g_eom->global = NULL;
-
- E_FREE(g_eom);
-}
-
static Eina_Bool
-_e_eom_init()
-{
- EINA_SAFETY_ON_NULL_GOTO(e_comp_wl, err);
-
- if (e_comp->e_comp_screen->num_outputs < 1)
- return EINA_TRUE;
-
- g_eom = E_NEW(E_Eom, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(g_eom, EINA_FALSE);
-
- g_eom->global = wl_global_create(e_comp_wl->wl.disp, &wl_eom_interface, 1, g_eom, _e_eom_cb_wl_bind);
- EINA_SAFETY_ON_NULL_GOTO(g_eom->global, err);
-
- g_eom->dpy = e_comp->e_comp_screen->tdisplay;
- EINA_SAFETY_ON_NULL_GOTO(g_eom->dpy, err);
-
- g_eom->output_primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
- EINA_SAFETY_ON_NULL_GOTO(g_eom->output_primary, err);
-
- if (!_e_eom_output_init())
- {
- EOERR("_e_eom_output_init fail", NULL);
- goto err;
- }
-
- g_eom->timer = ecore_timer_add(EOM_CONNECT_CHECK_TIMEOUT, _e_eom_boot_connection_check, NULL);
-
- E_LIST_HANDLER_APPEND(g_eom->handlers, E_EVENT_CLIENT_BUFFER_CHANGE, _e_eom_cb_client_buffer_change, NULL);
-
- return EINA_TRUE;
-
-err:
- _e_eom_deinit();
-
- return EINA_FALSE;
-}
-
-EINTERN int
-e_eom_init(void)
-{
- Eina_Bool ret = EINA_FALSE;
-
- ret = _e_eom_init();
-
- if (ret == EINA_FALSE)
- return 0;
-
- return 1;
-}
-
-EINTERN int
-e_eom_shutdown(void)
-{
- if (!g_eom) return 1;
-
- _e_eom_deinit();
-
- return 1;
-}
-
-E_API Eina_Bool
-e_eom_is_ec_external(E_Client *ec)
-{
- E_EomOutputPtr eom_output;
-
- if (!g_eom) return EINA_FALSE;
-
- eom_output = _e_eom_output_by_ec_child_get(ec);
- if (!eom_output)
- return EINA_FALSE;
-
- return EINA_TRUE;
-}
-
-EINTERN Eina_Bool
-e_eom_connect(E_Output *output)
+_e_eom_connect(E_Output *output)
{
E_EomOutputPtr eom_output = NULL;
else
{
EOINF("Start Mirroring", eom_output->eout);
-
- _e_eom_output_state_set_mode(eom_output, EOM_OUTPUT_MODE_MIRROR);
_e_eom_output_state_set_mode(eom_output, EOM_OUTPUT_MODE_MIRROR);
eom_output->state = MIRROR;
-
e_output_external_set(output, E_OUTPUT_EXT_MIRROR);
}
return EINA_TRUE;
}
-EINTERN Eina_Bool
-e_eom_disconnect(E_Output *output)
+static Eina_Bool
+_e_eom_disconnect(E_Output *output)
{
E_EomOutputPtr eom_output = NULL;
return EINA_TRUE;
}
+static void
+_e_eom_output_cb_output_connect_status_change(void *data, E_Output *output)
+{
+ EINA_SAFETY_ON_NULL_RETURN(g_eom->output_primary);
+
+ /* doesn't care about the pirmary output */
+ if (g_eom->output_primary == output) return;
+
+ if (e_output_connected(output))
+ {
+ _e_eom_connect(output);
+ }
+ else
+ {
+ _e_eom_disconnect(output);
+ }
+}
+
+static void
+_e_eom_deinit()
+{
+ Ecore_Event_Handler *h = NULL;
+
+ if (g_eom == NULL) return;
+
+ if (g_eom->output_connect_status_hook)
+ {
+ e_output_hook_del(g_eom->output_connect_status_hook);
+ g_eom->output_connect_status_hook = NULL;
+ }
+
+ if (g_eom->handlers)
+ {
+ EINA_LIST_FREE(g_eom->handlers, h)
+ ecore_event_handler_del(h);
+
+ g_eom->handlers = NULL;
+ }
+
+ _e_eom_output_deinit();
+
+ if (g_eom->dpy)
+ g_eom->dpy = NULL;
+
+ if (g_eom->global)
+ wl_global_destroy(g_eom->global);
+ g_eom->global = NULL;
+
+ E_FREE(g_eom);
+}
+
+static Eina_Bool
+_e_eom_init()
+{
+ EINA_SAFETY_ON_NULL_GOTO(e_comp_wl, err);
+
+ if (e_comp->e_comp_screen->num_outputs < 1)
+ return EINA_TRUE;
+
+ g_eom = E_NEW(E_Eom, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(g_eom, EINA_FALSE);
+
+ g_eom->global = wl_global_create(e_comp_wl->wl.disp, &wl_eom_interface, 1, g_eom, _e_eom_cb_wl_bind);
+ EINA_SAFETY_ON_NULL_GOTO(g_eom->global, err);
+
+ g_eom->dpy = e_comp->e_comp_screen->tdisplay;
+ EINA_SAFETY_ON_NULL_GOTO(g_eom->dpy, err);
+
+ g_eom->output_primary = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
+ EINA_SAFETY_ON_NULL_GOTO(g_eom->output_primary, err);
+
+ if (!_e_eom_output_init())
+ {
+ EOERR("_e_eom_output_init fail", NULL);
+ goto err;
+ }
+
+ g_eom->timer = ecore_timer_add(EOM_CONNECT_CHECK_TIMEOUT, _e_eom_boot_connection_check, NULL);
+
+ E_LIST_HANDLER_APPEND(g_eom->handlers, E_EVENT_CLIENT_BUFFER_CHANGE, _e_eom_cb_client_buffer_change, NULL);
+
+ g_eom->output_connect_status_hook = e_output_hook_add(E_OUTPUT_HOOK_CONNECT_STATUS_CHANGE, _e_eom_output_cb_output_connect_status_change, g_eom);
+
+ return EINA_TRUE;
+
+err:
+ _e_eom_deinit();
+
+ return EINA_FALSE;
+}
+
+EINTERN int
+e_eom_init(void)
+{
+ Eina_Bool ret = EINA_FALSE;
+
+ ret = _e_eom_init();
+
+ if (ret == EINA_FALSE)
+ return 0;
+
+ return 1;
+}
+
+EINTERN int
+e_eom_shutdown(void)
+{
+ if (!g_eom) return 1;
+
+ _e_eom_deinit();
+
+ return 1;
+}
+
+E_API Eina_Bool
+e_eom_is_ec_external(E_Client *ec)
+{
+ E_EomOutputPtr eom_output;
+
+ if (!g_eom) return EINA_FALSE;
+
+ eom_output = _e_eom_output_by_ec_child_get(ec);
+ if (!eom_output)
+ return EINA_FALSE;
+
+ return EINA_TRUE;
+}
+
EINTERN Eina_Bool
e_eom_create(E_Output *output, Eina_Bool added)
{