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 <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-06-07 10:33:54 -04:00
parent 0a77b4e922
commit a9e0148c62
3 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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();

View File

@ -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