ecore-wl2: Add event for output transformation
authorChris Michael <cp.michael@samsung.com>
Wed, 7 Jun 2017 14:33:54 +0000 (10:33 -0400)
committerChris Michael <cp.michael@samsung.com>
Wed, 7 Jun 2017 15:08:48 +0000 (11:08 -0400)
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>
src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2.c
src/lib/ecore_wl2/ecore_wl2_output.c

index a401296..516c9bc 100644 (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
index b9c9ec5..fa4a774 100644 (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();
index 4e43f3f..1397ddf 100644 (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