From ca4cabef7a1959f0d3bff39ba63a158fd75f0fe2 Mon Sep 17 00:00:00 2001 From: Jiyoun Park Date: Sun, 12 Feb 2017 16:12:21 +0900 Subject: [PATCH] elm_win: Pend the rotation until app set the rotation. Currently, camera use the elm_win_rotation_with_resize_set. it rotate the canvas, and chage the win size also. The reason why they use this api is to use the object rotation effect during the rotation. If window server send rotation event during the rotation, or efl client deal with the rotation during the app's rotation effect, it cause flickering. Before, X backend , landscape rotation 1. set the available rotation set only 0 2. window server didn't send rotation effect 3. apps listen the devicd rotation callback 4. apps set elm_win_rotation_with_resize_set 90 or 270 5. efl client set the X property related with rotation 6. window server deals with the rotation by app side. But now window server don't want to support this api , becuase client rotation causes the whole of rotation policy. Opensource side, server need to support this situation, but we need to time to discuss. to support compatibility, add this code until we find the final solution. this concept is 1. app set pending rotation using aux_hint (it means app will deal with the rotation) 2. efl client doesn't deal with server's rotation 3. do the rotation job by app just like the server's rotation. Change-Id: Ic1edecbdc729f9202be0977215bb770275f9cb74 --- src/lib/elm_win.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index c187bb2..3afd957 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -224,6 +224,9 @@ struct _Elm_Win_Data 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. */ +// TIZEN_ONLY(20170212): pend rotation until app set rotation + Eina_Bool rotation_pending : 1; /* set true when application will manage the rotation */ +// } wm_rot; Eo *socket_proxy; /* reference object to atspi object in separate process @since 1.15 */ @@ -4912,6 +4915,42 @@ _elm_win_resize_object_del(Eo *obj, Elm_Win_Data *sd, Evas_Object *subobj) evas_object_box_remove(sd->box, subobj); } +// TIZEN_ONLY(20170212): pend rotation until app set rotation + +/* Efl don't have any plan to open new API to support the client rotation.(ex: elm_win_rotation_set) + * But it is need that apps deal with rotation + * For example, if the app want to do the object rotation effect during the rotation, + * canvas should not be rotated until app's rotation effect ends. + * so until to decide app's rotaion policy, + * just use the "wm.policy.win.rot.render.nopending" aux_hint. + * Using this hint, elm- ecore_evas - engine -tizen display server will manage the pending rotation. +*/ + +static int +_elm_win_wm_pending_rotation_set(Evas_Object *obj, const char *hint, const char *val) +{ + ELM_WIN_CHECK(obj) -1; + ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1); + + int id = -1; + + //TODO: aux_hint_del, aux_hint_val_set. + //Currently only 1 is available. + + if (!val || (strncmp(val, "1", 1))) return -1; + id = ecore_evas_aux_hint_add(sd->ee, "wm.policy.win.rot.render.nopending", val); + + if (id == -1) + { + ERR("PendingRotation: elm_win pending_rotation_set failed"); + return id; + } + sd->wm_rot.rotation_pending = EINA_TRUE; + DBG("PendingRotation: elm_win rotation_pending_set sucess"); + return id; +} +// + EOLIAN static void _elm_win_title_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, const char *title) { @@ -5630,6 +5669,29 @@ _win_rotation_degree_check(int rotation) return rotation; } +// TIZEN_ONLY(20170212): pend rotation until app set rotation +/* + * This API rotates the window by app side. + */ + +static void +_win_pending_rotate(Evas_Object *obj, Elm_Win_Data *sd, int rotation, Eina_Bool resize) +{ + rotation = _win_rotation_degree_check(rotation); + DBG("PendingRotation: elm_win pending rotation set rot=%d", rotation); + if (sd->rot == rotation) return; + + //TODO: We need time to set up the role of pending rotation between the server and client. + //and also need time to discuss this concept with opensource. + //so until that time, we add ecore evas data instead of opening the new ecore_evas_XXX api. + ecore_evas_data_set(sd->ee, "pending_rotation", (void *)1); + + // Currently only support rotation_with_resize + if (resize) TRAP(sd, rotation_with_resize_set, rotation); + else return; +} +// + /* * This API resizes the internal window(ex: X window) and evas_output. * But this does not resize the elm window object and its contents. @@ -5682,7 +5744,14 @@ _elm_win_rotation_set(Eo *obj, Elm_Win_Data *sd, int rotation) EOLIAN static void _elm_win_rotation_with_resize_set(Eo *obj, Elm_Win_Data *sd, int rotation) { - _win_rotate(obj, sd, rotation, EINA_TRUE); +// TIZEN_ONLY(20170212): pend rotation until app set rotation + if (sd->wm_rot.rotation_pending) + { + _win_pending_rotate(obj, sd, rotation, EINA_TRUE); + } + else +// + _win_rotate(obj, sd, rotation, EINA_TRUE); } EOLIAN static int @@ -6872,6 +6941,13 @@ elm_win_aux_hint_add(Evas_Object *obj, const char *hint, const char *val) { ELM_WIN_CHECK(obj) -1; ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1); + +// TIZEN_ONLY(20170212): pend rotation until app set rotation + if ((hint) && (!strncmp(hint, "wm.policy.win.rot.render.nopending", strlen(hint)))) + { + return _elm_win_wm_pending_rotation_set(obj, hint, val); + } +// return ecore_evas_aux_hint_add(sd->ee, hint, val); } -- 2.7.4