Add wm_rotation infrastructure support
authorRusty Lynch <rusty.lynch@intel.com>
Wed, 22 May 2013 16:57:50 +0000 (09:57 -0700)
committerEduardo Lima (Etrunko) <eduardo.lima@intel.com>
Tue, 13 Aug 2013 20:49:23 +0000 (17:49 -0300)
This adds the underlying infrastructure for ecore_evas_wm_rotation
support with the backend implementation for all backends nulled out.

16 files changed:
src/lib/ecore_evas/Ecore_Evas.h
src/lib/ecore_evas/ecore_evas.c
src/lib/ecore_evas/ecore_evas_buffer.c
src/lib/ecore_evas/ecore_evas_cocoa.c
src/lib/ecore_evas/ecore_evas_directfb.c
src/lib/ecore_evas/ecore_evas_ews.c
src/lib/ecore_evas/ecore_evas_extn.c
src/lib/ecore_evas/ecore_evas_fb.c
src/lib/ecore_evas/ecore_evas_private.h
src/lib/ecore_evas/ecore_evas_psl1ght.c
src/lib/ecore_evas/ecore_evas_sdl.c
src/lib/ecore_evas/ecore_evas_wayland_egl.c
src/lib/ecore_evas/ecore_evas_wayland_shm.c
src/lib/ecore_evas/ecore_evas_win32.c
src/lib/ecore_evas/ecore_evas_wince.c
src/lib/ecore_evas/ecore_evas_x.c

