seoz pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=362594cb4bd39c7e514072f38ca1efac469c6f5e
commit 362594cb4bd39c7e514072f38ca1efac469c6f5e Author: Seunghun Lee <shiin....@samsung.com> Date: Mon Feb 10 22:09:45 2014 +0900 elm_win: added the window manager rotation feature and a sample. Summary: since to control the rotation of application windows by WM, already added related feature in Ecore_Evas. Added related API for it. Reviewers: raster, seoz CC: gwanglim Differential Revision: https://phab.enlightenment.org/D542 --- src/bin/Makefile.am | 1 + src/bin/test.c | 2 + src/bin/test_win_wm_rotation.c | 214 +++++++++++++++++++++++++++++++++++ src/lib/elm_win.c | 251 +++++++++++++++++++++++++++++++++++++++++ src/lib/elm_win_eo.h | 102 ++++++++++++++++- src/lib/elm_win_legacy.h | 137 ++++++++++++++++++++++ 6 files changed, 706 insertions(+), 1 deletion(-) diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 312b23c..3ebd91f 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -134,6 +134,7 @@ test_win_inline.c \ test_win_socket.c \ test_win_plug.c \ test_win_state.c \ +test_win_wm_rotation.c \ test.h elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la \ diff --git a/src/bin/test.c b/src/bin/test.c index 75e8061..bfd0294 100644 --- a/src/bin/test.c +++ b/src/bin/test.c @@ -205,6 +205,7 @@ void test_systray(void *data, Evas_Object *obj, void *event_info); void test_win_inline(void *data, Evas_Object *obj, void *event_info); void test_win_socket(void *data, Evas_Object *obj, void *event_info); void test_win_plug(void *data, Evas_Object *obj, void *event_info); +void test_win_wm_rotation(void *data, Evas_Object *obj, void *event_info); void test_grid(void *data, Evas_Object *obj, void *event_info); void test_glview_simple(void *data, Evas_Object *obj, void *event_info); void test_glview(void *data, Evas_Object *obj, void *event_info); @@ -515,6 +516,7 @@ add_tests: ADD_TEST(NULL, "Window / Background", "Window Inline", test_win_inline); ADD_TEST(NULL, "Window / Background", "Window Socket", test_win_socket); ADD_TEST(NULL, "Window / Background", "Window Plug", test_win_plug); + ADD_TEST(NULL, "Window / Background", "Window WM Rotation", test_win_wm_rotation); //------------------------------// ADD_TEST(NULL, "Images", "Icon", test_icon); diff --git a/src/bin/test_win_wm_rotation.c b/src/bin/test_win_wm_rotation.c new file mode 100644 index 0000000..1a37961 --- /dev/null +++ b/src/bin/test_win_wm_rotation.c @@ -0,0 +1,214 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include <Elementary.h> + +typedef struct _App_Data App_Data; + +struct _App_Data +{ + Eina_Bool wm_rot_supported; + Eina_List *chs; + int available_rots[4]; + Evas_Object *lb; + Evas_Object *rdg; +}; + +static void +_bt_available_rots_set(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Evas_Object *win = data; + App_Data *ad = evas_object_data_get(win, "ad"); + Evas_Object *o; + Eina_List *l; + const char *str; + unsigned int i = 0; + + if (!ad->wm_rot_supported) return; + + EINA_LIST_FOREACH(ad->chs, l, o) + { + if (!elm_check_state_get(o)) continue; + str = elm_object_text_get(o); + if (!str) continue; + ad->available_rots[i] = atoi(str); + i++; + } + + elm_win_wm_rotation_available_rotations_set + (win, ad->available_rots, i); +} + +static void +_bt_preferred_rot_set(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Evas_Object *win = (Evas_Object *)(data); + App_Data *ad = evas_object_data_get(win, "ad"); + + if (!ad->wm_rot_supported) return; + + Evas_Object *rd = elm_radio_selected_object_get(ad->rdg); + if (rd) + { + const char *str = elm_object_text_get(rd); + int rot = 0; + + if (!strcmp(str, "Unset")) + rot = -1; + else + rot = atoi(str); + + elm_win_wm_rotation_preferred_rotation_set(win, rot); + } +} + +static void +_win_wm_rotation_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +{ + Evas_Object *win = data; + App_Data *ad = evas_object_data_get(win, "ad"); + int rot = elm_win_rotation_get(win); + char buf[32]; + + if (!ad->wm_rot_supported) return; + + eina_convert_itoa(rot, buf); + elm_object_text_set(ad->lb, eina_stringshare_add(buf)); +} + +static void +_win_del_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + App_Data *ad = evas_object_data_get(obj, "ad"); + Evas_Object *o; + + if (ad->wm_rot_supported) + { + EINA_LIST_FREE(ad->chs, o) + evas_object_data_del(o, "rotation"); + } + + free(ad); +} + +void +test_win_wm_rotation(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + App_Data *ad; + Evas_Object *win, *bx, *bx2, *lb, *ch, *bt, *en, *rd, *rdg = NULL; + int i; + char buf[32]; + + if (!(ad = calloc(1, sizeof(App_Data)))) return; + + win = elm_win_util_standard_add("wmrotation", "WMRotation"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_data_set(win, "ad", ad); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "<b>Window manager rotation test</b>"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + ad->wm_rot_supported = elm_win_wm_rotation_supported_get(win); + if (ad->wm_rot_supported) + { + int rots[] = { 0, 90, 270 }; + elm_win_wm_rotation_available_rotations_set(win, rots, (sizeof(rots) / sizeof(int))); + elm_win_wm_rotation_preferred_rotation_set(win, 90); + + bx2 = elm_box_add(win); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0); + elm_box_align_set(bx2, 0.0, 0.5); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + for (i = 0; i < 4; i++) + { + ch = elm_check_add(win); + eina_convert_itoa((i * 90), buf); + elm_object_text_set(ch, eina_stringshare_add(buf)); + evas_object_size_hint_weight_set(ch, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx2, ch); + evas_object_show(ch); + + if (i != 2) elm_check_state_set(ch, EINA_TRUE); + + ad->chs = eina_list_append(ad->chs, ch); + } + + bt = elm_button_add(win); + elm_object_text_set(bt, "Available rotations"); + evas_object_smart_callback_add(bt, "clicked", _bt_available_rots_set, win); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bx2 = elm_box_add(win); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0); + elm_box_align_set(bx2, 0.0, 0.5); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + for (i = 0; i < 5; i++) + { + rd = elm_radio_add(win); + if (!rdg) rdg = rd; + elm_radio_state_value_set(rd, i); + elm_radio_group_add(rd, rdg); + + if (i == 0) + elm_object_text_set(rd, "Unset"); + else + { + eina_convert_itoa(((i - 1) * 90), buf); + elm_object_text_set(rd, eina_stringshare_add(buf)); + } + + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx2, rd); + evas_object_show(rd); + } + + elm_radio_value_set(rdg, 2); + ad->rdg = rdg; + + bt = elm_button_add(win); + elm_object_text_set(bt, "Preferred rotation"); + evas_object_smart_callback_add(bt, "clicked", _bt_preferred_rot_set, win); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(win, "wm,rotation,changed", _win_wm_rotation_changed_cb, win); + } + else + printf("Window manager doesn't support rotation\n"); + + en = elm_entry_add(win); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, en); + evas_object_show(en); + + lb = elm_label_add(win); + elm_object_text_set(lb, "N/A"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + ad->lb = lb; + + evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL); + + evas_object_resize(win, 480, 400); + evas_object_show(bx); + evas_object_show(win); +} diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 4a143d8..5ab15bd 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -145,6 +145,14 @@ struct _Elm_Win_Smart_Data const char **available_list; unsigned int count; } profile; + struct + { + int preferred_rot; /* indicates preferred rotation value, -1 means invalid. */ + int *rots; /* indicates available rotations */ + unsigned int count; /* number of elements in available rotations */ + Eina_Bool wm_supported : 1; /* set true when the window manager support window rotation */ + Eina_Bool use : 1; /* set ture when application use window manager rotation. */ + } wm_rot; void *trap_data; @@ -186,6 +194,7 @@ static const char SIG_ROTATION_CHANGED[] = "rotation,changed"; static const char SIG_PROFILE_CHANGED[] = "profile,changed"; static const char SIG_FOCUSED[] = "focused"; static const char SIG_UNFOCUSED[] = "unfocused"; +static const char SIG_WM_ROTATION_CHANGED[] = "wm,rotation,changed"; static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_DELETE_REQUEST, ""}, @@ -207,6 +216,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_PROFILE_CHANGED, ""}, {SIG_FOCUSED, ""}, {SIG_UNFOCUSED, ""}, + {SIG_WM_ROTATION_CHANGED, ""}, {NULL, NULL} }; @@ -224,6 +234,9 @@ _elm_win_on_resize_obj_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +#ifdef HAVE_ELEMENTARY_X +static void _elm_win_xwin_update(Elm_Win_Smart_Data *sd); +#endif EAPI double _elm_startup_time = 0; @@ -989,6 +1002,7 @@ _elm_win_state_change(Ecore_Evas *ee) Eina_Bool ch_fullscreen = EINA_FALSE; Eina_Bool ch_maximized = EINA_FALSE; Eina_Bool ch_profile = EINA_FALSE; + Eina_Bool ch_wm_rotation = EINA_FALSE; const char *profile; EINA_SAFETY_ON_NULL_RETURN(sd); @@ -1024,6 +1038,15 @@ _elm_win_state_change(Ecore_Evas *ee) profile = ecore_evas_window_profile_get(sd->ee); ch_profile = _elm_win_profile_set(sd, profile); + if (sd->wm_rot.use) + { + if (sd->rot != ecore_evas_rotation_get(sd->ee)) + { + sd->rot = ecore_evas_rotation_get(sd->ee); + ch_wm_rotation = EINA_TRUE; + } + } + _elm_win_state_eval_queue(); if ((ch_withdrawn) || (ch_iconified)) @@ -1060,6 +1083,17 @@ _elm_win_state_change(Ecore_Evas *ee) { _elm_win_profile_update(sd); } + if (ch_wm_rotation) + { + evas_object_size_hint_min_set(obj, -1, -1); + evas_object_size_hint_max_set(obj, -1, -1); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(sd); +#endif + elm_widget_orientation_set(obj, sd->rot); + evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL); + evas_object_smart_callback_call(obj, SIG_WM_ROTATION_CHANGED, NULL); + } } static void @@ -3185,6 +3219,9 @@ _win_constructor(Eo *obj, void *_pd, va_list *list) // do nothing } + sd->wm_rot.wm_supported = ecore_evas_wm_rotation_supported_get(sd->ee); + sd->wm_rot.preferred_rot = -1; // it means that elm_win doesn't use preferred rotation. + sd->layout = edje_object_add(sd->evas); _elm_theme_object_set(obj, sd->layout, "win", "base", "default"); sd->box = evas_object_box_add(sd->evas); @@ -4561,6 +4598,203 @@ _rotation_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) *ret = sd->rot; } +EAPI Eina_Bool +elm_win_wm_rotation_supported_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) EINA_FALSE; + Eina_Bool ret = EINA_FALSE; + eo_do((Eo *) obj, elm_obj_win_wm_rotation_supported_get(&ret)); + return ret; +} + +static void +_wm_rotation_supported_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + Eina_Bool *ret = va_arg(*list, Eina_Bool *); + Elm_Win_Smart_Data *sd = _pd; + *ret = sd->wm_rot.wm_supported; +} + +/* This will unset a preferred rotation, if given preferred rotation is '-1'. + */ +EAPI void +elm_win_wm_rotation_preferred_rotation_set(const Evas_Object *obj, + int rotation) +{ + ELM_WIN_CHECK(obj); + eo_do((Eo *) obj, elm_obj_win_wm_preferred_rotation_set(rotation)); +} + +static void +_wm_preferred_rotation_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + int rotation = va_arg(*list, int); + int rot; + Elm_Win_Smart_Data *sd = _pd; + + if (!sd->wm_rot.use) + sd->wm_rot.use = EINA_TRUE; + + // '-1' means that elm_win doesn't use preferred rotation. + if (rotation == -1) + rot = -1; + else + rot = _win_rotation_degree_check(rotation); + + if (sd->wm_rot.preferred_rot == rot) return; + sd->wm_rot.preferred_rot = rot; + + ecore_evas_wm_rotation_preferred_rotation_set(sd->ee, rot); +} + +EAPI int +elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) -1; + int ret = -1; + eo_do((Eo *) obj, elm_obj_win_wm_preferred_rotation_get(&ret)); + return ret; +} + +static void +_wm_preferred_rotation_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + int *ret = va_arg(*list, int *); + Elm_Win_Smart_Data *sd = _pd; + *ret = sd->wm_rot.preferred_rot; +} + +EAPI void +elm_win_wm_rotation_available_rotations_set(Evas_Object *obj, + const int *rotations, + unsigned int count) +{ + ELM_WIN_CHECK(obj); + eo_do((Eo *) obj, elm_obj_win_wm_available_rotations_set(rotations, count)); +} + +static void +_wm_available_rotations_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + const int *rotations = va_arg(*list, const int *); + unsigned int count = va_arg(*list, unsigned int); + Elm_Win_Smart_Data *sd = _pd; + unsigned int i; + int r; + + if (!sd->wm_rot.use) + sd->wm_rot.use = EINA_TRUE; + + ELM_SAFE_FREE(sd->wm_rot.rots, free); + sd->wm_rot.count = 0; + + if (count > 0) + { + sd->wm_rot.rots = calloc(count, sizeof(int)); + if (!sd->wm_rot.rots) return; + for (i = 0; i < count; i++) + { + r = _win_rotation_degree_check(rotations[i]); + sd->wm_rot.rots[i] = r; + } + } + + sd->wm_rot.count = count; + + ecore_evas_wm_rotation_available_rotations_set(sd->ee, + sd->wm_rot.rots, + sd->wm_rot.count); +} + +EAPI Eina_Bool +elm_win_wm_rotation_available_rotations_get(const Evas_Object *obj, + int **rotations, + unsigned int *count) +{ + ELM_WIN_CHECK(obj) EINA_FALSE; + Eina_Bool ret = EINA_FALSE; + eo_do((Eo *) obj, elm_obj_win_wm_available_rotations_get(rotations, count, &ret)); + return ret; +} + +static void +_wm_available_rotations_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + int **rotations = va_arg(*list, int **); + unsigned int *count = va_arg(*list, unsigned int *); + Eina_Bool *ret = va_arg(*list, Eina_Bool *); + Elm_Win_Smart_Data *sd = _pd; + *ret = EINA_FALSE; + if (!sd->wm_rot.use) return; + + if (sd->wm_rot.count > 0) + { + if (rotations) + { + *rotations = calloc(sd->wm_rot.count, sizeof(int)); + if (*rotations) + { + memcpy(*rotations, + sd->wm_rot.rots, + sizeof(int) * sd->wm_rot.count); + } + } + } + + if (count) *count = sd->wm_rot.count; + *ret = EINA_TRUE; +} + +EAPI void +elm_win_wm_rotation_manual_rotation_done_set(Evas_Object *obj, + Eina_Bool set) +{ + ELM_WIN_CHECK(obj); + eo_do((Eo *) obj, elm_obj_win_wm_manual_rotation_done_set(set)); +} + +static void +_wm_manual_rotation_done_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + int set = va_arg(*list, int); + Elm_Win_Smart_Data *sd = _pd; + if (!sd->wm_rot.use) return; + ecore_evas_wm_rotation_manual_rotation_done_set(sd->ee, set); +} + +EAPI Eina_Bool +elm_win_wm_rotation_manual_rotation_done_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) EINA_FALSE; + Eina_Bool ret = EINA_FALSE; + eo_do((Eo *) obj, elm_obj_win_wm_manual_rotation_done_get(&ret)); + return ret; +} + +static void +_wm_manual_rotation_done_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + Eina_Bool *ret = va_arg(*list, Eina_Bool *); + Elm_Win_Smart_Data *sd = _pd; + if (!sd->wm_rot.use) return; + *ret = ecore_evas_wm_rotation_manual_rotation_done_get(sd->ee); +} + +EAPI void +elm_win_wm_rotation_manual_rotation_done(Evas_Object *obj) +{ + ELM_WIN_CHECK(obj); + eo_do((Eo *) obj, elm_obj_win_wm_manual_rotation_done()); +} + +static void +_wm_manual_rotation_done(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED) +{ + Elm_Win_Smart_Data *sd = _pd; + if (!sd->wm_rot.use) return; + ecore_evas_wm_rotation_manual_rotation_done(sd->ee); +} + EAPI void elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky) @@ -5701,6 +5935,15 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET), _xwindow_get), EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET), _wl_window_get), EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WINDOW_ID_GET), _window_id_get), + EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_ROTATION_SUPPORTED_GET), _wm_rotation_supported_get), + EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_PREFERRED_ROTATION_SET), _wm_preferred_rotation_set), + EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_PREFERRED_ROTATION_GET), _wm_preferred_rotation_get), + EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_AVAILABLE_ROTATIONS_SET), _wm_available_rotations_set), + EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_AVAILABLE_ROTATIONS_GET), _wm_available_rotations_get), + EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_SET), _wm_manual_rotation_done_set), + EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_GET), _wm_manual_rotation_done_get), + EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE), _wm_manual_rotation_done), + EO_OP_FUNC_SENTINEL }; @@ -5805,6 +6048,14 @@ static const Eo_Op_Description op_desc[] = { EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET, "Get the Ecore_X_Window of an Evas_Object."), EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET, "Get the Ecore_Wl_Window of an Evas_Object."), EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WINDOW_ID_GET, "Get the Ecore_Window of an Evas_Object."), + EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WM_ROTATION_SUPPORTED_GET, "Query if the underlying windowing system supports the window manager rotation.."), + EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WM_PREFERRED_ROTATION_SET, "Set the preferred rotation hint."), + EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WM_PREFERRED_ROTATION_GET, "Get the preferred rotation hint."), + EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WM_AVAILABLE_ROTATIONS_SET, "Set the array of available window rotations."), + EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WM_AVAILABLE_ROTATIONS_GET, "Get the array of available window rotations."), + EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_SET, "Set manual rotation done mode of obj window."), + EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_GET, "Get manual rotation done mode of obj window."), + EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE, "Set rotation finish manually"), EO_OP_DESCRIPTION_SENTINEL }; diff --git a/src/lib/elm_win_eo.h b/src/lib/elm_win_eo.h index 8ccc901..ae67909 100644 --- a/src/lib/elm_win_eo.h +++ b/src/lib/elm_win_eo.h @@ -106,6 +106,14 @@ enum ELM_OBJ_WIN_SUB_ID_XWINDOW_GET, ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET, ELM_OBJ_WIN_SUB_ID_WINDOW_ID_GET, + ELM_OBJ_WIN_SUB_ID_WM_ROTATION_SUPPORTED_GET, + ELM_OBJ_WIN_SUB_ID_WM_PREFERRED_ROTATION_SET, + ELM_OBJ_WIN_SUB_ID_WM_PREFERRED_ROTATION_GET, + ELM_OBJ_WIN_SUB_ID_WM_AVAILABLE_ROTATIONS_SET, + ELM_OBJ_WIN_SUB_ID_WM_AVAILABLE_ROTATIONS_GET, + ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_SET, + ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_GET, + ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE, ELM_OBJ_WIN_SUB_ID_LAST }; @@ -1269,6 +1277,98 @@ enum #define elm_obj_win_window_id_get(ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WINDOW_ID_GET), EO_TYPECHECK(Ecore_Window *, ret) /** - * @} + * @def elm_obj_win_wm_rotation_supported_get + * @since 1.9 + * + * Query whether window manager supports window rotation or not. + * + * @param[out] ret + * + * @see elm_win_wm_rotation_supported_get + */ +#define elm_obj_win_wm_rotation_supported_get(ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_ROTATION_SUPPORTED_GET), EO_TYPECHECK(Eina_Bool *, ret) + +/** + * @def elm_obj_win_wm_preferred_rotation_set + * @since 1.9 + * + * Set the preferred rotation value. + * + * @param[in] rotation + * + * @see elm_win_wm_rotation_preferred_rotation_set + */ +#define elm_obj_win_wm_preferred_rotation_set(rotation) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_PREFERRED_ROTATION_SET), EO_TYPECHECK(int, rotation) + +/** + * @def elm_obj_win_wm_preferred_rotation_get + * @since 1.9 + * + * Get the preferred rotation value. + * + * @param[out] ret + * + * @see elm_win_wm_rotation_preferred_rotation_get + */ +#define elm_obj_win_wm_preferred_rotation_get(ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_PREFERRED_ROTATION_GET), EO_TYPECHECK(int *, ret) + +/** + * @def elm_obj_win_wm_available_rotations_set + * @since 1.9 + * + * Set the array of available rotations. + * + * @param[in] rotations + * @param[in] count + * + * @see elm_win_wm_rotation_available_rotations_set */ +#define elm_obj_win_wm_available_rotations_set(rotation, count) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_AVAILABLE_ROTATIONS_SET), EO_TYPECHECK(const int *, rotations), EO_TYPECHECK(unsigned int, count) +/** + * @def elm_obj_win_wm_available_rotations_get + * @since 1.9 + * + * Get the array of available window rotation value. + * + * @param[out] rotations + * @param[out] count + * @param[out] ret + * + * @see elm_win_wm_rotation_available_rotations_get + */ +#define elm_obj_win_wm_available_rotations_get(rotations, count, ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_AVAILABLE_ROTATIONS_GET), EO_TYPECHECK(int **, rotations), EO_TYPECHECK(unsigned int *, count), EO_TYPECHECK(Eina_Bool *, ret) + +/** + * @def elm_obj_win_wm_manual_rotation_done_set + * @since 1.9 + * + * Set manual rotation done mode + * + * @param[in] set + * + * @see elm_win_wm_rotation_manual_rotation_done_set + */ +#define elm_obj_win_wm_manual_rotation_done_set(set) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_SET), EO_TYPECHECK(Eina_Bool, set) + +/** + * @def elm_obj_win_wm_manual_rotation_done_get + * @since 1.9 + * + * Get manual rotation done mode state + * + * @param[out] ret + * + * @see elm_win_wm_rotation_manual_rotation_done_get + */ +#define elm_obj_win_wm_manual_rotation_done_get(ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_GET), EO_TYPECHECK(Eina_Bool *, ret) + +/** + * @def elm_obj_win_wm_manual_rotation_done + * @since 1.9 + * + * Set rotation finish manually + * + * @see elm_win_wm_rotation_manual_rotation_done + */ +#define elm_obj_win_wm_manual_rotation_done() ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE) diff --git a/src/lib/elm_win_legacy.h b/src/lib/elm_win_legacy.h index 2a31c01..2513357 100644 --- a/src/lib/elm_win_legacy.h +++ b/src/lib/elm_win_legacy.h @@ -841,6 +841,143 @@ EAPI void elm_win_rotation_with_resize_set(Evas_Object *obj, in EAPI int elm_win_rotation_get(const Evas_Object *obj); /** + * Query whether window manager supports window rotation or not. + * + * 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. + * + * @return @c EINA_TRUE if the window manager rotation is supported, @c EINA_FALSE otherwise. + * + * @see elm_win_wm_rotation_supported_get() + * @see elm_win_wm_rotation_preferred_rotation_set() + * @see elm_win_wm_rotation_preferred_rotation_get() + * @see elm_win_wm_rotation_available_rotations_set() + * @see elm_win_wm_rotation_available_rotations_get() + * @see elm_win_wm_rotation_manual_rotation_done_set() + * @see elm_win_wm_rotation_manual_rotation_done_get() + * @see elm_win_wm_rotation_manual_rotation_done() + * + * @ingroup Win + * @since 1.9 + */ +EAPI Eina_Bool elm_win_wm_rotation_supported_get(const Evas_Object *obj); + +/** + * Set the preferred rotation value. + * + * This function is used to set the orientation of window @p obj to spicific angle fixed. + * + * @param obj The window object + * @param rotation The preferred rotation of the window in degrees (0-360), + * counter-clockwise. + * + * @see elm_win_wm_rotation_preferred_rotation_get() + * + * ingroup Win + * @since 1.9 + */ +EAPI void elm_win_wm_rotation_preferred_rotation_set(const Evas_Object *obj, int rotation); + +/** + * Get the preferred rotation value. + * + * This function is used to get the preferred rotoation value. + * + * @param obj The window object + * @return The preferred rotation of the window in degrees (0-360), + * counter-clockwise. + * + * @see elm_win_wm_rotation_preferred_rotation_set() + * + * ingroup Win + * @since 1.9 + */ +EAPI int elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj); + +/** + * Set the array of available window rotations. + * + * This function is used to set the available rotations to give the hints to WM. + * WM will refer this hints and set the orientation window properly. + * + * @param obj The window object + * @param *rotations The array of rotation value. + * @param count The number of array of rotations + * + * @see elm_win_wm_rotation_available_rotations_get() + * + * ingroup Win + * @since 1.9 + */ +EAPI void elm_win_wm_rotation_available_rotations_set(Evas_Object *obj, const int *rotations, unsigned int count); + +/** + * Get the array of available window rotations. + * + * This function is used to get the available rotations. + * + * @param obj The window object + * @param rotations To store the available rotations. + * @param count To store the number of rotations. + * + * @see elm_win_wm_rotation_available_rotations_set() + * + * ingroup Win + * @since 1.9 + */ +EAPI Eina_Bool elm_win_wm_rotation_available_rotations_get(const Evas_Object *obj, int **rotations, unsigned int *count); + +/** + * Set the manual rotation done mode. + * + * This function is used to set or reset the manual rotation done mode. + * the message of rotation done is sent to WM after rendering its canvas in Ecore_Evas. + * but if set the manual rotation done mode, + * it's disabled and user should call the "elm_win_wm_rotation_manual_done" explicitly to sends the message. + * + * @param obj The window object + * @param set EINA_TRUE means to set manual rotation done mode EINA_FALSE otherwise. + * + * @see elm_win_wm_rotation_manual_rotation_done_get() + * @see elm_win_wm_rotation_manual_rotation_done() + * + * ingroup Win + * @since 1.9 + */ +EAPI void elm_win_wm_rotation_manual_rotation_done_set(Evas_Object *obj, Eina_Bool set); + +/** + * Get the state of manual rotation done mode. + * + * This function is used to get the state of manual rotation done mode. + * + * @param obj The window object + * @return @c EINA_TRUE manual rotationn done mode, @c EINA_FALSE otherwise. + * + * @see elm_win_wm_rotation_manual_rotation_done_set() + * @see elm_win_wm_rotation_manual_rotation_done() + * + * ingroup Win + * @since 1.9 + */ +EAPI Eina_Bool elm_win_wm_rotation_manual_rotation_done_get(const Evas_Object *obj); + +/** + * To notify the rotation done to WM manually. + * + * This function is used to notify the rotation done to WM manually. + * + * @param obj The window object + * + * @see elm_win_wm_rotation_manual_rotation_done_set() + * @see elm_win_wm_rotation_manual_rotation_done_get() + * + * ingroup Win + * @since 1.9 + */ +EAPI void elm_win_wm_rotation_manual_rotation_done(Evas_Object *obj); + +/** * Set the sticky state of the window. * * Hints the Window Manager that the window in @p obj should be left fixed --