ecore_drm2: Handle raising event for session active/inactive
This commit is contained in:
parent
f6b0565b2b
commit
948a328965
|
@ -58,6 +58,15 @@ typedef struct _Ecore_Drm2_Plane Ecore_Drm2_Plane;
|
|||
/* opaque structure to represent a drm device */
|
||||
typedef struct _Ecore_Drm2_Device Ecore_Drm2_Device;
|
||||
|
||||
/* public structure to represent an event for session state changes */
|
||||
typedef struct _Ecore_Drm2_Event_Activate
|
||||
{
|
||||
Eina_Bool active : 1;
|
||||
} Ecore_Drm2_Event_Activate;
|
||||
|
||||
/* API events */
|
||||
EAPI extern int ECORE_DRM2_EVENT_ACTIVATE;
|
||||
|
||||
/* API functions */
|
||||
EAPI int ecore_drm2_init(void);
|
||||
EAPI int ecore_drm2_shutdown(void);
|
||||
|
|
|
@ -36,6 +36,8 @@ int (*sym_drmModeAtomicAddProperty)(drmModeAtomicReqPtr req, uint32_t object_id,
|
|||
int (*sym_drmModeAtomicCommit)(int fd, drmModeAtomicReqPtr req, uint32_t flags, void *user_data) = NULL;
|
||||
void (*sym_drmModeAtomicSetCursor)(drmModeAtomicReqPtr req, int cursor) = NULL;
|
||||
|
||||
EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1;
|
||||
|
||||
/* local static functions */
|
||||
static Eina_Bool
|
||||
_ecore_drm2_link(void)
|
||||
|
@ -144,6 +146,8 @@ ecore_drm2_init(void)
|
|||
goto log_err;
|
||||
}
|
||||
|
||||
ECORE_DRM2_EVENT_ACTIVATE = ecore_event_type_new();
|
||||
|
||||
if (!_ecore_drm2_link()) goto link_err;
|
||||
|
||||
return _ecore_drm2_init_count;
|
||||
|
@ -176,6 +180,8 @@ ecore_drm2_shutdown(void)
|
|||
|
||||
if (_drm_lib) dlclose(_drm_lib);
|
||||
|
||||
ECORE_DRM2_EVENT_ACTIVATE = -1;
|
||||
|
||||
eina_log_domain_unregister(_ecore_drm2_log_dom);
|
||||
_ecore_drm2_log_dom = -1;
|
||||
|
||||
|
|
|
@ -9,26 +9,29 @@
|
|||
|
||||
/* local functions */
|
||||
static Eina_Bool
|
||||
_ecore_drm2_device_cb_session_active(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
_ecore_drm2_device_cb_session_active(void *data, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
/* Ecore_Drm2_Device *dev; */
|
||||
Ecore_Drm2_Device *dev;
|
||||
Elput_Event_Session_Active *ev;
|
||||
Ecore_Drm2_Event_Activate *eevent;
|
||||
|
||||
/* dev = data; */
|
||||
dev = data;
|
||||
ev = event;
|
||||
|
||||
if (ev->active)
|
||||
{
|
||||
/* TODO: wake compositor, compositor damage all, set state_invalid = true */
|
||||
/* NB: Input enable is already done inside elput */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: compositor offscreen, output->repaint_needed = false */
|
||||
/* NB: Input disable is already done inside elput */
|
||||
Eina_List *l;
|
||||
Ecore_Drm2_Display *disp;
|
||||
|
||||
EINA_LIST_FOREACH(dev->displays, l, disp)
|
||||
ecore_drm2_display_dpms_set(disp, DRM_MODE_DPMS_ON);
|
||||
}
|
||||
|
||||
/* TODO: raise ecore_drm2_event_active ?? */
|
||||
eevent = calloc(1, sizeof(Ecore_Drm2_Event_Activate));
|
||||
if (!eevent) return ECORE_CALLBACK_RENEW;
|
||||
|
||||
eevent->active = ev->active;
|
||||
ecore_event_add(ECORE_DRM2_EVENT_ACTIVATE, eevent, NULL, NULL);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue