ecore_wl: ignore_output_transform 15/127315/1
authorBoram Park <boram1288.park@samsung.com>
Thu, 13 Apr 2017 07:47:30 +0000 (16:47 +0900)
committerBoram Park <boram1288.park@samsung.com>
Thu, 27 Apr 2017 04:42:41 +0000 (13:42 +0900)
Change-Id: Id7b3bf7e805f18ee1cbc3d41296b023f156b27ea

src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl.c
src/lib/ecore_wayland/ecore_wl_private.h
src/lib/ecore_wayland/ecore_wl_window.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h

index e9f5d78..9c1a14a 100644 (file)
@@ -87,6 +87,7 @@ 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_Ignore_Output_Transform Ecore_Wl_Event_Ignore_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;
@@ -109,6 +110,12 @@ struct _Ecore_Wl_Event_Output_Transform
    int transform;
 };
 
+struct _Ecore_Wl_Event_Ignore_Output_Transform
+{
+   Ecore_Wl_Window *win;
+   Eina_Bool ignore;
+};
+
 struct _Ecore_Wl_Event_Keymap_Update
 {
    Ecore_Wl_Input *input;
@@ -555,6 +562,7 @@ 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_IGNORE_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;
@@ -1494,6 +1502,8 @@ EAPI void ecore_wl_window_floating_mode_set(Ecore_Wl_Window *win, Eina_Bool floa
 EAPI void ecore_wl_window_geometry_get(Ecore_Wl_Window *win, int *x, int *y, int *w, int *h);
 EAPI Ecore_Wl_Input * ecore_wl_window_input_get(Ecore_Wl_Window *win);
 
+EAPI Eina_Bool ecore_wl_window_ignore_output_transform_get(Ecore_Wl_Window *win);
+
 #ifdef __cplusplus
 }
 #endif
index 2484aab..f9060f9 100644 (file)
@@ -68,6 +68,8 @@ static void _ecore_wl_cb_effect_end(void *data EINA_UNUSED, struct tizen_effect
 static void _ecore_wl_cb_indicator_flick(void *data EINA_UNUSED, struct tizen_indicator *tizen_indicator EINA_UNUSED, struct wl_surface *surface_resource, int type);
 static void _ecore_wl_cb_clipboard_data_selected(void *data EINA_UNUSED, struct tizen_clipboard *clipboard EINA_UNUSED, struct wl_surface *surface);
 static void _ecore_wl_cb_clipboard_data_only_allowed(void *data EINA_UNUSED, struct tizen_clipboard *clipboard EINA_UNUSED, uint32_t allowed);
+static void _ecore_wl_cb_ignore_output_transform(void *data EINA_UNUSED, struct tizen_screen_rotation *tizen_screen_rotation EINA_UNUSED, struct wl_surface *surface, uint32_t ignore);
+
 static void _ecore_wl_log_cb_print(const char *format, va_list args);
 /* local variables */
 static int _ecore_wl_init_count = 0;
@@ -150,6 +152,11 @@ static const struct tizen_clipboard_listener _ecore_tizen_clipboard_listener =
    _ecore_wl_cb_clipboard_data_only_allowed,
 };
 
+static const struct tizen_screen_rotation_listener _ecore_tizen_screen_rotation_listener =
+{
+   _ecore_wl_cb_ignore_output_transform,
+};
+
 static void
 xdg_shell_ping(void *data EINA_UNUSED, struct xdg_shell *shell, uint32_t serial)
 {
@@ -207,6 +214,7 @@ 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_IGNORE_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;
@@ -304,6 +312,7 @@ ecore_wl_init(const char *name)
         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_IGNORE_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();
@@ -790,6 +799,8 @@ _ecore_wl_shutdown(Eina_Bool close)
           tizen_indicator_destroy(_ecore_wl_disp->wl.tz_indicator);
         if (_ecore_wl_disp->wl.tz_clipboard)
           tizen_clipboard_destroy(_ecore_wl_disp->wl.tz_clipboard);
+        if (_ecore_wl_disp->wl.tz_screen_rotation)
+          tizen_screen_rotation_destroy(_ecore_wl_disp->wl.tz_screen_rotation);
         if (_ecore_wl_disp->cursor_theme)
           wl_cursor_theme_destroy(_ecore_wl_disp->cursor_theme);
         if (_ecore_wl_disp->wl.display)
@@ -1106,6 +1117,13 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
         if (ewd->wl.tz_clipboard)
           tizen_clipboard_add_listener(ewd->wl.tz_clipboard, &_ecore_tizen_clipboard_listener, ewd->wl.display);
      }
+   else if (!strcmp(interface, "tizen_screen_rotation"))
+     {
+        ewd->wl.tz_screen_rotation =
+           wl_registry_bind(registry, id, &tizen_screen_rotation_interface, 1);
+        if (ewd->wl.tz_screen_rotation)
+          tizen_screen_rotation_add_listener(ewd->wl.tz_screen_rotation, &_ecore_tizen_screen_rotation_listener, ewd->wl.display);
+     }
 
    if ((ewd->wl.compositor) && (ewd->wl.shm) &&
        ((ewd->wl.shell) || (ewd->wl.xdg_shell)))
@@ -2231,6 +2249,27 @@ _ecore_wl_cb_clipboard_data_only_allowed(void *data EINA_UNUSED, struct tizen_cl
 }
 
 static void
+_ecore_wl_cb_ignore_output_transform(void *data EINA_UNUSED, struct tizen_screen_rotation *tizen_screen_rotation EINA_UNUSED, struct wl_surface *surface, uint32_t ignore)
+{
+   Ecore_Wl_Window *win = NULL;
+   Ecore_Wl_Event_Ignore_Output_Transform *ev;
+
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if (!surface) return;
+   win = ecore_wl_window_surface_find(surface);
+   if (!win) return;
+
+   _ecore_wl_window_ignore_output_transform_set(win, ignore);
+
+   if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Ignore_Output_Transform)))) return;
+
+   ev->win = win;
+   ev->ignore = (ignore) ? EINA_TRUE : EINA_FALSE;
+   ecore_event_add(ECORE_WL_EVENT_IGNORE_OUTPUT_TRANSFORM, ev, NULL, NULL);
+}
+
+static void
 _ecore_wl_log_cb_print(const char *format, va_list args)
 {
    char buffer[1024];
index 1de69d6..8e3be5b 100644 (file)
@@ -102,6 +102,7 @@ struct _Ecore_Wl_Display
         struct tizen_effect *tz_effect;
         struct tizen_indicator *tz_indicator;
         struct tizen_clipboard *tz_clipboard;
+        struct tizen_screen_rotation *tz_screen_rotation;
 
         Eina_Bool prepare_read;
      } wl;