index db42d1d..c2eec61 100644 (file)
@@ -681,6 +681,13 @@ EAPI void        ecore_evas_profiles_set(Ecore_Evas *ee, const char **profiles,
  * @since 1.7.0
  */
 EAPI const char *ecore_evas_profile_get(const Ecore_Evas *ee);
+
+EAPI Eina_Bool        ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee);
+EAPI void             ecore_evas_wm_rotation_preferred_rotation_set(Ecore_Evas *ee, int rotation);
+EAPI int              ecore_evas_wm_rotation_preferred_rotation_get(const Ecore_Evas *ee);
+EAPI void             ecore_evas_wm_rotation_available_rotations_set(Ecore_Evas *ee, const int *rotations, unsigned int count);
+EAPI Eina_Bool        ecore_evas_wm_rotation_available_rotations_get(const Ecore_Evas *ee, int **rotations, unsigned int *count);
+
 /**
  * @brief Move an Ecore_Evas.
  *
index e480c86..203c6f1 100644 (file)
@@ -1960,6 +1960,97 @@ ecore_evas_profile_get(const Ecore_Evas *ee)
    return ee->prop.profile;
 }
 
+EAPI Eina_Bool
+ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_wm_rotation_supported_get");
+        return EINA_FALSE;
+     }
+   return ee->prop.wm_rot.supported;
+}
+
+EAPI void
+ecore_evas_wm_rotation_preferred_rotation_set(Ecore_Evas *ee, int rotation)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_wm_rotation_preferred_rotation_set");
+        return;
+     }
+   if (rotation != -1)
+     {
+        if (ee->prop.wm_rot.available_rots)
+          {
+             Eina_Bool found = EINA_FALSE;
+             unsigned int i;
+             for (i = 0; i < ee->prop.wm_rot.count; i++)
+               {
+                  if (ee->prop.wm_rot.available_rots[i] == rotation)
+                    {
+                       found = EINA_TRUE;
+                       break;
+                    }
+               }
+             if (!found) return;
+          }
+     }
+   IFC(ee, fn_wm_rot_preferred_rotation_set) (ee, rotation);
+   IFE;
+}
+
+EAPI int
+ecore_evas_wm_rotation_preferred_rotation_get(const Ecore_Evas *ee)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_wm_rotation_preferred_rotation_get");
+        return 0;
+     }
+   return ee->prop.wm_rot.rot;
+}
+
+EAPI void
+ecore_evas_wm_rotation_available_rotations_set(Ecore_Evas *ee, const int *rotations, unsigned int count)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_wm_rotation_available_rotations_set");
+        return;
+     }
+   IFC(ee, fn_wm_rot_available_rotations_set) (ee, rotations, count);
+   IFE;
+}
+
+EAPI Eina_Bool
+ecore_evas_wm_rotation_available_rotations_get(const Ecore_Evas *ee, int **rotations, unsigned int *count)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_wm_rotation_available_rotations_get");
+        return EINA_FALSE;
+     }
+   if ((!rotations) || (!count))
+     return EINA_FALSE;
+
+   if ((!ee->prop.wm_rot.available_rots) || (ee->prop.wm_rot.count == 0))
+     return EINA_FALSE;
+
+   *rotations = calloc(ee->prop.wm_rot.count, sizeof(int));
+   if (!*rotations) return EINA_FALSE;
+
+   memcpy(*rotations, ee->prop.wm_rot.available_rots, sizeof(int) * ee->prop.wm_rot.count);
+   *count = ee->prop.wm_rot.count;
+
+   return EINA_TRUE;
+}
+
 EAPI void
 ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
 {
index f15436c..22e9423 100644 (file)
@@ -526,7 +526,11 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
 
      _ecore_evas_buffer_render,
      NULL, // screen_geometry_get
-     NULL  // screen_dpi_get
+     NULL,  // screen_dpi_get
+
+     NULL, // wm_rot_preferred_rotation_set
+     NULL  // wm_rot_available_rotations_set
+
 };
 #endif
 
index 96ea1d4..60b3f34 100644 (file)
@@ -474,7 +474,10 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
 
      NULL, // render
      NULL,
-     NULL  // screen_dpi_get
+     NULL,  // screen_dpi_get
+
+     NULL, // wm_rot_preferred_rotation_set
+     NULL  // wm_rot_available_rotations_set
   };
 #endif
 
index d9fb237..bf9fbc4 100644 (file)
@@ -500,7 +500,10 @@ static Ecore_Evas_Engine_Func _ecore_directfb_engine_func =
 
      NULL, // render
      NULL, // screen_geometry_get
-     NULL  // screen_dpi_get
+     NULL,  // screen_dpi_get
+
+     NULL, // wm_rot_preferred_rotation_set
+     NULL  // wm_rot_available_rotations_set
 };
 #endif
 
index d6969cf..c9d0b5c 100644 (file)
@@ -694,7 +694,10 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
 
      _ecore_evas_ews_render,
      _ecore_evas_ews_screen_geometry_get,
-     NULL  // screen_dpi_get
+     NULL,  // screen_dpi_get
+
+     NULL, // wm_rot_preferred_rotation_set
+     NULL  // wm_rot_available_rotations_set
 };
 
 void
index bec246b..48376b3 100644 (file)
@@ -1189,7 +1189,10 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
 
    NULL, // render
    NULL, // screen_geometry_get
-   NULL  // screen_dpi_get
+   NULL,  // screen_dpi_get
+
+   NULL, // wm_rot_preferred_rotation_set
+   NULL  // wm_rot_available_rotations_set
 };
 
 static Eina_Bool
index f536565..caa1a48 100644 (file)
@@ -562,7 +562,10 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
 
      NULL, // render
      NULL, // screen_geometry_get
-     NULL  // screen_dpi_get
+     NULL,  // screen_dpi_get
+
+     NULL, // wm_rot_preferred_rotation_set
+     NULL  // wm_rot_available_rotations_set
 };
 #endif
 
index efeaa52..e2fd107 100644 (file)
@@ -189,6 +189,8 @@ struct _Ecore_Evas_Engine_Func
    int (*fn_render) (Ecore_Evas *ee);
    void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
    void (*fn_screen_dpi_get) (const Ecore_Evas *ee, int *xdpi, int *ydpi);
+   void (*fn_wm_rot_preferred_rotation_set) (Ecore_Evas *ee, int rot);
+   void (*fn_wm_rot_available_rotations_set) (Ecore_Evas *ee, const int *rots, unsigned int count);
 };
 
 struct _Ecore_Evas_Engine
@@ -221,6 +223,13 @@ struct _Ecore_Evas_Engine
       unsigned char  netwm_sync_set : 1;
       unsigned char  configure_coming : 1;
       struct {
+          unsigned char supported: 1;
+          unsigned char prepare : 1;
+          unsigned char request : 1;
+          unsigned char done : 1;
+          unsigned char configure_coming : 1;
+      } wm_rot;
+      struct {
           unsigned char modal : 1;
           unsigned char sticky : 1;
           unsigned char maximized_v : 1;
@@ -335,6 +344,18 @@ struct _Ecore_Evas
       char           *clas;
       char           *profile;
       struct {
+         Eina_Bool    supported;
+         int          angle;         // v0
+         Eina_Bool    win_resize;    // v0
+         int          w, h;          // v0
+         // added for the window manager rotation protocol
+         Eina_Bool    app_set;       // v1: app wants to communicate with the window manager to rotate
+         int          rot;           // v1: decided rotation by the window manager
+         int          preferred_rot; // v1: app specified rotation
+         int         *available_rots;// v1: app specified available rotations
+         unsigned int count;         // v1: number of elements of available rotations
+      } wm_rot;
+      struct {
         int          w, h;
       } min,
        max,
index 98d570e..dbd160c 100644 (file)
@@ -406,7 +406,10 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
 
    NULL, // render
    _ecore_evas_screen_geometry_get, // screen_geometry_get
-   NULL  // screen_dpi_get
+   NULL,  // screen_dpi_get
+
+   NULL, // wm_rot_preferred_rotation_set
+   NULL  // wm_rot_available_rotations_set
 };
 
 EAPI Ecore_Evas *
index a24394d..a77d9ed 100644 (file)
@@ -448,7 +448,10 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
 
    NULL, // render
    NULL, // screen_geometry_get
-   NULL  // screen_dpi_get
+   NULL,  // screen_dpi_get
+
+   NULL, // wm_rot_preferred_rotation_set
+   NULL  // wm_rot_available_rotations_set
 };
 
 static Ecore_Evas*
index 504b5e2..25aa6e0 100644 (file)
@@ -178,7 +178,9 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    NULL,
    _ecore_evas_wl_render, 
    _ecore_evas_wl_screen_geometry_get,
-   _ecore_evas_wl_screen_dpi_get
+   _ecore_evas_wl_screen_dpi_get,
+   NULL, // wm_rot_preferred_rotation_set
+   NULL  // wm_rot_available_rotations_set
 };
 
 /* external variables */
