summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwanglim Lee <gl77.lee@samsung.com>2014-02-09 09:46:51 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-02-09 09:46:51 +0900
commit77092d94d457d35e11194e0b2ee2a2e9b90b38b9 (patch)
tree860f1b7c7e0e49ac61648471dd82ae09cf882b17
parent259f33679c38e03de3e35c3a0859b3f3f0f9c39a (diff)
ecore_evas: added window manager rotation to manage the rotation of windows by the WM.
Summary: The window manager rotation allows the WM to controls the rotation of application windows. It is designed to support synchronized rotation for the multiple application windows at same time. Reviewers: raster, seoz, cedric, Hermet Reviewed By: raster CC: cedric Differential Revision: https://phab.enlightenment.org/D529
Diffstat (limited to '')
-rw-r--r--ChangeLog13
-rw-r--r--src/lib/ecore_evas/Ecore_Evas.h81
-rw-r--r--src/lib/ecore_evas/ecore_evas.c152
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.c10
-rw-r--r--src/lib/ecore_evas/ecore_evas_ews.c10
-rw-r--r--src/lib/ecore_evas/ecore_evas_private.h20
-rw-r--r--src/lib/ecore_x/Ecore_X.h13
-rw-r--r--src/lib/ecore_x/Ecore_X_Atoms.h10
-rw-r--r--src/lib/ecore_x/ecore_x_atoms_decl.h21
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_e.c289
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_e.c278
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c10
-rw-r--r--src/modules/ecore_evas/engines/drm/ecore_evas_drm.c10
-rw-r--r--src/modules/ecore_evas/engines/extn/ecore_evas_extn.c14
-rw-r--r--src/modules/ecore_evas/engines/fb/ecore_evas_fb.c10
-rw-r--r--src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c10
-rw-r--r--src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c10
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c7
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c7
-rw-r--r--src/modules/ecore_evas/engines/win32/ecore_evas_win32.c10
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c394
21 files changed, 1301 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index a772e501d2..6c1bd85175 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
12014-02-09 Gwanglim Lee
2
3 * Ecore_Evas: Added window manager rotation to manage the rotation of
4 windows by the WM.
5 - add ecore_evas_wm_rotation_supported_get
6 - add ecore_evas_wm_rotation_preferred_rotation_set
7 - add ecore_evas_wm_rotation_preferred_rotation_get
8 - add ecore_evas_wm_rotation_available_rotations_set
9 - add ecore_evas_wm_rotation_available_rotations_get
10 - add ecore_evas_wm_rotation_manual_rotation_done_set
11 - add ecore_evas_wm_rotation_manual_rotation_done_get
12 - add ecore_evas_wm_rotation_manual_rotation_done
13
12013-12-02 Daniel Juyung Seo (SeoZ) 142013-12-02 Daniel Juyung Seo (SeoZ)
2 15
3 * Check ecore_x_window_prop_card32_get() return value correctly in ecore_x_e. 16 * Check ecore_x_window_prop_card32_get() return value correctly in ecore_x_e.
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 3625316549..2ef08e50f3 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -684,6 +684,87 @@ EAPI void ecore_evas_window_available_profiles_set(Ecore_Evas *ee, const
684 */ 684 */
685EAPI Eina_Bool ecore_evas_window_available_profiles_get(Ecore_Evas *ee, char ***profiles, unsigned int *count); 685EAPI Eina_Bool ecore_evas_window_available_profiles_get(Ecore_Evas *ee, char ***profiles, unsigned int *count);
686/** 686/**
687 * @brief Query if the underlying windowing system supports the window manager rotation.
688 *
689 * @param ee The Ecore_Evas
690 * @return @c EINA_TRUE if the window manager rotation is supported, @c EINA_FALSE otherwise.
691 *
692 * @warning Support for this depends on the underlying windowing system.
693 * @since 1.9.0
694 */
695EAPI Eina_Bool ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee);
696/**
697 * @brief Set the preferred rotation hint.
698 *
699 * @param ee The Ecore_Evas to set
700 * @param rotation Value to set the preferred rotation hint
701 *
702 * @warning Support for this depends on the underlying windowing system.
703 * @since 1.9.0
704 */
705EAPI void ecore_evas_wm_rotation_preferred_rotation_set(Ecore_Evas *ee, int rotation);
706/**
707 * @brief Get the preferred rotation hint.
708 *
709 * @param ee The Ecore_Evas to get the preferred rotation hint from.
710 * @return The preferred rotation hint, -1 on failure.
711 *
712 * @warning Support for this depends on the underlying windowing system.
713 * @since 1.9.0
714 */
715EAPI int ecore_evas_wm_rotation_preferred_rotation_get(const Ecore_Evas *ee);
716/**
717 * @brief Set the array of available window rotations.
718 *
719 * @param ee The Ecore_Evas to set
720 * @param rotations The integer array of available window rotations
721 * @param count The number of members in rotations
722 *
723 * @warning Support for this depends on the underlying windowing system.
724 * @since 1.9.0
725 */
726EAPI void ecore_evas_wm_rotation_available_rotations_set(Ecore_Evas *ee, const int *rotations, unsigned int count);
727/**
728 * @brief Get the array of available window rotations.
729 *
730 * @param ee The Ecore_Evas to get available window rotations from.
731 * @param rotations Where to return the integer array of available window rotations
732 * @param count Where to return the number of members in rotations
733 * @return EINA_TRUE if available window rotations exist, EINA_FALSE otherwise
734 *
735 * @warning Support for this depends on the underlying windowing system.
736 * @since 1.9.0
737 */
738EAPI Eina_Bool ecore_evas_wm_rotation_available_rotations_get(const Ecore_Evas *ee, int **rotations, unsigned int *count);
739/**
740 * @brief Set manual rotation done mode of Ecore_Evas's window
741 *
742 * @param ee The Ecore_Evas
743 * @param set If true, the window manager will not rotate the Ecore_Evas's window until
744 * the rotation done event is received by ecore_evas_wm_rotation_manual_rotation_done.
745 * If false, the manual rotation mode is disabled.
746 *
747 * @since 1.9.0
748 */
749EAPI void ecore_evas_wm_rotation_manual_rotation_done_set(Ecore_Evas *ee, Eina_Bool set);
750/**
751 * @brief Get manual rotation done mode of Ecore_Evas's window
752 *
753 * @param ee The Ecore_Evas
754 * @return If true, the manual rotation done mode is enabled
755 *
756 * @since 1.9.0
757 */
758EAPI Eina_Bool ecore_evas_wm_rotation_manual_rotation_done_get(const Ecore_Evas *ee);
759/**
760 * @brief Set rotation finish manually
761 *
762 * @param ee The Ecore_Evas
763 *
764 * @since 1.9.0
765 */
766EAPI void ecore_evas_wm_rotation_manual_rotation_done(Ecore_Evas *ee);
767/**
687 * @brief Send message to parent ecore 768 * @brief Send message to parent ecore
688 * 769 *
689 * @param ee The Ecore_Evas to set 770 * @param ee The Ecore_Evas to set
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 37be5f8a76..43e4b8691f 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -1946,6 +1946,153 @@ ecore_evas_window_available_profiles_get(Ecore_Evas *ee, char ***profiles, unsig
1946 return EINA_FALSE; 1946 return EINA_FALSE;
1947} 1947}
1948 1948
1949EAPI Eina_Bool
1950ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee)
1951{
1952 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1953 {
1954 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1955 "ecore_evas_wm_rotation_supported_get");
1956 return EINA_FALSE;
1957 }
1958 return ee->prop.wm_rot.supported;
1959}
1960
1961EAPI void
1962ecore_evas_wm_rotation_preferred_rotation_set(Ecore_Evas *ee, int rotation)
1963{
1964 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1965 {
1966 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1967 "ecore_evas_wm_rotation_preferred_rotation_set");
1968 return;
1969 }
1970 if (rotation != -1)
1971 {
1972 if (ee->prop.wm_rot.available_rots)
1973 {
1974 Eina_Bool found = EINA_FALSE;
1975 unsigned int i;
1976 for (i = 0; i < ee->prop.wm_rot.count; i++)
1977 {
1978 if (ee->prop.wm_rot.available_rots[i] == rotation)
1979 {
1980 found = EINA_TRUE;
1981 break;
1982 }
1983 }
1984 if (!found) return;
1985 }
1986 }
1987 IFC(ee, fn_wm_rot_preferred_rotation_set) (ee, rotation);
1988 IFE;
1989}
1990
1991EAPI int
1992ecore_evas_wm_rotation_preferred_rotation_get(const Ecore_Evas *ee)
1993{
1994 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1995 {
1996 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1997 "ecore_evas_wm_rotation_preferred_rotation_get");
1998 return -1;
1999 }
2000 return ee->prop.wm_rot.preferred_rot;
2001}
2002
2003EAPI void
2004ecore_evas_wm_rotation_available_rotations_set(Ecore_Evas *ee, const int *rotations, unsigned int count)
2005{
2006 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2007 {
2008 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2009 "ecore_evas_wm_rotation_available_rotations_set");
2010 return;
2011 }
2012 IFC(ee, fn_wm_rot_available_rotations_set) (ee, rotations, count);
2013 IFE;
2014}
2015
2016EAPI Eina_Bool
2017ecore_evas_wm_rotation_available_rotations_get(const Ecore_Evas *ee, int **rotations, unsigned int *count)
2018{
2019 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2020 {
2021 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2022 "ecore_evas_wm_rotation_available_rotations_get");
2023 return EINA_FALSE;
2024 }
2025 if ((!rotations) || (!count))
2026 return EINA_FALSE;
2027
2028 if ((!ee->prop.wm_rot.available_rots) || (ee->prop.wm_rot.count == 0))
2029 return EINA_FALSE;
2030
2031 *rotations = calloc(ee->prop.wm_rot.count, sizeof(int));
2032 if (!*rotations) return EINA_FALSE;
2033
2034 memcpy(*rotations, ee->prop.wm_rot.available_rots, sizeof(int) * ee->prop.wm_rot.count);
2035 *count = ee->prop.wm_rot.count;
2036
2037 return EINA_TRUE;
2038}
2039
2040EAPI void
2041ecore_evas_wm_rotation_manual_rotation_done_set(Ecore_Evas *ee, Eina_Bool set)
2042{
2043 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2044 {
2045 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2046 "ecore_evas_wm_rotation_manual_rotation_done_set");
2047 return;
2048 }
2049
2050 if (!ee->prop.wm_rot.app_set)
2051 {
2052 return;
2053 }
2054
2055 IFC(ee, fn_wm_rot_manual_rotation_done_set) (ee, set);
2056 IFE;
2057}
2058
2059EAPI Eina_Bool
2060ecore_evas_wm_rotation_manual_rotation_done_get(const Ecore_Evas *ee)
2061{
2062 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2063 {
2064 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2065 "ecore_evas_wm_rotation_manual_rotation_done_get");
2066 return EINA_FALSE;
2067 }
2068
2069 if (!ee->prop.wm_rot.app_set)
2070 {
2071 return EINA_FALSE;
2072 }
2073
2074 return ee->prop.wm_rot.manual_mode.set;
2075}
2076
2077EAPI void
2078ecore_evas_wm_rotation_manual_rotation_done(Ecore_Evas *ee)
2079{
2080 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2081 {
2082 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2083 "ecore_evas_wm_rotation_manual_rotation_done");
2084 return;
2085 }
2086
2087 if (!ee->prop.wm_rot.app_set)
2088 {
2089 return;
2090 }
2091
2092 IFC(ee, fn_wm_rot_manual_rotation_done) (ee);
2093 IFE;
2094}
2095
1949EAPI void 2096EAPI void
1950ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) 2097ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
1951{ 2098{
@@ -2703,6 +2850,11 @@ _ecore_evas_free(Ecore_Evas *ee)
2703 ee->prop.profile.name = NULL; 2850 ee->prop.profile.name = NULL;
2704 _ecore_evas_window_available_profiles_free(ee); 2851 _ecore_evas_window_available_profiles_free(ee);
2705 ee->prop.profile.available_list = NULL; 2852 ee->prop.profile.available_list = NULL;
2853 if (ee->prop.wm_rot.available_rots) free(ee->prop.wm_rot.available_rots);
2854 ee->prop.wm_rot.available_rots = NULL;
2855 if (ee->prop.wm_rot.manual_mode.timer)
2856 ecore_timer_del(ee->prop.wm_rot.manual_mode.timer);
2857 ee->prop.wm_rot.manual_mode.timer = NULL;
2706 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); 2858 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2707 ee->prop.cursor.object = NULL; 2859 ee->prop.cursor.object = NULL;
2708 if (ee->evas) evas_free(ee->evas); 2860 if (ee->evas) evas_free(ee->evas);
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c
index 0b9e124ac5..5c4a739ba7 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -581,7 +581,15 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
581 NULL, // screen_geometry_get 581 NULL, // screen_geometry_get
582 NULL, // screen_dpi_get 582 NULL, // screen_dpi_get
583 _ecore_evas_buffer_msg_parent_send, 583 _ecore_evas_buffer_msg_parent_send,
584 _ecore_evas_buffer_msg_send 584 _ecore_evas_buffer_msg_send,
585
586 NULL, // pointer_xy_get
587 NULL, // pointer_warp
588
589 NULL, // wm_rot_preferred_rotation_set
590 NULL, // wm_rot_available_rotations_set
591 NULL, // wm_rot_manual_rotation_done_set
592 NULL // wm_rot_manual_rotation_done
585}; 593};
586 594
587static void * 595static void *
diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c
index 9aa1dba319..84c9a0f495 100644
--- a/src/lib/ecore_evas/ecore_evas_ews.c
+++ b/src/lib/ecore_evas/ecore_evas_ews.c
@@ -698,7 +698,15 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
698 _ecore_evas_ews_screen_geometry_get, 698 _ecore_evas_ews_screen_geometry_get,
699 NULL, // screen_dpi_get 699 NULL, // screen_dpi_get
700 NULL, 700 NULL,
701 NULL // msg_send 701 NULL, // msg_send
702
703 NULL, // pointer_xy_get
704 NULL, // pointer_warp
705
706 NULL, // wm_rot_preferred_rotation_set
707 NULL, // wm_rot_available_rotations_set
708 NULL, // wm_rot_manual_rotation_done_set
709 NULL // wm_rot_manual_rotation_done
702}; 710};
703 711
704void 712void
diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h
index ca7a801a13..cc514d5d8e 100644
--- a/src/lib/ecore_evas/ecore_evas_private.h
+++ b/src/lib/ecore_evas/ecore_evas_private.h
@@ -115,6 +115,11 @@ struct _Ecore_Evas_Engine_Func
115 /* 1.8 abstractions */ 115 /* 1.8 abstractions */
116 void (*fn_pointer_xy_get) (const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y); 116 void (*fn_pointer_xy_get) (const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y);
117 Eina_Bool (*fn_pointer_warp) (const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y); 117 Eina_Bool (*fn_pointer_warp) (const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y);
118
119 void (*fn_wm_rot_preferred_rotation_set) (Ecore_Evas *ee, int rot);
120 void (*fn_wm_rot_available_rotations_set) (Ecore_Evas *ee, const int *rots, unsigned int count);
121 void (*fn_wm_rot_manual_rotation_done_set) (Ecore_Evas *ee, Eina_Bool set);
122 void (*fn_wm_rot_manual_rotation_done) (Ecore_Evas *ee);
118}; 123};
119 124
120struct _Ecore_Evas_Interface 125struct _Ecore_Evas_Interface
@@ -186,6 +191,21 @@ struct _Ecore_Evas
186 int x, y; 191 int x, y;
187 } hot; 192 } hot;
188 } cursor; 193 } cursor;
194 struct {
195 Eina_Bool supported; // indicate that the underlying window system supports window manager rotation protocol
196 Eina_Bool app_set; // indicate that the ee supports window manager rotation protocol
197 Eina_Bool win_resize; // indicate that the ee will be resized by the WM
198 int angle; // rotation value which is decided by the WM
199 int w, h; // window size to rotate
200 int preferred_rot; // preferred rotation hint
201 int *available_rots; // array of avaialable rotation values
202 unsigned int count; // number of elements of available_rots
203 struct {
204 Eina_Bool set;
205 Eina_Bool wait_for_done;
206 Ecore_Timer *timer;
207 } manual_mode;
208 } wm_rot;
189 int layer; 209 int layer;
190 Ecore_Window window; 210 Ecore_Window window;
191 unsigned char avoid_damage; 211 unsigned char avoid_damage;
diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index 71b7a73859..0d042791d4 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -2677,6 +2677,19 @@ EAPI void ecore_x_e_illume_window_state_send(Ec
2677 2677
2678EAPI void ecore_x_xkb_select_group(int group); /* @since 1.7 */ 2678EAPI void ecore_x_xkb_select_group(int group); /* @since 1.7 */
2679 2679
2680EAPI void ecore_x_e_window_rotation_supported_set(Ecore_X_Window root, Eina_Bool enabled); /**< @since 1.9 */
2681EAPI Eina_Bool ecore_x_e_window_rotation_supported_get(Ecore_X_Window root); /**< @since 1.9 */
2682EAPI void ecore_x_e_window_rotation_app_set(Ecore_X_Window win, Eina_Bool set); /**< @since 1.9 */
2683EAPI Eina_Bool ecore_x_e_window_rotation_app_get(Ecore_X_Window win); /**< @since 1.9 */
2684EAPI void ecore_x_e_window_rotation_preferred_rotation_set(Ecore_X_Window win, int rot); /**< @since 1.9 */
2685EAPI Eina_Bool ecore_x_e_window_rotation_preferred_rotation_get(Ecore_X_Window win, int *rot); /**< @since 1.9 */
2686EAPI void ecore_x_e_window_rotation_available_rotations_set(Ecore_X_Window win, const int *rots, unsigned int count); /**< @since 1.9 */
2687EAPI Eina_Bool ecore_x_e_window_rotation_available_rotations_get(Ecore_X_Window win, int **rots, unsigned int *count); /**< @since 1.9 */
2688EAPI void ecore_x_e_window_rotation_change_prepare_send(Ecore_X_Window win, int rot, Eina_Bool resize, int w, int h); /**< @since 1.9 */
2689EAPI void ecore_x_e_window_rotation_change_prepare_done_send(Ecore_X_Window root, Ecore_X_Window win, int rot); /**< @since 1.9 */
2690EAPI void ecore_x_e_window_rotation_change_request_send(Ecore_X_Window win, int rot); /**< @since 1.9 */
2691EAPI void ecore_x_e_window_rotation_change_done_send(Ecore_X_Window root, Ecore_X_Window win, int rot, int w, int h); /**< @since 1.9 */
2692
2680#ifdef __cplusplus 2693#ifdef __cplusplus
2681} 2694}
2682#endif // ifdef __cplusplus 2695#endif // ifdef __cplusplus
diff --git a/src/lib/ecore_x/Ecore_X_Atoms.h b/src/lib/ecore_x/Ecore_X_Atoms.h
index 59061cf56b..6c028e6582 100644
--- a/src/lib/ecore_x/Ecore_X_Atoms.h
+++ b/src/lib/ecore_x/Ecore_X_Atoms.h
@@ -312,4 +312,14 @@ EAPI extern Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_DISCONNECT;
312 312
313/* for deiconify approve protcol */ 313/* for deiconify approve protcol */
314EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_DEICONIFY_APPROVE; 314EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_DEICONIFY_APPROVE;
315
316/* E window rotation extension */
317EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED;
318EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED;
319EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST;
320EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION;
321EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE;
322EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE;
323EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST;
324EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE;
315#endif /* _ECORE_X_ATOMS_H */ 325#endif /* _ECORE_X_ATOMS_H */
diff --git a/src/lib/ecore_x/ecore_x_atoms_decl.h b/src/lib/ecore_x/ecore_x_atoms_decl.h
index 80c555c93a..a1f7ecbb85 100644
--- a/src/lib/ecore_x/ecore_x_atoms_decl.h
+++ b/src/lib/ecore_x/ecore_x_atoms_decl.h
@@ -342,6 +342,16 @@ EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_DONE = 0;
342/* for deiconify approve protcol */ 342/* for deiconify approve protcol */
343EAPI Ecore_X_Atom ECORE_X_ATOM_E_DEICONIFY_APPROVE = 0; 343EAPI Ecore_X_Atom ECORE_X_ATOM_E_DEICONIFY_APPROVE = 0;
344 344
345/* E window rotation extension */
346EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED = 0;
347EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED = 0;
348EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST = 0;
349EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION = 0;
350EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE = 0;
351EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE = 0;
352EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST = 0;
353EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE = 0;
354
345typedef struct _Atom_Item Atom_Item; 355typedef struct _Atom_Item Atom_Item;
346 356
347struct _Atom_Item 357struct _Atom_Item
@@ -641,6 +651,15 @@ const Atom_Item atom_items[] =
641 { "_E_WINDOW_PROFILE_CHANGE_REQUEST", &ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_REQUEST }, 651 { "_E_WINDOW_PROFILE_CHANGE_REQUEST", &ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_REQUEST },
642 { "_E_WINDOW_PROFILE_CHANGE_DONE", &ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_DONE }, 652 { "_E_WINDOW_PROFILE_CHANGE_DONE", &ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_DONE },
643 653
644 { "_E_DEICONIFY_APPROVE", &ECORE_X_ATOM_E_DEICONIFY_APPROVE } 654 { "_E_DEICONIFY_APPROVE", &ECORE_X_ATOM_E_DEICONIFY_APPROVE },
655
656 { "_E_WINDOW_ROTATION_SUPPORTED", &ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED },
657 { "_E_WINDOW_ROTATION_APP_SUPPORTED", &ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED },
658 { "_E_WINDOW_ROTATION_AVAILABLE_LIST", &ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST },
659 { "_E_WINDOW_ROTATION_PREFERRED_ROTATION", &ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION },
660 { "_E_WINDOW_ROTATION_CHANGE_PREPARE", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE },
661 { "_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE },
662 { "_E_WINDOW_ROTATION_CHANGE_REQUEST", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST },
663 { "_E_WINDOW_ROTATION_CHANGE_DONE", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE }
645}; 664};
646 665
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_e.c b/src/lib/ecore_x/xcb/ecore_xcb_e.c
index b85659ed84..4249bb90fe 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_e.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_e.c
@@ -1942,3 +1942,292 @@ ecore_x_e_illume_window_state_send(Ecore_X_Window win,
1942 _ecore_x_e_illume_window_state_atom_get(state), 1942 _ecore_x_e_illume_window_state_atom_get(state),
1943 0, 0, 0, 0); 1943 0, 0, 0, 0);
1944} 1944}
1945
1946EAPI void
1947ecore_x_e_window_rotation_supported_set(Ecore_X_Window root,
1948 Eina_Bool enabled)
1949{
1950 Ecore_X_Window win;
1951
1952 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1953 CHECK_XCB_CONN;
1954
1955 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
1956
1957 if (enabled)
1958 {
1959 win = ecore_x_window_new(root, 1, 2, 3, 4);
1960 ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
1961 ECORE_X_ATOM_WINDOW, &win, 1);
1962 ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
1963 ECORE_X_ATOM_WINDOW, &win, 1);
1964 }
1965 else
1966 {
1967 int ret;
1968
1969 ret =
1970 ecore_x_window_prop_xid_get(root,
1971 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
1972 ECORE_X_ATOM_WINDOW,
1973 &win, 1);
1974 if ((ret == 1) && (win))
1975 {
1976 ecore_x_window_prop_property_del(
1977 root,
1978 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED);
1979 ecore_x_window_free(win);
1980 }
1981 }
1982}
1983
1984EAPI Eina_Bool
1985ecore_x_e_window_rotation_supported_get(Ecore_X_Window root)
1986{
1987 Ecore_X_Window win, win2;
1988 int ret;
1989
1990 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1991 CHECK_XCB_CONN;
1992
1993 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
1994
1995 ret =
1996 ecore_x_window_prop_xid_get(root,
1997 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
1998 ECORE_X_ATOM_WINDOW,
1999 &win, 1);
2000 if ((ret == 1) && (win))
2001 {
2002 ret =
2003 ecore_x_window_prop_xid_get(win,
2004 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
2005 ECORE_X_ATOM_WINDOW,
2006 &win2, 1);
2007 if ((ret == 1) && (win2 == win))
2008 return EINA_TRUE;
2009 }
2010
2011 return EINA_FALSE;
2012}
2013
2014EAPI void
2015ecore_x_e_window_rotation_app_set(Ecore_X_Window win,
2016 Eina_Bool set)
2017{
2018 unsigned int val = 0;
2019
2020 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2021
2022 if (set) val = 1;
2023
2024 ecore_x_window_prop_card32_set(win,
2025 ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED,
2026 &val, 1);
2027}
2028
2029EAPI Eina_Bool
2030ecore_x_e_window_rotation_app_get(Ecore_X_Window win)
2031{
2032 unsigned int val = 0;
2033
2034 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2035
2036 if (!ecore_x_window_prop_card32_get(win,
2037 ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED,
2038 &val, 1))
2039 return EINA_FALSE;
2040
2041 return val ? EINA_TRUE : EINA_FALSE;
2042}
2043
2044EAPI void
2045ecore_x_e_window_rotation_preferred_rotation_set(Ecore_X_Window win,
2046 int rot)
2047{
2048 unsigned int val = 0;
2049
2050 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2051
2052 if (rot != -1)
2053 {
2054 val = (unsigned int)rot;
2055 ecore_x_window_prop_card32_set(win,
2056 ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION,
2057 &val, 1);
2058 }
2059 else
2060 {
2061 ecore_x_window_prop_property_del(win,
2062 ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION);
2063 }
2064}
2065
2066EAPI Eina_Bool
2067ecore_x_e_window_rotation_preferred_rotation_get(Ecore_X_Window win,
2068 int *rot)
2069{
2070 unsigned int val = 0;
2071 int ret = 0;
2072
2073 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2074
2075 ret = ecore_x_window_prop_card32_get(win,
2076 ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION,
2077 &val, 1);
2078 if (ret == 1)
2079 {
2080 if (rot) *rot = (int)val;
2081 return EINA_TRUE;
2082 }
2083 return EINA_FALSE;
2084}
2085
2086EAPI void
2087ecore_x_e_window_rotation_available_rotations_set(Ecore_X_Window win,
2088 const int *rots,
2089 unsigned int count)
2090{
2091 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2092
2093 if (!win) return;
2094
2095 if ((rots) && (count > 0))
2096 ecore_x_window_prop_card32_set(win,
2097 ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST,
2098 (unsigned int *)rots, count);
2099 else
2100 ecore_x_window_prop_property_del(win,
2101 ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST);
2102}
2103
2104EAPI Eina_Bool
2105ecore_x_e_window_rotation_available_rotations_get(Ecore_X_Window win,
2106 int **rots,
2107 unsigned int *count)
2108{
2109 unsigned char *data = NULL;
2110 int num, i;
2111 int *val = NULL;
2112
2113 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2114 CHECK_XCB_CONN;
2115
2116 if ((!win) || (!rots) || (!count))
2117 return EINA_FALSE;
2118
2119 *rots = NULL;
2120 *count = 0;
2121
2122 if (!ecore_x_window_prop_property_get(win,
2123 ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST,
2124 XA_CARDINAL, 32, &data, &num))
2125 return EINA_FALSE;
2126
2127 *count = num;
2128
2129 if ((num >= 1) && (data))
2130 {
2131 val = calloc(num, sizeof(int));
2132 if (!val)
2133 {
2134 *counter = 0;
2135 if (data) free(data);
2136 return EINA_FALSE;
2137 }
2138 for (i = 0; i < num; i++)
2139 val[i] = ((int *)data)[i];
2140 if (data) free(data);
2141 *rots = val;
2142 return EINA_TRUE;
2143 }
2144 if (data) free(data);
2145 return EINA_FALSE;
2146}
2147
2148EAPI void
2149ecore_x_e_window_rotation_change_prepare_send(Ecore_X_Window win,
2150 int rot,
2151 Eina_Bool resize,
2152 int w,
2153 int h)
2154{
2155 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2156
2157 ecore_x_client_message32_send(win,
2158 ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE,
2159 ECORE_X_EVENT_MASK_NONE,
2160 win, rot, resize, w, h);
2161}
2162
2163EAPI void
2164ecore_x_e_window_rotation_change_prepare_done_send(Ecore_X_Window root,
2165 Ecore_X_Window win,
2166 int rot)
2167{
2168 xcb_client_message_event_t ev;
2169
2170 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2171 CHECK_XCB_CONN;
2172
2173 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
2174
2175 memset(&ev, 0, sizeof(xcb_client_message_event_t));
2176
2177 ev.response_type = XCB_CLIENT_MESSAGE;
2178 ev.format = 32;
2179 ev.window = win;
2180 ev.type = ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE;
2181 ev.data.data32[0] = win;
2182 ev.data.data32[1] = rot;
2183 ev.data.data32[2] = 0;
2184 ev.data.data32[3] = 0;
2185 ev.data.data32[4] = 0;
2186
2187 xcb_send_event(_ecore_xcb_conn, 0, root,
2188 (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
2189 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev);
2190}
2191
2192EAPI void
2193ecore_x_e_window_rotation_change_request_send(Ecore_X_Window win,
2194 int rot)
2195{
2196 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2197
2198 ecore_x_client_message32_send(win,
2199 ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST,
2200 ECORE_X_EVENT_MASK_NONE,
2201 win, rot, 0, 0, 0);
2202}
2203
2204EAPI void
2205ecore_x_e_window_rotation_change_done_send(Ecore_X_Window root,
2206 Ecore_X_Window win,
2207 int rot,
2208 int w,
2209 int h)
2210{
2211 xcb_client_message_event_t ev;
2212
2213 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2214 CHECK_XCB_CONN;
2215
2216 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
2217
2218 memset(&ev, 0, sizeof(xcb_client_message_event_t));
2219
2220 ev.response_type = XCB_CLIENT_MESSAGE;
2221 ev.format = 32;
2222 ev.window = win;
2223 ev.type = ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE;
2224 ev.data.data32[0] = win;
2225 ev.data.data32[1] = rot;
2226 ev.data.data32[2] = w;
2227 ev.data.data32[3] = h;
2228 ev.data.data32[4] = 0;
2229
2230 xcb_send_event(_ecore_xcb_conn, 0, root,
2231 (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
2232 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev);
2233}
diff --git a/src/lib/ecore_x/xlib/ecore_x_e.c b/src/lib/ecore_x/xlib/ecore_x_e.c
index 42380c0c09..f11da7d121 100644
--- a/src/lib/ecore_x/xlib/ecore_x_e.c
+++ b/src/lib/ecore_x/xlib/ecore_x_e.c
@@ -2027,3 +2027,281 @@ ecore_x_e_illume_window_state_send(Ecore_X_Window win,
2027 _ecore_x_e_illume_window_state_atom_get(state), 2027 _ecore_x_e_illume_window_state_atom_get(state),
2028 0, 0, 0, 0); 2028 0, 0, 0, 0);
2029} 2029}
2030
2031EAPI void
2032ecore_x_e_window_rotation_supported_set(Ecore_X_Window root,
2033 Eina_Bool enabled)
2034{
2035 Ecore_X_Window win;
2036
2037 if (!root)
2038 root = DefaultRootWindow(_ecore_x_disp);
2039
2040 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2041 if (enabled)
2042 {
2043 win = ecore_x_window_new(root, 1, 2, 3, 4);
2044 ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
2045 ECORE_X_ATOM_WINDOW, &win, 1);
2046 ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
2047 ECORE_X_ATOM_WINDOW, &win, 1);
2048 }
2049 else
2050 {
2051 int ret;
2052
2053 ret =
2054 ecore_x_window_prop_xid_get(root,
2055 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
2056 ECORE_X_ATOM_WINDOW,
2057 &win, 1);
2058 if ((ret == 1) && (win))
2059 {
2060 ecore_x_window_prop_property_del(
2061 root,
2062 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED);
2063 ecore_x_window_free(win);
2064 }
2065 }
2066}
2067
2068EAPI Eina_Bool
2069ecore_x_e_window_rotation_supported_get(Ecore_X_Window root)
2070{
2071 Ecore_X_Window win, win2;
2072 int ret;
2073
2074 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2075 if (!root)
2076 root = DefaultRootWindow(_ecore_x_disp);
2077
2078 ret =
2079 ecore_x_window_prop_xid_get(root,
2080 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
2081 ECORE_X_ATOM_WINDOW,
2082 &win, 1);
2083 if ((ret == 1) && (win))
2084 {
2085 ret =
2086 ecore_x_window_prop_xid_get(win,
2087 ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED,
2088 ECORE_X_ATOM_WINDOW,
2089 &win2, 1);
2090 if ((ret == 1) && (win2 == win))
2091 return EINA_TRUE;
2092 }
2093
2094 return EINA_FALSE;
2095}
2096
2097EAPI void
2098ecore_x_e_window_rotation_app_set(Ecore_X_Window win,
2099 Eina_Bool set)
2100{
2101 unsigned int val = 0;
2102
2103 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2104
2105 if (set) val = 1;
2106
2107 ecore_x_window_prop_card32_set(win,
2108 ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED,
2109 &val, 1);
2110}
2111
2112EAPI Eina_Bool
2113ecore_x_e_window_rotation_app_get(Ecore_X_Window win)
2114{
2115 unsigned int val = 0;
2116
2117 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2118 if (!ecore_x_window_prop_card32_get(win,
2119 ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED,
2120 &val, 1))
2121 return EINA_FALSE;
2122
2123 return val ? EINA_TRUE : EINA_FALSE;
2124}
2125
2126EAPI void
2127ecore_x_e_window_rotation_preferred_rotation_set(Ecore_X_Window win,
2128 int rot)
2129{
2130 unsigned int val = 0;
2131
2132 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2133
2134 if (rot != -1)
2135 {
2136 val = (unsigned int)rot;
2137 ecore_x_window_prop_card32_set(win,
2138 ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION,
2139 &val, 1);
2140 }
2141 else
2142 {
2143 ecore_x_window_prop_property_del(win,
2144 ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION);
2145 }
2146}
2147
2148EAPI Eina_Bool
2149ecore_x_e_window_rotation_preferred_rotation_get(Ecore_X_Window win,
2150 int *rot)
2151{
2152 unsigned int val = 0;
2153 int ret = 0;
2154
2155 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2156
2157 ret = ecore_x_window_prop_card32_get(win,
2158 ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION,
2159 &val, 1);
2160 if (ret == 1)
2161 {
2162 if (rot) *rot = (int)val;
2163 return EINA_TRUE;
2164 }
2165 return EINA_FALSE;
2166}
2167
2168EAPI void
2169ecore_x_e_window_rotation_available_rotations_set(Ecore_X_Window win,
2170 const int *rots,
2171 unsigned int count)
2172{
2173 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2174
2175 if (!win) return;
2176
2177 if ((rots) && (count > 0))
2178 ecore_x_window_prop_card32_set(win,
2179 ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST,
2180 (unsigned int *)rots, count);
2181 else
2182 ecore_x_window_prop_property_del(win,
2183 ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST);
2184}
2185
2186EAPI Eina_Bool
2187ecore_x_e_window_rotation_available_rotations_get(Ecore_X_Window win,
2188 int **rots,
2189 unsigned int *count)
2190{
2191 unsigned char *data = NULL;
2192 int num, i;
2193 int *val = NULL;
2194
2195 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2196
2197 if ((!win) || (!rots) || (!count))
2198 return EINA_FALSE;
2199
2200 *rots = NULL;
2201 *count = 0;
2202
2203 if (!ecore_x_window_prop_property_get(win,
2204 ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST,
2205 XA_CARDINAL, 32, &data, &num))
2206 return EINA_FALSE;
2207
2208 *count = num;
2209
2210 if ((num >= 1) && (data))
2211 {
2212 val = calloc(num, sizeof(int));
2213 if (!val)
2214 {
2215 if (data) XFree(data);
2216 return EINA_FALSE;
2217 }
2218 for (i = 0; i < num; i++)
2219 val[i] = ((int *)data)[i];
2220 if (data) XFree(data);
2221 *rots = val;
2222 return EINA_TRUE;
2223 }
2224 if (data) XFree(data);
2225 return EINA_FALSE;
2226}
2227
2228EAPI void
2229ecore_x_e_window_rotation_change_prepare_send(Ecore_X_Window win,
2230 int rot,
2231 Eina_Bool resize,
2232 int w,
2233 int h)
2234{
2235 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2236 ecore_x_client_message32_send
2237 (win, ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE,
2238 ECORE_X_EVENT_MASK_NONE,
2239 win, rot, resize, w, h);
2240}
2241
2242EAPI void
2243ecore_x_e_window_rotation_change_prepare_done_send(Ecore_X_Window root,
2244 Ecore_X_Window win,
2245 int rot)
2246{
2247 XEvent xev;
2248
2249 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2250 if (!root)
2251 root = DefaultRootWindow(_ecore_x_disp);
2252
2253 xev.xclient.type = ClientMessage;
2254 xev.xclient.display = _ecore_x_disp;
2255 xev.xclient.window = win;
2256 xev.xclient.message_type = ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE;
2257 xev.xclient.format = 32;
2258 xev.xclient.data.l[0] = win;
2259 xev.xclient.data.l[1] = rot;
2260 xev.xclient.data.l[2] = 0;
2261 xev.xclient.data.l[3] = 0;
2262 xev.xclient.data.l[4] = 0;
2263
2264 XSendEvent(_ecore_x_disp, root, False,
2265 SubstructureRedirectMask | SubstructureNotifyMask,
2266 &xev);
2267}
2268
2269EAPI void
2270ecore_x_e_window_rotation_change_request_send(Ecore_X_Window win,
2271 int rot)
2272{
2273 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2274 ecore_x_client_message32_send
2275 (win, ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST,
2276 ECORE_X_EVENT_MASK_NONE,
2277 win, rot, 0, 0, 0);
2278}
2279
2280EAPI void
2281ecore_x_e_window_rotation_change_done_send(Ecore_X_Window root,
2282 Ecore_X_Window win,
2283 int rot,
2284 int w,
2285 int h)
2286{
2287 XEvent xev;
2288
2289 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2290 if (!root)
2291 root = DefaultRootWindow(_ecore_x_disp);
2292
2293 xev.xclient.type = ClientMessage;
2294 xev.xclient.display = _ecore_x_disp;
2295 xev.xclient.window = win;
2296 xev.xclient.message_type = ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE;
2297 xev.xclient.format = 32;
2298 xev.xclient.data.l[0] = win;
2299 xev.xclient.data.l[1] = rot;
2300 xev.xclient.data.l[2] = w;
2301 xev.xclient.data.l[3] = h;
2302 xev.xclient.data.l[4] = 0;
2303
2304 XSendEvent(_ecore_x_disp, root, False,
2305 SubstructureRedirectMask | SubstructureNotifyMask,
2306 &xev);
2307}
diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
index 4079c11791..d54737eb1a 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -473,7 +473,15 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
473 NULL, 473 NULL,
474 NULL, // screen_dpi_get 474 NULL, // screen_dpi_get
475 NULL, 475 NULL,
476 NULL // msg_send 476 NULL, // msg_send
477
478 NULL, // pointer_xy_get
479 NULL, // pointer_warp
480
481 NULL, // wm_rot_preferred_rotation_set
482 NULL, // wm_rot_available_rotations_set
483 NULL, // wm_rot_manual_rotation_done_set
484 NULL // wm_rot_manual_rotation_done
477 }; 485 };
478 486
479EAPI Ecore_Evas * 487EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
index be62c795f5..ec6afa691d 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -96,7 +96,15 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func =
96 NULL, //void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h); 96 NULL, //void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
97 NULL, //void (*fn_screen_dpi_get) (const Ecore_Evas *ee, int *xdpi, int *ydpi); 97 NULL, //void (*fn_screen_dpi_get) (const Ecore_Evas *ee, int *xdpi, int *ydpi);
98 NULL, //void (*fn_msg_parent_send) (Ecore_Evas *ee, int maj, int min, void *data, int size); 98 NULL, //void (*fn_msg_parent_send) (Ecore_Evas *ee, int maj, int min, void *data, int size);
99 NULL //void (*fn_msg_send) (Ecore_Evas *ee, int maj, int min, void *data, int size); 99 NULL, //void (*fn_msg_send) (Ecore_Evas *ee, int maj, int min, void *data, int size);
100
101 NULL, // pointer_xy_get
102 NULL, // pointer_warp
103
104 NULL, // wm_rot_preferred_rotation_set
105 NULL, // wm_rot_available_rotations_set
106 NULL, // wm_rot_manual_rotation_done_set
107 NULL // wm_rot_manual_rotation_done
100}; 108};
101 109
102EAPI Ecore_Evas * 110EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
index 9e08555783..221a7de639 100644
--- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
+++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
@@ -877,7 +877,12 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
877 877
878 /* 1.8 abstractions */ 878 /* 1.8 abstractions */
879 NULL, // pointer_xy_get 879 NULL, // pointer_xy_get
880 NULL // pointer_warp 880 NULL, // pointer_warp
881
882 NULL, // wm_rot_preferred_rotation_set
883 NULL, // wm_rot_available_rotations_set
884 NULL, // wm_rot_manual_rotation_done_set
885 NULL // wm_rot_manual_rotation_done
881}; 886};
882 887
883static Eina_Bool 888static Eina_Bool
@@ -1997,7 +2002,12 @@ static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func =
1997 2002
1998 /* 1.8 abstractions */ 2003 /* 1.8 abstractions */
1999 NULL, // pointer_xy_get 2004 NULL, // pointer_xy_get
2000 NULL // pointer_warp 2005 NULL, // pointer_warp
2006
2007 NULL, // wm_rot_preferred_rotation_set
2008 NULL, // wm_rot_available_rotations_set
2009 NULL, // wm_rot_manual_rotation_done_set
2010 NULL // wm_rot_manual_rotation_done
2001}; 2011};
2002 2012
2003EAPI Ecore_Evas * 2013EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
index 3f075367e5..9d999e228c 100644
--- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
+++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
@@ -564,7 +564,15 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
564 NULL, // screen_geometry_get 564 NULL, // screen_geometry_get
565 NULL, // screen_dpi_get 565 NULL, // screen_dpi_get
566 NULL, 566 NULL,
567 NULL // msg_send 567 NULL, // msg_send
568
569 NULL, // pointer_xy_get
570 NULL, // pointer_warp
571
572 NULL, // wm_rot_preferred_rotation_set
573 NULL, // wm_rot_available_rotations_set
574 NULL, // wm_rot_manual_rotation_done_set
575 NULL // wm_rot_manual_rotation_done
568 }; 576 };
569 577
570EAPI Ecore_Evas * 578EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
index a0fe244bd7..bd09d14565 100644
--- a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
+++ b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
@@ -407,7 +407,15 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
407 _ecore_evas_screen_geometry_get, // screen_geometry_get 407 _ecore_evas_screen_geometry_get, // screen_geometry_get
408 NULL, // screen_dpi_get 408 NULL, // screen_dpi_get
409 NULL, 409 NULL,
410 NULL //msg_send 410 NULL, //msg_send
411
412 NULL, // pointer_xy_get
413 NULL, // pointer_warp
414
415 NULL, // wm_rot_preferred_rotation_set
416 NULL, // wm_rot_available_rotations_set
417 NULL, // wm_rot_manual_rotation_done_set
418 NULL // wm_rot_manual_rotation_done
411}; 419};
412 420
413EAPI Ecore_Evas * 421EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
index f8f4827be7..ede7872317 100644
--- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
+++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
@@ -447,7 +447,15 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
447 NULL, // screen_geometry_get 447 NULL, // screen_geometry_get
448 NULL, // screen_dpi_get 448 NULL, // screen_dpi_get
449 NULL, 449 NULL,
450 NULL // msg_send 450 NULL, // msg_send
451
452 NULL, // pointer_xy_get
453 NULL, // pointer_warp
454
455 NULL, // wm_rot_preferred_rotation_set
456 NULL, // wm_rot_available_rotations_set
457 NULL, // wm_rot_manual_rotation_done_set
458 NULL // wm_rot_manual_rotation_done
451}; 459};
452 460
453static Ecore_Evas* 461static Ecore_Evas*
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
index bb9213c9ca..eaaa16b9ca 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
@@ -79,7 +79,12 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
79 NULL, // msg_send 79 NULL, // msg_send
80 80
81 _ecore_evas_wl_common_pointer_xy_get, 81 _ecore_evas_wl_common_pointer_xy_get,
82 NULL // pointer warp 82 NULL, // pointer warp
83
84 NULL, // wm_rot_preferred_rotation_set
85 NULL, // wm_rot_available_rotations_set
86 NULL, // wm_rot_manual_rotation_done_set
87 NULL // wm_rot_manual_rotation_done
83}; 88};
84 89
85/* external variables */ 90/* external variables */
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
index cdafd6695c..c873acef78 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
@@ -79,7 +79,12 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
79 NULL, // func msg send 79 NULL, // func msg send
80 80
81 _ecore_evas_wl_common_pointer_xy_get, 81 _ecore_evas_wl_common_pointer_xy_get,
82 NULL // pointer_warp 82 NULL, // pointer_warp
83
84 NULL, // wm_rot_preferred_rotation_set
85 NULL, // wm_rot_available_rotations_set
86 NULL, // wm_rot_manual_rotation_done_set
87 NULL // wm_rot_manual_rotation_done
83}; 88};
84 89
85/* external variables */ 90/* external variables */
diff --git a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
index 4f73a2ba80..bbcfae228b 100644
--- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
+++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
@@ -1133,7 +1133,15 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
1133 NULL, // screen_geometry_get 1133 NULL, // screen_geometry_get
1134 _ecore_evas_win32_screen_dpi_get, 1134 _ecore_evas_win32_screen_dpi_get,
1135 NULL, 1135 NULL,
1136 NULL // msg_send 1136 NULL, // msg_send
1137
1138 NULL, // pointer_xy_get
1139 NULL, // pointer_warp
1140
1141 NULL, // wm_rot_preferred_rotation_set
1142 NULL, // wm_rot_available_rotations_set
1143 NULL, // wm_rot_manual_rotation_done_set
1144 NULL // wm_rot_manual_rotation_done
1137}; 1145};
1138 1146
1139#endif /* BUILD_ECORE_EVAS_WIN32 */ 1147#endif /* BUILD_ECORE_EVAS_WIN32 */
diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index 0aa50f02d2..2a33fc8265 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -88,6 +88,14 @@ struct _Ecore_Evas_Engine_Data_X11 {
88 unsigned char change : 1; // need to send change event to the WM 88 unsigned char change : 1; // need to send change event to the WM
89 unsigned char done : 1; // need to send change done event to the WM 89 unsigned char done : 1; // need to send change done event to the WM
90 } profile; 90 } profile;
91 struct {
92 unsigned char supported: 1;
93 unsigned char prepare : 1;
94 unsigned char request : 1;
95 unsigned char done : 1;
96 unsigned char configure_coming : 1;
97 Ecore_Job *manual_mode_job;
98 } wm_rot;
91 Ecore_X_Window win_shaped_input; 99 Ecore_X_Window win_shaped_input;
92 struct 100 struct
93 { 101 {
@@ -107,6 +115,9 @@ static Ecore_Evas_Interface_Software_X11 *_ecore_evas_x_interface_software_x11_n
107#ifdef BUILD_ECORE_EVAS_OPENGL_X11 115#ifdef BUILD_ECORE_EVAS_OPENGL_X11
108static Ecore_Evas_Interface_Gl_X11 *_ecore_evas_x_interface_gl_x11_new(void); 116static Ecore_Evas_Interface_Gl_X11 *_ecore_evas_x_interface_gl_x11_new(void);
109#endif 117#endif
118static void _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize);
119static Eina_Bool _ecore_evas_x_wm_rot_manual_rotation_done_timeout(void *data);
120static void _ecore_evas_x_wm_rot_manual_rotation_done_timeout_update(Ecore_Evas *ee);
110 121
111static void _resize_shape_do(Ecore_Evas *); 122static void _resize_shape_do(Ecore_Evas *);
112static void _shaped_do(Ecore_Evas *, int); 123static void _shaped_do(Ecore_Evas *, int);
@@ -244,6 +255,17 @@ _ecore_evas_x_sync_clear(Ecore_Evas *ee)
244} 255}
245 256
246static void 257static void
258_ecore_evas_x_wm_rotation_protocol_set(Ecore_Evas *ee)
259{
260 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
261
262 if (ecore_x_e_window_rotation_supported_get(edata->win_root))
263 ee->prop.wm_rot.supported = 1;
264 else
265 ee->prop.wm_rot.supported = 0;
266}
267
268static void
247_ecore_evas_x_window_profile_protocol_set(Ecore_Evas *ee) 269_ecore_evas_x_window_profile_protocol_set(Ecore_Evas *ee)
248{ 270{
249 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data; 271 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
@@ -304,6 +326,21 @@ _ecore_evas_x_window_profile_set(Ecore_Evas *ee)
304 } 326 }
305} 327}
306 328
329static void
330_ecore_evas_x_wm_rot_manual_rotation_done_job(void *data)
331{
332 Ecore_Evas *ee = (Ecore_Evas *)data;
333 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
334
335 edata->wm_rot.manual_mode_job = NULL;
336 ee->prop.wm_rot.manual_mode.wait_for_done = EINA_FALSE;
337
338 ecore_x_e_window_rotation_change_done_send
339 (edata->win_root, ee->prop.window, ee->rotation, ee->w, ee->h);
340
341 edata->wm_rot.done = 0;
342}
343
307# ifdef BUILD_ECORE_EVAS_OPENGL_X11 344# ifdef BUILD_ECORE_EVAS_OPENGL_X11
308static Ecore_X_Window 345static Ecore_X_Window
309_ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, int w, int h, Eina_Bool override, int argb, const int *opt) 346_ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, int w, int h, Eina_Bool override, int argb, const int *opt)
@@ -1034,6 +1071,63 @@ _ecore_evas_x_event_client_message(void *data EINA_UNUSED, int type EINA_UNUSED,
1034 e->win, 1, 1071 e->win, 1,
1035 0, 0, 0); 1072 0, 0, 0);
1036 } 1073 }
1074 else if (e->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE)
1075 {
1076 ee = ecore_event_window_match(e->data.l[0]);
1077 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1078 edata = ee->engine.data;
1079 if (e->data.l[0] != (long)ee->prop.window)
1080 return ECORE_CALLBACK_PASS_ON;
1081 if (ee->prop.wm_rot.supported)
1082 {
1083 if (ee->prop.wm_rot.app_set)
1084 {
1085 ee->prop.wm_rot.angle = (int)e->data.l[1];
1086 ee->prop.wm_rot.win_resize = (int)e->data.l[2];
1087 ee->prop.wm_rot.w = (int)e->data.l[3];
1088 ee->prop.wm_rot.h = (int)e->data.l[4];
1089 if (ee->prop.wm_rot.win_resize)
1090 edata->wm_rot.configure_coming = 1;
1091 edata->wm_rot.prepare = 1;
1092 edata->wm_rot.request = 0;
1093 edata->wm_rot.done = 0;
1094 }
1095 }
1096 }
1097 else if (e->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
1098 {
1099 ee = ecore_event_window_match(e->data.l[0]);
1100 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1101 edata = ee->engine.data;
1102 if (e->data.l[0] != (long)ee->prop.window)
1103 return ECORE_CALLBACK_PASS_ON;
1104 if (ee->prop.wm_rot.supported)
1105 {
1106 if (ee->prop.wm_rot.app_set)
1107 {
1108 edata->wm_rot.prepare = 0;
1109 edata->wm_rot.request = 1;
1110 edata->wm_rot.done = 0;
1111 if (ee->prop.wm_rot.win_resize)
1112 {
1113 if ((ee->w == ee->prop.wm_rot.w) &&
1114 (ee->h == ee->prop.wm_rot.h))
1115 {
1116 edata->wm_rot.configure_coming = 0;
1117 }
1118 }
1119 if (!edata->wm_rot.configure_coming)
1120 {
1121 if (ee->prop.wm_rot.manual_mode.set)
1122 {
1123 ee->prop.wm_rot.manual_mode.wait_for_done = EINA_TRUE;
1124 _ecore_evas_x_wm_rot_manual_rotation_done_timeout_update(ee);
1125 }
1126 _ecore_evas_x_rotation_set(ee, ee->prop.wm_rot.angle, 1);
1127 }
1128 }
1129 }
1130 }
1037 return ECORE_CALLBACK_PASS_ON; 1131 return ECORE_CALLBACK_PASS_ON;
1038} 1132}
1039 1133
@@ -1403,6 +1497,35 @@ _ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSE
1403 ee->expecting_resize.h = 0; 1497 ee->expecting_resize.h = 0;
1404 } 1498 }
1405 if (ee->func.fn_resize) ee->func.fn_resize(ee); 1499 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1500
1501 if (ee->prop.wm_rot.supported)
1502 {
1503 if (edata->wm_rot.prepare)
1504 {
1505 if ((ee->prop.wm_rot.w == e->w) &&
1506 (ee->prop.wm_rot.h == e->h))
1507 {
1508 edata->wm_rot.configure_coming = 0;
1509 }
1510 }
1511 else if (edata->wm_rot.request)
1512 {
1513 if ((edata->wm_rot.configure_coming) &&
1514 (ee->prop.wm_rot.w == e->w) &&
1515 (ee->prop.wm_rot.h == e->h))
1516 {
1517 edata->wm_rot.configure_coming = 0;
1518 if (ee->prop.wm_rot.manual_mode.set)
1519 {
1520 ee->prop.wm_rot.manual_mode.wait_for_done = EINA_TRUE;
1521 _ecore_evas_x_wm_rot_manual_rotation_done_timeout_update(ee);
1522 }
1523 _ecore_evas_x_rotation_set(ee,
1524 ee->prop.wm_rot.angle,
1525 EINA_TRUE);
1526 }
1527 }
1528 }
1406 } 1529 }
1407 return ECORE_CALLBACK_PASS_ON; 1530 return ECORE_CALLBACK_PASS_ON;
1408} 1531}
@@ -1714,6 +1837,11 @@ _ecore_evas_x_free(Ecore_Evas *ee)
1714 ecore_x_pixmap_free(edata->pixmap.back); 1837 ecore_x_pixmap_free(edata->pixmap.back);
1715 if (edata->pixmap.front) 1838 if (edata->pixmap.front)
1716 ecore_x_pixmap_free(edata->pixmap.front); 1839 ecore_x_pixmap_free(edata->pixmap.front);
1840 if (edata->wm_rot.manual_mode_job)
1841 {
1842 ecore_job_del(edata->wm_rot.manual_mode_job);
1843 edata->wm_rot.manual_mode_job = NULL;
1844 }
1717 1845
1718 _ecore_evas_x_group_leader_unset(ee); 1846 _ecore_evas_x_group_leader_unset(ee);
1719 if (edata->sync_counter) 1847 if (edata->sync_counter)
@@ -2060,38 +2188,41 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
2060 } 2188 }
2061} 2189}
2062 2190
2063#define _USE_WIN_ROT_EFFECT 1 2191static Eina_Bool
2064 2192_ecore_evas_x_wm_rotation_check(Ecore_Evas *ee)
2065#if _USE_WIN_ROT_EFFECT
2066static void _ecore_evas_x_flush_pre(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED);
2067
2068typedef struct _Ecore_Evas_X_Rotation_Effect Ecore_Evas_X_Rotation_Effect;
2069struct _Ecore_Evas_X_Rotation_Effect
2070{
2071 Eina_Bool wait_for_comp_reply;
2072};
2073
2074static Ecore_Evas_X_Rotation_Effect _rot_effect =
2075{
2076 EINA_FALSE
2077};
2078
2079static void
2080_ecore_evas_x_rotation_effect_setup(void)
2081{ 2193{
2082 _rot_effect.wait_for_comp_reply = EINA_TRUE; 2194 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
2195 if (ee->prop.wm_rot.supported)
2196 {
2197 if (ee->prop.wm_rot.app_set)
2198 {
2199 if (edata->wm_rot.request)
2200 {
2201 if (ee->prop.wm_rot.win_resize)
2202 {
2203 if (!((ee->w == ee->prop.wm_rot.w) &&
2204 (ee->h == ee->prop.wm_rot.h)))
2205 {
2206 return EINA_FALSE;
2207 }
2208 else
2209 edata->wm_rot.configure_coming = 0;
2210 }
2211 }
2212 }
2213 }
2214 return EINA_TRUE;
2083} 2215}
2084#endif /* end of _USE_WIN_ROT_EFFECT */
2085 2216
2086static void 2217static void
2087_rotation_do(Ecore_Evas *ee, int rotation, int resize) 2218_rotation_do(Ecore_Evas *ee, int rotation, int resize)
2088{ 2219{
2089#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 2220#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2090#if _USE_WIN_ROT_EFFECT 2221 if (ee->prop.wm_rot.supported)
2091 int angles[2]; 2222 {
2092 angles[0] = rotation; 2223 if (!_ecore_evas_x_wm_rotation_check(ee)) return;
2093 angles[1] = ee->rotation; 2224 if (!resize) resize = 1;
2094#endif /* end of _USE_WIN_ROT_EFFECT */ 2225 }
2095 Evas_Engine_Info_Software_X11 *einfo; 2226 Evas_Engine_Info_Software_X11 *einfo;
2096 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data; 2227 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
2097 2228
@@ -2100,25 +2231,23 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
2100 einfo->info.rotation = rotation; 2231 einfo->info.rotation = rotation;
2101 _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 2232 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
2102 (Evas_Engine_Info *)einfo); 2233 (Evas_Engine_Info *)einfo);
2103# if _USE_WIN_ROT_EFFECT 2234 if (ee->prop.wm_rot.supported)
2104 ecore_x_window_prop_property_set(ee->prop.window,
2105 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
2106 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
2107
2108 if ((ee->visible) &&
2109 ((ecore_x_e_comp_sync_supported_get(edata->win_root)) &&
2110 (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)) &&
2111 (edata->sync_counter) &&
2112 (edata->sync_val > 0))
2113 { 2235 {
2114 _ecore_evas_x_rotation_effect_setup(); 2236 if (ee->prop.wm_rot.app_set)
2115 _ecore_evas_x_flush_pre(ee, NULL, NULL); 2237 {
2238 if (edata->wm_rot.request)
2239 {
2240 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
2241 edata->wm_rot.request = 0;
2242 edata->wm_rot.done = 1;
2243 }
2244 }
2116 } 2245 }
2117# else 2246
2247 int angles[2] = { rotation, rotation };
2118 ecore_x_window_prop_property_set(ee->prop.window, 2248 ecore_x_window_prop_property_set(ee->prop.window,
2119 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, 2249 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
2120 ECORE_X_ATOM_CARDINAL, 32, &rotation, 1); 2250 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
2121# endif
2122#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ 2251#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
2123} 2252}
2124 2253
@@ -2127,13 +2256,36 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
2127{ 2256{
2128 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data; 2257 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
2129 2258
2130 if (ee->rotation == rotation) return; 2259 if (ee->rotation == rotation)
2260 {
2261 if (ee->prop.wm_rot.supported)
2262 {
2263 if (edata->wm_rot.request)
2264 {
2265 if (ee->prop.wm_rot.manual_mode.set)
2266 {
2267 ee->prop.wm_rot.manual_mode.wait_for_done = EINA_FALSE;
2268 if (ee->prop.wm_rot.manual_mode.timer)
2269 ecore_timer_del(ee->prop.wm_rot.manual_mode.timer);
2270 ee->prop.wm_rot.manual_mode.timer = NULL;
2271 }
2272 /* send rotation done message to wm, even if window is already rotated.
2273 * that's why wm must be wait for comming rotation done message
2274 * after sending rotation request.
2275 */
2276 ecore_x_e_window_rotation_change_done_send
2277 (edata->win_root, ee->prop.window, ee->rotation, ee->w, ee->h);
2278 edata->wm_rot.request = 0;
2279 }
2280 }
2281 return;
2282 }
2131 2283
2132#if _USE_WIN_ROT_EFFECT 2284 if (ee->prop.wm_rot.supported)
2133 int angles[2]; 2285 {
2134 angles[0] = rotation; 2286 if (!_ecore_evas_x_wm_rotation_check(ee)) return;
2135 angles[1] = ee->rotation; 2287 if (!resize) resize = 1;
2136#endif /* end of _USE_WIN_ROT_EFFECT */ 2288 }
2137 2289
2138 if (!strcmp(ee->driver, "opengl_x11")) 2290 if (!strcmp(ee->driver, "opengl_x11"))
2139 { 2291 {
@@ -2145,15 +2297,23 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
2145 einfo->info.rotation = rotation; 2297 einfo->info.rotation = rotation;
2146 _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 2298 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
2147 (Evas_Engine_Info *)einfo); 2299 (Evas_Engine_Info *)einfo);
2148# if _USE_WIN_ROT_EFFECT 2300 if (ee->prop.wm_rot.supported)
2301 {
2302 if (ee->prop.wm_rot.app_set)
2303 {
2304 if (edata->wm_rot.request)
2305 {
2306 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
2307 edata->wm_rot.request = 0;
2308 edata->wm_rot.done = 1;
2309 }
2310 }
2311 }
2312
2313 int angles[2] = { rotation, rotation };
2149 ecore_x_window_prop_property_set(ee->prop.window, 2314 ecore_x_window_prop_property_set(ee->prop.window,
2150 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, 2315 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
2151 ECORE_X_ATOM_CARDINAL, 32, &angles, 2); 2316 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
2152# else
2153 ecore_x_window_prop_property_set(ee->prop.window,
2154 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
2155 ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
2156# endif
2157#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ 2317#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
2158 } 2318 }
2159 else if (!strcmp(ee->driver, "software_x11")) 2319 else if (!strcmp(ee->driver, "software_x11"))
@@ -2168,18 +2328,6 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
2168 _rotation_do(ee, rotation, resize); 2328 _rotation_do(ee, rotation, resize);
2169 return; 2329 return;
2170 } 2330 }
2171
2172#if _USE_WIN_ROT_EFFECT
2173 if ((ee->visible) &&
2174 ((ecore_x_e_comp_sync_supported_get(edata->win_root)) &&
2175 (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)) &&
2176 (edata->sync_counter) &&
2177 (edata->sync_val > 0))
2178 {
2179 _ecore_evas_x_rotation_effect_setup();
2180 _ecore_evas_x_flush_pre(ee, NULL, NULL);
2181 }
2182#endif /* end of _USE_WIN_ROT_EFFECT */
2183} 2331}
2184 2332
2185static void 2333static void
@@ -2330,6 +2478,7 @@ _alpha_do(Ecore_Evas *ee, int alpha)
2330 ecore_x_window_defaults_set(ee->prop.window); 2478 ecore_x_window_defaults_set(ee->prop.window);
2331 _ecore_evas_x_protocols_set(ee); 2479 _ecore_evas_x_protocols_set(ee);
2332 _ecore_evas_x_window_profile_protocol_set(ee); 2480 _ecore_evas_x_window_profile_protocol_set(ee);
2481 _ecore_evas_x_wm_rotation_protocol_set(ee);
2333 _ecore_evas_x_sync_set(ee); 2482 _ecore_evas_x_sync_set(ee);
2334 _ecore_evas_x_size_pos_hints_update(ee); 2483 _ecore_evas_x_size_pos_hints_update(ee);
2335#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ 2484#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
@@ -2481,6 +2630,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
2481 ecore_x_window_defaults_set(ee->prop.window); 2630 ecore_x_window_defaults_set(ee->prop.window);
2482 _ecore_evas_x_protocols_set(ee); 2631 _ecore_evas_x_protocols_set(ee);
2483 _ecore_evas_x_window_profile_protocol_set(ee); 2632 _ecore_evas_x_window_profile_protocol_set(ee);
2633 _ecore_evas_x_wm_rotation_protocol_set(ee);
2484 _ecore_evas_x_sync_set(ee); 2634 _ecore_evas_x_sync_set(ee);
2485 _ecore_evas_x_size_pos_hints_update(ee); 2635 _ecore_evas_x_size_pos_hints_update(ee);
2486#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ 2636#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
@@ -3156,6 +3306,103 @@ _ecore_evas_x_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y)
3156 return ecore_x_pointer_warp(ee->prop.window, x, y); 3306 return ecore_x_pointer_warp(ee->prop.window, x, y);
3157} 3307}
3158 3308
3309static void
3310_ecore_evas_x_wm_rot_preferred_rotation_set(Ecore_Evas *ee, int rot)
3311{
3312 if (ee->prop.wm_rot.supported)
3313 {
3314 if (!ee->prop.wm_rot.app_set)
3315 {
3316 ecore_x_e_window_rotation_app_set(ee->prop.window, EINA_TRUE);
3317 ee->prop.wm_rot.app_set = EINA_TRUE;
3318 }
3319 ecore_x_e_window_rotation_preferred_rotation_set(ee->prop.window, rot);
3320 ee->prop.wm_rot.preferred_rot = rot;
3321 }
3322}
3323
3324static void
3325_ecore_evas_x_wm_rot_available_rotations_set(Ecore_Evas *ee, const int *rots, unsigned int count)
3326{
3327 if (ee->prop.wm_rot.supported)
3328 {
3329 if (!ee->prop.wm_rot.app_set)
3330 {
3331 ecore_x_e_window_rotation_app_set(ee->prop.window, EINA_TRUE);
3332 ee->prop.wm_rot.app_set = EINA_TRUE;
3333 }
3334
3335 if (ee->prop.wm_rot.available_rots)
3336 {
3337 free(ee->prop.wm_rot.available_rots);
3338 ee->prop.wm_rot.available_rots = NULL;
3339 }
3340
3341 ee->prop.wm_rot.count = 0;
3342
3343 if (count > 0)
3344 {
3345 ee->prop.wm_rot.available_rots = calloc(count, sizeof(int));
3346 if (!ee->prop.wm_rot.available_rots) return;
3347
3348 memcpy(ee->prop.wm_rot.available_rots, rots, sizeof(int) * count);
3349 }
3350
3351 ee->prop.wm_rot.count = count;
3352
3353 ecore_x_e_window_rotation_available_rotations_set(ee->prop.window, rots, count);
3354 }
3355}
3356
3357static void
3358_ecore_evas_x_wm_rot_manual_rotation_done_set(Ecore_Evas *ee, Eina_Bool set)
3359{
3360 ee->prop.wm_rot.manual_mode.set = set;
3361}
3362
3363static void
3364_ecore_evas_x_wm_rot_manual_rotation_done(Ecore_Evas *ee)
3365{
3366 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
3367
3368 if ((ee->prop.wm_rot.supported) &&
3369 (ee->prop.wm_rot.app_set) &&
3370 (ee->prop.wm_rot.manual_mode.set))
3371 {
3372 if (ee->prop.wm_rot.manual_mode.wait_for_done)
3373 {
3374 if (ee->prop.wm_rot.manual_mode.timer)
3375 ecore_timer_del(ee->prop.wm_rot.manual_mode.timer);
3376 ee->prop.wm_rot.manual_mode.timer = NULL;
3377
3378 if (edata->wm_rot.manual_mode_job)
3379 ecore_job_del(edata->wm_rot.manual_mode_job);
3380 edata->wm_rot.manual_mode_job = ecore_job_add
3381 (_ecore_evas_x_wm_rot_manual_rotation_done_job, ee);
3382 }
3383 }
3384}
3385
3386static Eina_Bool
3387_ecore_evas_x_wm_rot_manual_rotation_done_timeout(void *data)
3388{
3389 Ecore_Evas *ee = data;
3390
3391 ee->prop.wm_rot.manual_mode.timer = NULL;
3392 _ecore_evas_x_wm_rot_manual_rotation_done(ee);
3393 return ECORE_CALLBACK_CANCEL;
3394}
3395
3396static void
3397_ecore_evas_x_wm_rot_manual_rotation_done_timeout_update(Ecore_Evas *ee)
3398{
3399 if (ee->prop.wm_rot.manual_mode.timer)
3400 ecore_timer_del(ee->prop.wm_rot.manual_mode.timer);
3401
3402 ee->prop.wm_rot.manual_mode.timer = ecore_timer_add
3403 (4.0f, _ecore_evas_x_wm_rot_manual_rotation_done_timeout, ee);
3404}
3405
3159static Ecore_Evas_Engine_Func _ecore_x_engine_func = 3406static Ecore_Evas_Engine_Func _ecore_x_engine_func =
3160{ 3407{
3161 _ecore_evas_x_free, 3408 _ecore_evas_x_free,
@@ -3221,7 +3468,12 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
3221 NULL, //fn_msg_send 3468 NULL, //fn_msg_send
3222 3469
3223 _ecore_evas_x_pointer_xy_get, 3470 _ecore_evas_x_pointer_xy_get,
3224 _ecore_evas_x_pointer_warp 3471 _ecore_evas_x_pointer_warp,
3472
3473 _ecore_evas_x_wm_rot_preferred_rotation_set,
3474 _ecore_evas_x_wm_rot_available_rotations_set,
3475 _ecore_evas_x_wm_rot_manual_rotation_done_set,
3476 _ecore_evas_x_wm_rot_manual_rotation_done
3225}; 3477};
3226 3478
3227/* 3479/*
@@ -3415,6 +3667,16 @@ _ecore_evas_x_flush_post(void *data, Evas *e EINA_UNUSED, void *event_info EINA_
3415 } 3667 }
3416 edata->profile.done = 0; 3668 edata->profile.done = 0;
3417 } 3669 }
3670 if ((ee->prop.wm_rot.supported) &&
3671 (edata->wm_rot.done))
3672 {
3673 if (!ee->prop.wm_rot.manual_mode.set)
3674 {
3675 ecore_x_e_window_rotation_change_done_send
3676 (edata->win_root, ee->prop.window, ee->rotation, ee->w, ee->h);
3677 edata->wm_rot.done = 0;
3678 }
3679 }
3418} 3680}
3419#endif 3681#endif
3420 3682
@@ -3610,6 +3872,7 @@ ecore_evas_software_x11_new_internal(const char *disp_name, Ecore_X_Window paren
3610 ecore_x_window_defaults_set(ee->prop.window); 3872 ecore_x_window_defaults_set(ee->prop.window);
3611 _ecore_evas_x_protocols_set(ee); 3873 _ecore_evas_x_protocols_set(ee);
3612 _ecore_evas_x_window_profile_protocol_set(ee); 3874 _ecore_evas_x_window_profile_protocol_set(ee);
3875 _ecore_evas_x_wm_rotation_protocol_set(ee);
3613 _ecore_evas_x_sync_set(ee); 3876 _ecore_evas_x_sync_set(ee);
3614 3877
3615 ee->engine.func->fn_render = _ecore_evas_x_render; 3878 ee->engine.func->fn_render = _ecore_evas_x_render;
@@ -4057,6 +4320,7 @@ ecore_evas_gl_x11_options_new_internal(const char *disp_name, Ecore_X_Window par
4057 ecore_x_window_defaults_set(ee->prop.window); 4320 ecore_x_window_defaults_set(ee->prop.window);
4058 _ecore_evas_x_protocols_set(ee); 4321 _ecore_evas_x_protocols_set(ee);
4059 _ecore_evas_x_window_profile_protocol_set(ee); 4322 _ecore_evas_x_window_profile_protocol_set(ee);
4323 _ecore_evas_x_wm_rotation_protocol_set(ee);
4060 _ecore_evas_x_sync_set(ee); 4324 _ecore_evas_x_sync_set(ee);
4061 4325
4062 ee->engine.func->fn_render = _ecore_evas_x_render; 4326 ee->engine.func->fn_render = _ecore_evas_x_render;