@@ -169,6 +170,7 @@ struct _Ecore_Wl_Window
    Eina_Bool focus_skip : 1;
    Eina_Bool iconified : 1;
    Eina_Bool floating : 1;
+   Eina_Bool ignore_output_transform : 1;
 
    struct
      {
@@ -432,4 +434,6 @@ void _ecore_wl_animator_vsync_tick_end(void *data);
 void _ecore_wl_animator_vsync_tick_quit(void *data);
 /* TIZEN_ONLY : To use vsync as a custom source of animator */
 
+void _ecore_wl_window_ignore_output_transform_set(Ecore_Wl_Window *win, Eina_Bool ignore);
+
 #endif
index bfe8116..71a5220 100644 (file)
@@ -654,6 +654,8 @@ ecore_wl_window_surface_create(Ecore_Wl_Window *win)
      win->surface = wl_compositor_create_surface(wlcomp);
    if (!win->surface) return NULL;
    win->surface_id = wl_proxy_get_id((struct wl_proxy *)win->surface);
+   if (_ecore_wl_disp->wl.tz_screen_rotation)
+     tizen_screen_rotation_get_ignore_output_transform(_ecore_wl_disp->wl.tz_screen_rotation, win->surface);
    return win->surface;
 }
 
@@ -2402,3 +2404,20 @@ ecore_wl_window_input_get(Ecore_Wl_Window *win)
 
    return NULL;
 }