index a8e0181..7418f95 100644 (file)
@@ -197,7 +197,9 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    NULL, // focus skip set
    _ecore_evas_wl_render, 
    _ecore_evas_wl_screen_geometry_get,
-   _ecore_evas_wl_screen_dpi_get
+   _ecore_evas_wl_screen_dpi_get,
+   NULL, // wm_rot_preferred_rotation_set
+   NULL  // wm_rot_available_rotations_set
 };
 
 /* external variables */
index 59d6ed8..dc91a4d 100644 (file)
@@ -1121,7 +1121,10 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
 
      NULL, // render
      NULL, // screen_geometry_get
-     _ecore_evas_win32_screen_dpi_get
+     _ecore_evas_win32_screen_dpi_get,
+
+     NULL, // wm_rot_preferred_rotation_set
+     NULL  // wm_rot_available_rotations_set
 };
 
 #endif /* BUILD_ECORE_EVAS_WIN32 */
index fe0054a..d69e483 100644 (file)
@@ -802,7 +802,10 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func =
 
    NULL, // render
    NULL, // screen_geometry_get
-   _ecore_evas_wince_screen_dpi_get
+   _ecore_evas_wince_screen_dpi_get,
+
+   NULL, // wm_rot_preferred_rotation_set
+   NULL  // wm_rot_available_rotations_set
 };
 
 /* API */
index 75b483c..2ef7ca9 100644 (file)
@@ -3097,7 +3097,9 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
 
      NULL, // render
      _ecore_evas_x_screen_geometry_get,
-     _ecore_evas_x_screen_dpi_get
+     _ecore_evas_x_screen_dpi_get,
+     NULL, //_wm_rot_preferred_rotation_set
+     NULL //_wm_rot_available_rotations_set
 };
 #endif /* BUILD_ECORE_EVAS_X11 */