ecore_wl: add ECORE_WL_EVENT_OUTPUT_TRANSFORM event 09/127309/1
authorBoram Park <boram1288.park@samsung.com>
Fri, 17 Mar 2017 04:34:26 +0000 (13:34 +0900)
committerBoram Park <boram1288.park@samsung.com>
Thu, 27 Apr 2017 04:42:41 +0000 (13:42 +0900)
Change-Id: I265a270587810991e065ff15c297e6b304337484

src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl.c
src/lib/ecore_wayland/ecore_wl_output.c

index b11c16424149c64196f2eeed76e228aa1c61a532..fe5eee96dc43a839c77f22747e370623f56fd584 100644 (file)
@@ -86,6 +86,7 @@ typedef struct _Ecore_Wl_Event_Window_Iconify_State_Change Ecore_Wl_Event_Window
 typedef struct _Ecore_Wl_Event_Effect Ecore_Wl_Event_Effect_Start;
 typedef struct _Ecore_Wl_Event_Effect Ecore_Wl_Event_Effect_End;
 typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
+typedef struct _Ecore_Wl_Event_Output_Transform Ecore_Wl_Event_Output_Transform;
 typedef struct _Ecore_Wl_Event_Global Ecore_Wl_Event_Global;
 typedef struct _Ecore_Wl_Event_Keymap_Update Ecore_Wl_Event_Keymap_Update;
 typedef struct _Ecore_Wl_Event_Indicator_Flick Ecore_Wl_Event_Indicator_Flick;
@@ -101,6 +102,13 @@ struct _Ecore_Wl_Event_Global
    unsigned int id, version;
 };
 
+struct _Ecore_Wl_Event_Output_Transform
+{
+   Ecore_Wl_Output *output;
+   int old_transform;
+   int transform;
+};
+
 struct _Ecore_Wl_Event_Keymap_Update
 {
    Ecore_Wl_Input *input;
@@ -546,6 +554,7 @@ EAPI extern int ECORE_WL_EVENT_AUX_MESSAGE;
 EAPI extern int ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE;
 EAPI extern int ECORE_WL_EVENT_EFFECT_START;
 EAPI extern int ECORE_WL_EVENT_EFFECT_END;
+EAPI extern int ECORE_WL_EVENT_OUTPUT_TRANSFORM;
 EAPI extern int ECORE_WL_EVENT_GLOBAL_ADDED;
 EAPI extern int ECORE_WL_EVENT_GLOBAL_REMOVED;
 EAPI extern int ECORE_WL_EVENT_KEYMAP_UPDATE;
index df3d8a04b98ec1128c6ce7b9ab57d1bb7252822a..5d0a5972841cb8d5a68ee99f61ee2927699aab0a 100644 (file)
@@ -206,6 +206,7 @@ EAPI int ECORE_WL_EVENT_AUX_MESSAGE = 0;
 EAPI int ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE = 0;
 EAPI int ECORE_WL_EVENT_EFFECT_START = 0;
 EAPI int ECORE_WL_EVENT_EFFECT_END = 0;
+EAPI int ECORE_WL_EVENT_OUTPUT_TRANSFORM = 0;
 EAPI int ECORE_WL_EVENT_GLOBAL_ADDED = 0;
 EAPI int ECORE_WL_EVENT_GLOBAL_REMOVED = 0;
 EAPI int ECORE_WL_EVENT_KEYMAP_UPDATE = 0;
@@ -302,6 +303,7 @@ ecore_wl_init(const char *name)
         ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE = ecore_event_type_new();
         ECORE_WL_EVENT_EFFECT_START = ecore_event_type_new();
         ECORE_WL_EVENT_EFFECT_END = ecore_event_type_new();
+        ECORE_WL_EVENT_OUTPUT_TRANSFORM = ecore_event_type_new();
         ECORE_WL_EVENT_GLOBAL_ADDED = ecore_event_type_new();
         ECORE_WL_EVENT_GLOBAL_REMOVED = ecore_event_type_new();
         ECORE_WL_EVENT_KEYMAP_UPDATE = ecore_event_type_new();
index 596a0f80a99e5e1edd7005e84fe193f7e70e3fb1..f511d34e9d56127410130149bf24d155ef067872 100644 (file)
@@ -12,12 +12,30 @@ _ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output EINA_UNUSED
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
+   if (transform & 0x4)
+     ERR("can't support the output flip transform");
+
+   transform &= 0x3;
+
    output = data;
    output->allocation.x = x;
    output->allocation.y = y;
    output->mw = w;
    output->mh = h;
-   output->transform = transform;
+
+   if (output->transform != transform)
+     {
+        Ecore_Wl_Event_Output_Transform *ev;
+
+        output->transform = transform;
+
+        if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Output_Transform)))) return;
+
+        ev->output = output;
+        ev->old_transform = output->transform;
+        ev->transform = transform;
+        ecore_event_add(ECORE_WL_EVENT_OUTPUT_TRANSFORM, ev, NULL, NULL);
+     }
 }
 
 /* Sets the output's mode */
@@ -88,6 +106,9 @@ _ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id)
 
    ewd->outputs = eina_inlist_append(ewd->outputs, EINA_INLIST_GET(output));
    wl_output_add_listener(output->output, &_ecore_wl_output_listener, output);
+
+   /* to dispatch the output geometry event now */
+   ecore_wl_sync();
 }
 
 /* Destruct the output and remove it from the display's list of available