diff options
author | Gwanglim Lee <gl77.lee@samsung.com> | 2014-02-09 09:46:51 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2014-02-09 09:46:51 +0900 |
commit | 77092d94d457d35e11194e0b2ee2a2e9b90b38b9 (patch) | |
tree | 860f1b7c7e0e49ac61648471dd82ae09cf882b17 /src/lib/ecore_evas | |
parent | 259f33679c38e03de3e35c3a0859b3f3f0f9c39a (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 'src/lib/ecore_evas')
-rw-r--r-- | src/lib/ecore_evas/Ecore_Evas.h | 81 | ||||
-rw-r--r-- | src/lib/ecore_evas/ecore_evas.c | 152 | ||||
-rw-r--r-- | src/lib/ecore_evas/ecore_evas_buffer.c | 10 | ||||
-rw-r--r-- | src/lib/ecore_evas/ecore_evas_ews.c | 10 | ||||
-rw-r--r-- | src/lib/ecore_evas/ecore_evas_private.h | 20 |
5 files changed, 271 insertions, 2 deletions
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 | */ |
685 | EAPI Eina_Bool ecore_evas_window_available_profiles_get(Ecore_Evas *ee, char ***profiles, unsigned int *count); | 685 | EAPI 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 | */ | ||
695 | EAPI 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 | */ | ||
705 | EAPI 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 | */ | ||
715 | EAPI 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 | */ | ||
726 | EAPI 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 | */ | ||
738 | EAPI 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 | */ | ||
749 | EAPI 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 | */ | ||
758 | EAPI 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 | */ | ||
766 | EAPI 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 | ||
1949 | EAPI Eina_Bool | ||
1950 | ecore_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 | |||
1961 | EAPI void | ||
1962 | ecore_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 | |||
1991 | EAPI int | ||
1992 | ecore_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 | |||
2003 | EAPI void | ||
2004 | ecore_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 | |||
2016 | EAPI Eina_Bool | ||
2017 | ecore_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 | |||
2040 | EAPI void | ||
2041 | ecore_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 | |||
2059 | EAPI Eina_Bool | ||
2060 | ecore_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 | |||
2077 | EAPI void | ||
2078 | ecore_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 | |||
1949 | EAPI void | 2096 | EAPI void |
1950 | ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) | 2097 | ecore_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 | ||
587 | static void * | 595 | static 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 | ||
704 | void | 712 | void |
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 | ||
120 | struct _Ecore_Evas_Interface | 125 | struct _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; |