From 7aa0ff24c7c36e7f32522a1175ace5d1656f4077 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 19 Feb 2015 14:49:21 -0500 Subject: [PATCH] Provide wl_output events on hotplug Summary: Clients that have bound wl_output now receive wl_output events on hotplug NOTE: We don't handle removal yet Reviewers: devilhorns, zmike Reviewed By: devilhorns, zmike Subscribers: cedric Maniphest Tasks: T2131 Differential Revision: https://phab.enlightenment.org/D2008 --- src/modules/wl_drm/e_mod_main.c | 34 +++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c index fbaa615dd..4640599df 100644 --- a/src/modules/wl_drm/e_mod_main.c +++ b/src/modules/wl_drm/e_mod_main.c @@ -1,9 +1,11 @@ +#define E_COMP_WL #include "e.h" #include EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" }; static Ecore_Event_Handler *activate_handler; +static Ecore_Event_Handler *output_handler; static Eina_Bool session_state = EINA_FALSE; static Eina_Bool @@ -52,6 +54,33 @@ end: return ECORE_CALLBACK_PASS_ON; } +static Eina_Bool +_e_mod_drm_cb_output(void *data, int type EINA_UNUSED, void *event) +{ + Ecore_Drm_Event_Output *e; + Eina_List *l; + E_Comp *c; + struct wl_resource *resource; + + if ((!event) || (!data)) goto end; + e = event; + c = data; + + if (!e->plug) goto end; + + EINA_LIST_FOREACH(c->wl_comp_data->output.resources, l, resource) + { + wl_output_send_geometry(resource, e->x, e->y, e->phys_width, + e->phys_height, e->subpixel_order, + e->make, e->model, e->transform); + wl_output_send_scale(resource, 1); + if (wl_resource_get_version(resource) >= WL_OUTPUT_DONE_SINCE_VERSION) + wl_output_send_done(resource); + } +end: + return ECORE_CALLBACK_PASS_ON; +} + EAPI void * e_modapi_init(E_Module *m) { @@ -142,8 +171,9 @@ e_modapi_init(E_Module *m) activate_handler = ecore_event_handler_add(ECORE_DRM_EVENT_ACTIVATE, _e_mod_drm_cb_activate, comp); - - + output_handler = + ecore_event_handler_add(ECORE_DRM_EVENT_OUTPUT, + _e_mod_drm_cb_output, comp); return m; }