From: Rusty Lynch Date: Wed, 22 May 2013 16:57:50 +0000 (-0700) Subject: Add wm_rotation infrastructure support X-Git-Tag: submit/tizen/20130814.144029~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c53f2040e8257b726c87c22c4a747457b6d2cea6;p=platform%2Fupstream%2Fecore.git Add wm_rotation infrastructure support This adds the underlying infrastructure for ecore_evas_wm_rotation support with the backend implementation for all backends nulled out. --- diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index db42d1d..c2eec61 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -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. * diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index e480c86..203c6f1 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -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) { diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c index f15436c..22e9423 100644 --- a/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/src/lib/ecore_evas/ecore_evas_buffer.c @@ -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 diff --git a/src/lib/ecore_evas/ecore_evas_cocoa.c b/src/lib/ecore_evas/ecore_evas_cocoa.c index 96ea1d4..60b3f34 100644 --- a/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/src/lib/ecore_evas/ecore_evas_cocoa.c @@ -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 diff --git a/src/lib/ecore_evas/ecore_evas_directfb.c b/src/lib/ecore_evas/ecore_evas_directfb.c index d9fb237..bf9fbc4 100644 --- a/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/src/lib/ecore_evas/ecore_evas_directfb.c @@ -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 diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c index d6969cf..c9d0b5c 100644 --- a/src/lib/ecore_evas/ecore_evas_ews.c +++ b/src/lib/ecore_evas/ecore_evas_ews.c @@ -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 diff --git a/src/lib/ecore_evas/ecore_evas_extn.c b/src/lib/ecore_evas/ecore_evas_extn.c index bec246b..48376b3 100644 --- a/src/lib/ecore_evas/ecore_evas_extn.c +++ b/src/lib/ecore_evas/ecore_evas_extn.c @@ -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 diff --git a/src/lib/ecore_evas/ecore_evas_fb.c b/src/lib/ecore_evas/ecore_evas_fb.c index f536565..caa1a48 100644 --- a/src/lib/ecore_evas/ecore_evas_fb.c +++ b/src/lib/ecore_evas/ecore_evas_fb.c @@ -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 diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index efeaa52..e2fd107 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -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, diff --git a/src/lib/ecore_evas/ecore_evas_psl1ght.c b/src/lib/ecore_evas/ecore_evas_psl1ght.c index 98d570e..dbd160c 100644 --- a/src/lib/ecore_evas/ecore_evas_psl1ght.c +++ b/src/lib/ecore_evas/ecore_evas_psl1ght.c @@ -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 * diff --git a/src/lib/ecore_evas/ecore_evas_sdl.c b/src/lib/ecore_evas/ecore_evas_sdl.c index a24394d..a77d9ed 100644 --- a/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/src/lib/ecore_evas/ecore_evas_sdl.c @@ -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* diff --git a/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/src/lib/ecore_evas/ecore_evas_wayland_egl.c index 504b5e2..25aa6e0 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_egl.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_egl.c @@ -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 */ diff --git a/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/src/lib/ecore_evas/ecore_evas_wayland_shm.c index a8e0181..7418f95 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_shm.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_shm.c @@ -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 */ diff --git a/src/lib/ecore_evas/ecore_evas_win32.c b/src/lib/ecore_evas/ecore_evas_win32.c index 59d6ed8..dc91a4d 100644 --- a/src/lib/ecore_evas/ecore_evas_win32.c +++ b/src/lib/ecore_evas/ecore_evas_win32.c @@ -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 */ diff --git a/src/lib/ecore_evas/ecore_evas_wince.c b/src/lib/ecore_evas/ecore_evas_wince.c index fe0054a..d69e483 100644 --- a/src/lib/ecore_evas/ecore_evas_wince.c +++ b/src/lib/ecore_evas/ecore_evas_wince.c @@ -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 */ diff --git a/src/lib/ecore_evas/ecore_evas_x.c b/src/lib/ecore_evas/ecore_evas_x.c index 75b483c..2ef7ca9 100644 --- a/src/lib/ecore_evas/ecore_evas_x.c +++ b/src/lib/ecore_evas/ecore_evas_x.c @@ -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 */