static struct wl_global *dpms_global;
Ecore_Timer *delay_timer;
static struct wl_resource *gresource;
+static Eina_Bool dpms_binded;
typedef struct _E_Dpms
{
E_Dpms *dpms = NULL;
E_Dpms_Mode e_output_dpms;
- if (!data) return ECORE_CALLBACK_CANCEL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(gresource, ECORE_CALLBACK_CANCEL);
+
dpms = (E_Dpms *)data;
delay_timer = NULL;
- if (!gresource) return ECORE_CALLBACK_CANCEL;
-
e_output_dpms = e_output_dpms_get(dpms->e_output);
if (e_output_dpms != dpms->mode)
{
tizen_dpms_manager_send_set_state(gresource, dpms->mode, E_DPMS_MANAGER_ERROR_NONE);
INF("DPMS:tizen_dpms_manager send set event by timer(res:%p, output:%p, dpms:%d)", gresource, dpms->e_output, dpms->mode);
- gresource = NULL;
return ECORE_CALLBACK_CANCEL;
}
dpms = (E_Dpms *) data;
EINA_SAFETY_ON_NULL_RETURN(dpms);
+ EINA_SAFETY_ON_NULL_RETURN(gresource);
EINA_SAFETY_ON_FALSE_RETURN(dpms->e_output == output);
e_output_dpms = e_output_dpms_get(output);
- if (gresource)
- {
- if (delay_timer)
- ecore_timer_del(delay_timer);
- delay_timer = NULL;
- INF("DPMS:tizen_dpms_manager set dpms async cb(res:%p, output:%p, dpms:%d)",
- gresource, dpms->e_output, e_output_dpms);
- tizen_dpms_manager_send_set_state(gresource, e_output_dpms, E_DPMS_MANAGER_ERROR_NONE);
- gresource = NULL;
- }
+ if (delay_timer)
+ ecore_timer_del(delay_timer);
+ delay_timer = NULL;
+ INF("DPMS:tizen_dpms_manager set dpms async cb(res:%p, output:%p, dpms:%d)",
+ gresource, dpms->e_output, e_output_dpms);
+ tizen_dpms_manager_send_set_state(gresource, e_output_dpms, E_DPMS_MANAGER_ERROR_NONE);
}
static E_Dpms *
return;
}
+ dpms->mode = mode;
+
if (!e_output_connected(dpms->e_output))
{
e_output_dpms_set(dpms->e_output, mode);
- dpms->mode = mode;
INF("DPMS:tizen_dpms_manager set dpms fake(res:%p, output:%p, dpms:%d)", resource, dpms->e_output, mode);
if (dpms->dpms_change_hook)
return;
}
- gresource = resource;
- dpms->mode = mode;
-
if (delay_timer)
ecore_timer_del(delay_timer);
delay_timer = ecore_timer_add(1.0, _e_dpms_delay, dpms);
ERR("DPMS:tizen_dpms_manager set dpms fail(res:%p, output:%p, dpms=%d)", resource, dpms->e_output, mode);
ecore_timer_del(delay_timer);
delay_timer = NULL;
- gresource = NULL;
tizen_dpms_manager_send_set_state(resource, dpms->mode, E_DPMS_MANAGER_ERROR_INVALID_PERMISSION);
}
}
gresource = NULL;
wl_resource_destroy(resource);
+
+ dpms_binded = EINA_FALSE;
}
static const struct tizen_dpms_manager_interface _e_tizen_dpms_interface =
if (gresource == resource)
gresource = NULL;
+
+ dpms_binded = EINA_FALSE;
}
static void
{
struct wl_resource *res;
+ if (dpms_binded)
+ {
+ ERR("already binded.");
+ return;
+ }
+
if (!(res = wl_resource_create(client, &tizen_dpms_manager_interface, MIN(version, 1), id)))
{
ERR("Could not create tizen_dpms_manager resource");
return;
}
+ gresource = res;
+ dpms_binded = EINA_TRUE;
+
wl_resource_set_implementation(res, &_e_tizen_dpms_interface, NULL, _e_dpms_wl_cb_destroy);
}
e_dpms_init(void)
{
dbus_init_done_handler = NULL;
+ dpms_binded = EINA_FALSE;
if (e_dbus_conn_init() > 0)
{