+
+void
+_ecore_wl_window_ignore_output_transform_set(Ecore_Wl_Window *win, Eina_Bool ignore)
+{
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   if (!win) return;
+
+   win->ignore_output_transform = ignore;
+}
+
+EAPI Eina_Bool
+ecore_wl_window_ignore_output_transform_get(Ecore_Wl_Window *win)
+{
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   return win->ignore_output_transform;
+}
index e7e6146..142b257 100755 (executable)
@@ -112,12 +112,19 @@ static void
 _ecore_evas_wl_common_rotate_update(Ecore_Evas *ee)
 {
    Ecore_Evas_Engine_Wl_Data *wdata;
-   Ecore_Wl_Output *output;
    int rotation;
 
    wdata = ee->engine.data;
-   output = ecore_wl_window_output_find(wdata->win);
-   rotation = ecore_wl_output_transform_get(output) * 90;
+
+   if (ecore_wl_window_ignore_output_transform_get(wdata->win))
+     rotation = 0;
+   else
+     {
+        Ecore_Wl_Output *output = ecore_wl_window_output_find(wdata->win);
+        rotation = ecore_wl_output_transform_get(output) * 90;
+     }
+
+   WRN("ignore_output_transform(%d) rotation(%d)", ecore_wl_window_ignore_output_transform_get(wdata->win), rotation);
 
    if (_ecore_evas_wl_common_engine_rotation_get(ee) == ((rotation + ee->rotation) % 360))
      return;
@@ -505,6 +512,22 @@ _ecore_evas_wl_common_cb_output_transform(void *data, int type EINA_UNUSED, void
    if (output != ev->output) return ECORE_CALLBACK_PASS_ON;
 
    _ecore_evas_wl_common_rotate_update(ee);
+   evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+   _ecore_evas_wl_common_render(ee);
+
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_common_cb_ignore_output_transform(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
+{
+   Ecore_Evas *ee = data;
+
+   if (!ee) return ECORE_CALLBACK_PASS_ON;
+
+   _ecore_evas_wl_common_rotate_update(ee);
+   evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+   _ecore_evas_wl_common_render(ee);
 
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -853,6 +876,8 @@ _ecore_evas_wl_common_free(Ecore_Evas *ee)
    wdata = ee->engine.data;
    if (wdata->output_transform_hdl)
      ecore_event_handler_del(wdata->output_transform_hdl);
+   if (wdata->ignore_output_transform_hdl)
+     ecore_event_handler_del(wdata->ignore_output_transform_hdl);
    if (wdata->anim_callback)
      wl_callback_destroy(wdata->anim_callback);
    if (wdata->win) ecore_wl_window_free(wdata->win);
@@ -2217,6 +2242,10 @@ _ecore_evas_wl_common_output_transform_register(Ecore_Evas *ee)
    wdata->output_transform_hdl =
      ecore_event_handler_add(ECORE_WL_EVENT_OUTPUT_TRANSFORM,
                              _ecore_evas_wl_common_cb_output_transform, ee);
+   wdata->ignore_output_transform_hdl =
+     ecore_event_handler_add(ECORE_WL_EVENT_IGNORE_OUTPUT_TRANSFORM,
+                             _ecore_evas_wl_common_cb_ignore_output_transform, ee);
+
 }
 
 static void
index 4b238e0..fe04080 100755 (executable)
@@ -51,6 +51,8 @@ struct _Ecore_Evas_Engine_Wl_Data
 
    Ecore_Event_Handler *output_transform_hdl;
    short output_rotation;
+
+   Ecore_Event_Handler *ignore_output_transform_hdl;
 };
 
 Ecore_Evas_Interface_Wayland *_ecore_evas_wl_interface_new(void);