summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-02-27 13:52:14 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-27 20:19:07 +0100
commitb3327c761e7f80aa8c86605857f953c7af602b3d (patch)
tree1c960ae7798f80c1f177f7395e07029fdbcc2c0d
parentaef19e9017c46d312f9c9c15b4f2bf0355e0961f (diff)
efl_ui_widget: move orientation to the specific users of this widget
The new api is moved into either Efl.Ui.Win or Efl.Ui.Layout. Only Efl.Ui.Layout is interested in the rotation, as this is the only widget that can actaully apply it to the theme. The value itself however is unique to the window, which means, the window is the only point where the rotation is stored, and this is the point, where rotation changes are brought to the layouts. ref T7553 Depends on D8014 Differential Revision: https://phab.enlightenment.org/D8015
-rw-r--r--src/lib/elementary/efl_ui_layout.c36
-rw-r--r--src/lib/elementary/efl_ui_layout_base.eo14
-rw-r--r--src/lib/elementary/efl_ui_widget.c75
-rw-r--r--src/lib/elementary/efl_ui_widget.eo42
-rw-r--r--src/lib/elementary/efl_ui_win.c182
-rw-r--r--src/lib/elementary/efl_ui_win.eo17
-rw-r--r--src/lib/elementary/elm_main.c25
-rw-r--r--src/lib/elementary/elm_widget.h1
-rw-r--r--src/lib/elementary/elm_widget_layout.h1
9 files changed, 178 insertions, 215 deletions
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index ce0ccec79b..5dd2c3d1a8 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -2394,10 +2394,15 @@ _efl_ui_layout_base_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Data *sd)
2394EOLIAN static Efl_Object* 2394EOLIAN static Efl_Object*
2395_efl_ui_layout_base_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED) 2395_efl_ui_layout_base_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED)
2396{ 2396{
2397 Eo *eo; 2397 Eo *eo, *win;
2398 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); 2398 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
2399 eo = efl_finalize(efl_super(obj, MY_CLASS)); 2399 eo = efl_finalize(efl_super(obj, MY_CLASS));
2400 efl_ui_widget_theme_apply(eo); 2400 efl_ui_widget_theme_apply(eo);
2401
2402 win = efl_ui_widget_top_get(obj);
2403 if (efl_isa(win, EFL_UI_WIN_CLASS))
2404 efl_ui_layout_theme_rotation_apply(obj, efl_ui_win_rotation_get(win));
2405
2401 if (efl_file_get(wd->resize_obj) || efl_file_mmap_get(wd->resize_obj)) 2406 if (efl_file_get(wd->resize_obj) || efl_file_mmap_get(wd->resize_obj))
2402 efl_file_load(wd->resize_obj); 2407 efl_file_load(wd->resize_obj);
2403 2408
@@ -2582,6 +2587,35 @@ _efl_ui_layout_part_bg_efl_object_finalize(Eo *obj, void *_pd EINA_UNUSED)
2582 return obj; 2587 return obj;
2583} 2588}
2584 2589
2590EOLIAN static void
2591_efl_ui_layout_base_automatic_theme_rotation_set(Eo *obj, Efl_Ui_Layout_Data *pd, Eina_Bool automatic)
2592{
2593 if (pd->automatic_orientation_apply == automatic) return;
2594 pd->automatic_orientation_apply = automatic;
2595
2596 efl_ui_layout_theme_rotation_apply(obj, efl_ui_win_rotation_get(efl_ui_widget_top_get(obj)));
2597}
2598
2599EOLIAN static Eina_Bool
2600_efl_ui_layout_base_automatic_theme_rotation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd)
2601{
2602 return pd->automatic_orientation_apply;
2603}
2604
2605EOLIAN static void
2606_efl_ui_layout_base_theme_rotation_apply(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED, Efl_Orient orientation)
2607{
2608 char prefix[4], buf[128];
2609
2610 if (elm_widget_is_legacy(obj))
2611 snprintf(prefix, sizeof(prefix), "elm");
2612 else
2613 snprintf(prefix, sizeof(prefix), "efl");
2614 snprintf(buf, sizeof(buf), "%s,state,orient,%d", prefix, (int)orientation);
2615 efl_layout_signal_emit(obj, buf, prefix);
2616}
2617
2618
2585/* Efl.Ui.Layout_Part_Xxx includes */ 2619/* Efl.Ui.Layout_Part_Xxx includes */
2586#include "efl_ui_layout_part.eo.c" 2620#include "efl_ui_layout_part.eo.c"
2587#include "efl_ui_layout_part_content.eo.c" 2621#include "efl_ui_layout_part_content.eo.c"
diff --git a/src/lib/elementary/efl_ui_layout_base.eo b/src/lib/elementary/efl_ui_layout_base.eo
index e2384c06e0..a024feefd6 100644
--- a/src/lib/elementary/efl_ui_layout_base.eo
+++ b/src/lib/elementary/efl_ui_layout_base.eo
@@ -1,4 +1,5 @@
1import efl_ui; 1import efl_ui;
2import efl_orientation;
2 3
3abstract @beta Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container, 4abstract @beta Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container,
4 Efl.Ui.View, Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind, 5 Efl.Ui.View, Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind,
@@ -45,6 +46,19 @@ abstract @beta Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container
45 style: string("default"); [[The style to use, eg "default".]] 46 style: string("default"); [[The style to use, eg "default".]]
46 } 47 }
47 } 48 }
49 @property automatic_theme_rotation {
50 [[This flag tells if this object will automatically mirror the rotation changes of the window to this object.
51 ]]
52 values {
53 automatic : bool; [[$true to mirror orientation changes to the theme $false otherwise]]
54 }
55 }
56 theme_rotation_apply {
57 [[Apply a new rotation value to this object.]]
58 params {
59 orientation : Efl.Orient; [[The new rotation value.]]
60 }
61 }
48 } 62 }
49 implements { 63 implements {
50 class.constructor; 64 class.constructor;
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c
index 3c6b429dfe..edff7f479b 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -1499,11 +1499,6 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob
1499 _full_eval(sobj, sdc); 1499 _full_eval(sobj, sdc);
1500 1500
1501 if (!sdc->on_create) 1501 if (!sdc->on_create)
1502 efl_ui_widget_on_orientation_update(sobj, sd->orient_mode);
1503 else
1504 sdc->orient_mode = sd->orient_mode;
1505
1506 if (!sdc->on_create)
1507 { 1502 {
1508 if (!sdc->disabled && (elm_widget_disabled_get(obj))) 1503 if (!sdc->disabled && (elm_widget_disabled_get(obj)))
1509 { 1504 {
@@ -3158,22 +3153,6 @@ elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wnam
3158 return EFL_UI_THEME_APPLY_RESULT_FAIL; 3153 return EFL_UI_THEME_APPLY_RESULT_FAIL;
3159 } 3154 }
3160 3155
3161 if (sd->orient_mode != -1)
3162 {
3163 char buf[128];
3164
3165 if (elm_widget_is_legacy(obj))
3166 {
3167 snprintf(buf, sizeof(buf), "elm,state,orient,%d", sd->orient_mode);
3168 elm_widget_signal_emit(obj, buf, "elm");
3169 }
3170 else
3171 {
3172 snprintf(buf, sizeof(buf), "efl,state,orient,%d", sd->orient_mode);
3173 elm_widget_signal_emit(obj, buf, "efl");
3174 }
3175 }
3176
3177 return ret; 3156 return ret;
3178} 3157}
3179 3158
@@ -3609,60 +3588,6 @@ elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode)
3609 } 3588 }
3610} 3589}
3611 3590
3612EOLIAN static void
3613_efl_ui_widget_orientation_mode_set(Eo *obj, Elm_Widget_Smart_Data *sd, Efl_Ui_Widget_Orientation_Mode mode)
3614{
3615 int rotation = -1;
3616
3617 if (mode != EFL_UI_WIDGET_ORIENTATION_MODE_DISABLED)
3618 {
3619 //Get current orient mode from it's parent otherwise, 0.
3620 sd->orient_mode = 0;
3621 ELM_WIDGET_DATA_GET(sd->parent_obj, sd_parent);
3622 if (!sd_parent) rotation = 0;
3623 else rotation = sd_parent->orient_mode;
3624 }
3625 efl_ui_widget_on_orientation_update(obj, rotation);
3626}
3627
3628EOLIAN static Efl_Ui_Widget_Orientation_Mode
3629_efl_ui_widget_orientation_mode_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
3630{
3631 if (sd->orient_mode == -1) return EFL_UI_WIDGET_ORIENTATION_MODE_DISABLED;
3632 else return EFL_UI_WIDGET_ORIENTATION_MODE_DEFAULT;
3633}
3634
3635EOLIAN static void
3636_efl_ui_widget_on_orientation_update(Eo *obj, Elm_Widget_Smart_Data *sd, int orient_mode)
3637{
3638 Evas_Object *child;
3639 Eina_List *l;
3640
3641 sd->orient_mode = orient_mode;
3642
3643 EINA_LIST_FOREACH (sd->subobjs, l, child)
3644 {
3645 if (elm_widget_is(child))
3646 efl_ui_widget_on_orientation_update(child, orient_mode);
3647 }
3648
3649 if (orient_mode != -1)
3650 {
3651 char buf[128];
3652
3653 if (elm_widget_is_legacy(obj))
3654 {
3655 snprintf(buf, sizeof(buf), "elm,state,orient,%d", orient_mode);
3656 elm_widget_signal_emit(obj, buf, "elm");
3657 }
3658 else
3659 {
3660 snprintf(buf, sizeof(buf), "efl,state,orient,%d", orient_mode);
3661 elm_widget_signal_emit(obj, buf, "efl");
3662 }
3663 }
3664}
3665
3666/** 3591/**
3667 * @internal 3592 * @internal
3668 * 3593 *
diff --git a/src/lib/elementary/efl_ui_widget.eo b/src/lib/elementary/efl_ui_widget.eo
index 09e2303f11..6fb8a03c38 100644
--- a/src/lib/elementary/efl_ui_widget.eo
+++ b/src/lib/elementary/efl_ui_widget.eo
@@ -312,48 +312,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje
312 return: bool; [[Indicates if the operation succeeded.]] 312 return: bool; [[Indicates if the operation succeeded.]]
313 legacy: elm_widget_sub_object_del; 313 legacy: elm_widget_sub_object_del;
314 } 314 }
315 @property orientation_mode {
316 [[Whether the widget's automatic orientation is enabled or not.
317
318 Orientation mode is used for widgets to change their style or send
319 signals based on the canvas rotation (i.e. the window orientation).
320 If the orientation mode is enabled, the widget will emit signals
321 such as "elm,state,orient,N" where $N is one of 0, 90, 180, 270,
322 depending on the window orientation. Such signals may be handled by
323 the theme in order to provide a different look for the widget based
324 on the canvas orientation.
325
326 By default orientation mode is enabled.
327
328 See also @.on_orientation_update.
329 ]]
330 values {
331 mode: Efl.Ui.Widget_Orientation_Mode(Efl.Ui.Widget_Orientation_Mode.default);
332 [[How window orientation should affect this widget.]]
333 }
334 }
335 on_orientation_update @protected {
336 [[Virtual function handling canvas orientation changes.
337
338 This method will be called recursively from the top widget (the
339 window) to all the children objects whenever the window rotation
340 is changed. The given $rotation will be one of 0, 90, 180, 270 or
341 the special value -1 if @.orientation_mode is $disabled.
342
343 If @.orientation_mode is $default, the widget implementation will
344 emit the signal "elm,state,orient,$R" will be emitted (where $R is
345 the rotation angle in degrees).
346
347 Note: This function may be called even if the orientation has not
348 actually changed, like when a widget needs to be reconfigured.
349
350 See also @.orientation_mode.
351 ]]
352 params {
353 rotation: int; [[Orientation in degrees: 0, 90, 180, 270 or -1 if
354 @.orientation_mode is $disabled.]]
355 }
356 }
357 on_disabled_update @protected { 315 on_disabled_update @protected {
358 [[Virtual function called when the widget becomes disabled. 316 [[Virtual function called when the widget becomes disabled.
359 317
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 472e1bf6ef..f3086dbc3f 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -35,6 +35,7 @@
35#include "efl_ui_win_legacy.eo.h" 35#include "efl_ui_win_legacy.eo.h"
36#include "efl_ui_win_socket_legacy.eo.h" 36#include "efl_ui_win_socket_legacy.eo.h"
37#include "efl_ui_win_inlined_legacy.eo.h" 37#include "efl_ui_win_inlined_legacy.eo.h"
38#include "efl_ui_widget_common.h"
38 39
39#define MY_CLASS EFL_UI_WIN_CLASS 40#define MY_CLASS EFL_UI_WIN_CLASS
40#define MY_CLASS_NAME "Efl.Ui.Win" 41#define MY_CLASS_NAME "Efl.Ui.Win"
@@ -212,6 +213,7 @@ struct _Efl_Ui_Win_Data
212 int norender; 213 int norender;
213 int modal_count; 214 int modal_count;
214 int response; 215 int response;
216 int rotation;
215 Eina_Bool req_wh : 1; 217 Eina_Bool req_wh : 1;
216 Eina_Bool req_xy : 1; 218 Eina_Bool req_xy : 1;
217 219
@@ -1558,6 +1560,93 @@ _elm_win_frame_obj_update(Efl_Ui_Win_Data *sd, Eina_Bool force)
1558 TRAP(sd, resize, w, h); 1560 TRAP(sd, resize, w, h);
1559} 1561}
1560 1562
1563static int
1564_win_rotation_degree_check(int rotation)
1565{
1566 if ((rotation > 360) || (rotation < 0))
1567 {
1568 WRN("Rotation degree should be 0 ~ 360 (passed degree: %d)", rotation);
1569 rotation %= 360;
1570 if (rotation < 0) rotation += 360;
1571 }
1572 return rotation;
1573}
1574
1575/*
1576 * This API resizes the internal window(ex: X window) and evas_output.
1577 * But this does not resize the elm window object and its contents.
1578 */
1579static void
1580_win_rotate(Evas_Object *obj, Efl_Ui_Win_Data *sd, int rotation, Eina_Bool resize)
1581{
1582 rotation = _win_rotation_degree_check(rotation);
1583 if (sd->rot == rotation) return;
1584 sd->rot = rotation;
1585 if (resize) TRAP(sd, rotation_with_resize_set, rotation);
1586 else TRAP(sd, rotation_set, rotation);
1587 efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(-1, -1));
1588 efl_gfx_hint_size_max_set(obj, EINA_SIZE2D(-1, -1));
1589 _elm_win_resize_objects_eval(obj, EINA_FALSE);
1590#ifdef HAVE_ELEMENTARY_X
1591 _elm_win_xwin_update(sd);
1592#endif
1593 _elm_win_frame_obj_update(sd, 0);
1594 efl_event_callback_legacy_call
1595 (obj, EFL_UI_WIN_EVENT_ROTATION_CHANGED, NULL);
1596 if (_elm_config->atspi_mode)
1597 {
1598 Evas_Coord x = 0, y = 0, width = 0, height = 0;
1599 elm_win_screen_size_get(obj, &x, &y, &width, &height);
1600 if ((sd->rot == 0) || (sd->rot == 180))
1601 {
1602 efl_access_bounds_changed_signal_emit(obj, x, y, width, height);
1603 }
1604 else
1605 {
1606 efl_access_bounds_changed_signal_emit(obj, x, y, height, width);
1607 }
1608 }
1609}
1610
1611EOLIAN static void
1612_efl_ui_win_win_rotation_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd, Efl_Orient rotation)
1613{
1614 Efl_Ui_Widget *widget;
1615 Eina_Iterator *it;
1616 int rot = rotation %360;
1617
1618 if (pd->rot == rot) return;
1619
1620 _win_rotate(obj, pd, rot, EINA_FALSE);
1621
1622 it = efl_ui_widget_tree_widget_iterator(obj);
1623 EINA_ITERATOR_FOREACH(it, widget)
1624 {
1625 if (!efl_isa(widget, EFL_UI_LAYOUT_CLASS)) continue;
1626
1627 if (efl_ui_layout_automatic_theme_rotation_get(widget))
1628 efl_ui_layout_theme_rotation_apply(widget, rot);
1629 }
1630}
1631
1632EOLIAN static Efl_Orient
1633_efl_ui_win_win_rotation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd)
1634{
1635 return pd->rotation;
1636}
1637
1638EAPI void
1639elm_win_rotation_set(Evas_Object *obj, int rotation)
1640{
1641 efl_ui_win_rotation_set(obj, rotation);
1642}
1643
1644EAPI int
1645elm_win_rotation_get(const Evas_Object *obj)
1646{
1647 return efl_ui_win_rotation_get(obj);
1648}
1649
1561static void 1650static void
1562_elm_win_state_change(Ecore_Evas *ee) 1651_elm_win_state_change(Ecore_Evas *ee)
1563{ 1652{
@@ -1613,7 +1702,6 @@ _elm_win_state_change(Ecore_Evas *ee)
1613 { 1702 {
1614 if (sd->rot != ecore_evas_rotation_get(sd->ee)) 1703 if (sd->rot != ecore_evas_rotation_get(sd->ee))
1615 { 1704 {
1616 sd->rot = ecore_evas_rotation_get(sd->ee);
1617 ch_wm_rotation = EINA_TRUE; 1705 ch_wm_rotation = EINA_TRUE;
1618 } 1706 }
1619 } 1707 }
@@ -1691,31 +1779,10 @@ _elm_win_state_change(Ecore_Evas *ee)
1691 } 1779 }
1692 if (ch_wm_rotation) 1780 if (ch_wm_rotation)
1693 { 1781 {
1694 efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(-1, -1)); 1782 efl_ui_win_rotation_set(obj, ecore_evas_rotation_get(sd->ee));
1695 efl_gfx_hint_size_max_set(obj, EINA_SIZE2D(-1, -1)); 1783
1696#ifdef HAVE_ELEMENTARY_X
1697 ELM_WIN_DATA_ALIVE_CHECK(obj, sd);
1698 _elm_win_xwin_update(sd);
1699#endif
1700 ELM_WIN_DATA_ALIVE_CHECK(obj, sd);
1701 efl_ui_widget_on_orientation_update(obj, sd->rot);
1702 efl_event_callback_legacy_call
1703 (obj, EFL_UI_WIN_EVENT_ROTATION_CHANGED, NULL);
1704 efl_event_callback_legacy_call 1784 efl_event_callback_legacy_call
1705 (obj, EFL_UI_WIN_EVENT_WM_ROTATION_CHANGED, NULL); 1785 (obj, EFL_UI_WIN_EVENT_WM_ROTATION_CHANGED, NULL);
1706 if (_elm_config->atspi_mode)
1707 {
1708 Evas_Coord x = 0, y = 0, width = 0, height = 0;
1709 elm_win_screen_size_get(obj, &x, &y, &width, &height);
1710 if ((sd->rot == 0) || (sd->rot == 180))
1711 {
1712 efl_access_bounds_changed_signal_emit(obj, x, y, width, height);
1713 }
1714 else
1715 {
1716 efl_access_bounds_changed_signal_emit(obj, x, y, height, width);
1717 }
1718 }
1719 } 1786 }
1720} 1787}
1721 1788
@@ -6581,55 +6648,6 @@ elm_win_render(Evas_Object *obj)
6581 ecore_evas_manual_render(sd->ee); 6648 ecore_evas_manual_render(sd->ee);
6582} 6649}
6583 6650
6584static int
6585_win_rotation_degree_check(int rotation)
6586{
6587 if ((rotation > 360) || (rotation < 0))
6588 {
6589 WRN("Rotation degree should be 0 ~ 360 (passed degree: %d)", rotation);
6590 rotation %= 360;
6591 if (rotation < 0) rotation += 360;
6592 }
6593 return rotation;
6594}
6595
6596/*
6597 * This API resizes the internal window(ex: X window) and evas_output.
6598 * But this does not resize the elm window object and its contents.
6599 */
6600static void
6601_win_rotate(Evas_Object *obj, Efl_Ui_Win_Data *sd, int rotation, Eina_Bool resize)
6602{
6603 rotation = _win_rotation_degree_check(rotation);
6604 if (sd->rot == rotation) return;
6605 sd->rot = rotation;
6606 if (resize) TRAP(sd, rotation_with_resize_set, rotation);
6607 else TRAP(sd, rotation_set, rotation);
6608 efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(-1, -1));
6609 efl_gfx_hint_size_max_set(obj, EINA_SIZE2D(-1, -1));
6610 _elm_win_resize_objects_eval(obj, EINA_FALSE);
6611#ifdef HAVE_ELEMENTARY_X
6612 _elm_win_xwin_update(sd);
6613#endif
6614 _elm_win_frame_obj_update(sd, 0);
6615 efl_ui_widget_on_orientation_update(obj, rotation);
6616 efl_event_callback_legacy_call
6617 (obj, EFL_UI_WIN_EVENT_ROTATION_CHANGED, NULL);
6618 if (_elm_config->atspi_mode)
6619 {
6620 Evas_Coord x = 0, y = 0, width = 0, height = 0;
6621 elm_win_screen_size_get(obj, &x, &y, &width, &height);
6622 if ((sd->rot == 0) || (sd->rot == 180))
6623 {
6624 efl_access_bounds_changed_signal_emit(obj, x, y, width, height);
6625 }
6626 else
6627 {
6628 efl_access_bounds_changed_signal_emit(obj, x, y, height, width);
6629 }
6630 }
6631}
6632
6633EOLIAN static void 6651EOLIAN static void
6634_efl_ui_win_wm_available_rotations_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, 6652_efl_ui_win_wm_available_rotations_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd,
6635 Eina_Bool allow_0, Eina_Bool allow_90, 6653 Eina_Bool allow_0, Eina_Bool allow_90,
@@ -8224,15 +8242,6 @@ elm_win_wm_rotation_manual_rotation_done(Evas_Object *obj)
8224 ecore_evas_wm_rotation_manual_rotation_done(sd->ee); 8242 ecore_evas_wm_rotation_manual_rotation_done(sd->ee);
8225} 8243}
8226 8244
8227EAPI void
8228elm_win_rotation_set(Evas_Object *obj, int rotation)
8229{
8230 Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
8231 if (!sd) return;
8232
8233 _win_rotate(obj, sd, rotation, EINA_FALSE);
8234}
8235
8236/* 8245/*
8237 * This API does not resize the internal window (ex: X window). 8246 * This API does not resize the internal window (ex: X window).
8238 * But this resizes evas_output, elm window, and its contents. 8247 * But this resizes evas_output, elm window, and its contents.
@@ -8247,15 +8256,6 @@ elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
8247} 8256}
8248 8257
8249EAPI int 8258EAPI int
8250elm_win_rotation_get(const Evas_Object *obj)
8251{
8252 Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
8253 if (!sd) return -1;
8254
8255 return sd->rot;
8256}
8257
8258EAPI int
8259elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj) 8259elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj)
8260{ 8260{
8261 Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); 8261 Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo
index c0d06576b1..6c43af09b2 100644
--- a/src/lib/elementary/efl_ui_win.eo
+++ b/src/lib/elementary/efl_ui_win.eo
@@ -1,3 +1,5 @@
1import efl_orientation;
2
1enum Efl.Ui.Win_Type 3enum Efl.Ui.Win_Type
2{ 4{
3 [[Defines the types of window that can be created 5 [[Defines the types of window that can be created
@@ -845,6 +847,21 @@ class @beta Efl.Ui.Win extends Efl.Ui.Widget implements Efl.Canvas.Scene, Efl.Ac
845 } 847 }
846 return: iterator<const(Efl.Input.Pointer)>; [[Iterator to pointer positions]] 848 return: iterator<const(Efl.Input.Pointer)>; [[Iterator to pointer positions]]
847 } 849 }
850 @property win_rotation @beta {
851 [[The rotation of this window
852
853 The value will automatically change when the WM of this window changes its rotation. This rotation is automatically applied to all @Efl.Ui.Layout objects.
854 ]]
855 set {
856 legacy: null;
857 }
858 get {
859 legacy: null;
860 }
861 values {
862 rotation : Efl.Orient; [[The rotation of the window]]
863 }
864 }
848 } 865 }
849 implements { 866 implements {
850 class.constructor; 867 class.constructor;
diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c
index 71e4325221..cc63a8e656 100644
--- a/src/lib/elementary/elm_main.c
+++ b/src/lib/elementary/elm_main.c
@@ -1912,16 +1912,31 @@ elm_object_name_find(const Evas_Object *obj, const char *name, int recurse)
1912EAPI void 1912EAPI void
1913elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled) 1913elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled)
1914{ 1914{
1915 Efl_Ui_Widget_Orientation_Mode mode = 1915 if (efl_isa(obj, EFL_UI_LAYOUT_CLASS))
1916 disabled ? EFL_UI_WIDGET_ORIENTATION_MODE_DISABLED 1916 {
1917 : EFL_UI_WIDGET_ORIENTATION_MODE_DEFAULT; 1917 efl_ui_layout_automatic_theme_rotation_set(obj, disabled);
1918 efl_ui_widget_orientation_mode_set(obj, mode); 1918 }
1919 else
1920 {
1921 //legacy behaviour
1922 if (disabled)
1923 efl_key_data_set(obj, "__orientation_mode_disabled", (void*) (intptr_t) EINA_TRUE);
1924 }
1919} 1925}
1920 1926
1921EAPI Eina_Bool 1927EAPI Eina_Bool
1922elm_object_orientation_mode_disabled_get(const Evas_Object *obj) 1928elm_object_orientation_mode_disabled_get(const Evas_Object *obj)
1923{ 1929{
1924 return efl_ui_widget_orientation_mode_get(obj) == EFL_UI_WIDGET_ORIENTATION_MODE_DISABLED; 1930 if (efl_isa(obj, EFL_UI_LAYOUT_CLASS))
1931 {
1932 return efl_ui_layout_automatic_theme_rotation_get(obj);
1933 }
1934 else
1935 {
1936 if (efl_key_data_get(obj, "__orientation_mode_disabled"))
1937 return EINA_TRUE;
1938 }
1939 return EINA_FALSE;
1925} 1940}
1926 1941
1927EAPI Elm_Object_Item * 1942EAPI Elm_Object_Item *
diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h
index cdc2653831..cc95ff75aa 100644
--- a/src/lib/elementary/elm_widget.h
+++ b/src/lib/elementary/elm_widget.h
@@ -364,7 +364,6 @@ typedef struct _Elm_Widget_Smart_Data
364 Efl_Ui_Scrollable_On_Show_Region on_show_region; 364 Efl_Ui_Scrollable_On_Show_Region on_show_region;
365 Eina_Free_Cb on_show_region_data_free; 365 Eina_Free_Cb on_show_region_data_free;
366 366
367 int orient_mode; /* -1 is disabled */
368 Elm_Focus_Move_Policy focus_move_policy; 367 Elm_Focus_Move_Policy focus_move_policy;
369 Elm_Focus_Region_Show_Mode focus_region_show_mode; 368 Elm_Focus_Region_Show_Mode focus_region_show_mode;
370 369
diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h
index 5628067691..827398fec6 100644
--- a/src/lib/elementary/elm_widget_layout.h
+++ b/src/lib/elementary/elm_widget_layout.h
@@ -71,6 +71,7 @@ typedef struct _Elm_Layout_Smart_Data
71 Eina_Bool can_access : 1; /**< This is true when all text(including textblock) parts can be accessible by accessibility. */ 71 Eina_Bool can_access : 1; /**< This is true when all text(including textblock) parts can be accessible by accessibility. */
72 Eina_Bool destructed_is : 1; /**< This flag indicates if Efl.Ui.Layout destructor was called. This is needed to avoid unnecessary calculation of subobject deletion during layout object's deletion. */ 72 Eina_Bool destructed_is : 1; /**< This flag indicates if Efl.Ui.Layout destructor was called. This is needed to avoid unnecessary calculation of subobject deletion during layout object's deletion. */
73 Eina_Bool file_set : 1; /**< This flag indicates if Efl.Ui.Layout source is set from a file*/ 73 Eina_Bool file_set : 1; /**< This flag indicates if Efl.Ui.Layout source is set from a file*/
74 Eina_Bool automatic_orientation_apply : 1;
74} Efl_Ui_Layout_Data; 75} Efl_Ui_Layout_Data;
75 76
76/** 77/**