From a9e0148c62f7d15a4962eef0192ccf46db1dea38 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Wed, 7 Jun 2017 10:33:54 -0400 Subject: [PATCH] ecore-wl2: Add event for output transformation Some servers may need to do special animations or other effects when an output transformation happens, so raise an event in the output geometry callback when this happens. @feature Signed-off-by: Chris Michael --- src/lib/ecore_wl2/Ecore_Wl2.h | 7 +++++++ src/lib/ecore_wl2/ecore_wl2.c | 5 ++++- src/lib/ecore_wl2/ecore_wl2_output.c | 29 +++++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index a4012961bb..516c9bcae9 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -270,6 +270,12 @@ typedef struct _Ecore_Wl2_Event_Offer_Data_Ready Ecore_Wl2_Display *display; } Ecore_Wl2_Event_Offer_Data_Ready; +typedef struct _Ecore_Wl2_Event_Output_Transform +{ + Ecore_Wl2_Output *output; + int transform, old_transform; +} Ecore_Wl2_Event_Output_Transform; + typedef enum _Ecore_Wl2_Window_Type { ECORE_WL2_WINDOW_TYPE_NONE, @@ -310,6 +316,7 @@ EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE; /** @since 1.19 */ EAPI extern int ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED; /** @since 1.20 */ EAPI extern int ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED; /** @since 1.20 */ EAPI extern int ECORE_WL2_EVENT_SEAT_SELECTION; /** @since 1.20 */ +EAPI extern int ECORE_WL2_EVENT_OUTPUT_TRANSFORM; /** @since 1.20 */ /** * @file diff --git a/src/lib/ecore_wl2/ecore_wl2.c b/src/lib/ecore_wl2/ecore_wl2.c index b9c9ec54fa..fa4a7747b8 100644 --- a/src/lib/ecore_wl2/ecore_wl2.c +++ b/src/lib/ecore_wl2/ecore_wl2.c @@ -39,6 +39,7 @@ EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE = 0; EAPI int ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED = 0; EAPI int ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED = 0; EAPI int ECORE_WL2_EVENT_SEAT_SELECTION = 0; +EAPI int ECORE_WL2_EVENT_OUTPUT_TRANSFORM = 0; EAPI int _ecore_wl2_event_window_www = -1; EAPI int _ecore_wl2_event_window_www_drag = -1; @@ -107,6 +108,7 @@ ecore_wl2_init(void) ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED = ecore_event_type_new(); ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED = ecore_event_type_new(); ECORE_WL2_EVENT_SEAT_SELECTION = ecore_event_type_new(); + ECORE_WL2_EVENT_OUTPUT_TRANSFORM = ecore_event_type_new(); } if (!no_session_recovery) no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY"); @@ -163,7 +165,8 @@ ecore_wl2_shutdown(void) ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, - ECORE_WL2_EVENT_SEAT_SELECTION); + ECORE_WL2_EVENT_SEAT_SELECTION, + ECORE_WL2_EVENT_OUTPUT_TRANSFORM); /* shutdown Ecore_Event */ ecore_event_shutdown(); diff --git a/src/lib/ecore_wl2/ecore_wl2_output.c b/src/lib/ecore_wl2/ecore_wl2_output.c index 4e43f3f12c..1397ddf724 100644 --- a/src/lib/ecore_wl2/ecore_wl2_output.c +++ b/src/lib/ecore_wl2/ecore_wl2_output.c @@ -8,17 +8,40 @@ static void _cb_geometry(void *data, struct wl_output *wl_output EINA_UNUSED, int x, int y, int w, int h, int subpixel EINA_UNUSED, const char *make, const char *model, int transform) { Ecore_Wl2_Output *output; + int ot; output = data; if (!output) return; + eina_stringshare_replace(&output->make, make); + eina_stringshare_replace(&output->model, model); + output->mw = w; output->mh = h; output->geometry.x = x; output->geometry.y = y; - output->transform = transform; - eina_stringshare_replace(&output->make, make); - eina_stringshare_replace(&output->model, model); + + ot = output->transform; + + if (transform & 0x4) + ERR("Cannot support output transformation"); + + transform &= 0x3; + if (output->transform != transform) + { + Ecore_Wl2_Event_Output_Transform *ev; + + output->transform = transform; + + ev = calloc(1, sizeof(Ecore_Wl2_Event_Output_Transform)); + if (ev) + { + ev->output = output; + ev->old_transform = ot; + ev->transform = transform; + ecore_event_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, ev, NULL, NULL); + } + } } static void