forked from enlightenment/efl
elm_win: clean elm apis related with rotation.
elm_win only support two kind of apis. 1. elm_win_screen_rotation_get this api is used to detect screen rotation before app doing something before rotation event. for example, app can query rotation before deciding there layout. 2. elm_win_available_rotation_set/get like video app, can set only landscape mode if they need.
This commit is contained in:
parent
589eae9a8b
commit
ec464939d9
|
@ -4906,68 +4906,13 @@ _win_rotate(Evas_Object *obj, Elm_Win_Data *sd, int rotation, Eina_Bool resize)
|
|||
(obj, ELM_WIN_EVENT_ROTATION_CHANGED, NULL);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_win_rotation_set(Eo *obj, Elm_Win_Data *sd, int rotation)
|
||||
{
|
||||
_win_rotate(obj, sd, rotation, EINA_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* This API does not resize the internal window (ex: X window).
|
||||
* But this resizes evas_output, elm window, and its contents.
|
||||
*/
|
||||
EOLIAN static void
|
||||
_elm_win_rotation_with_resize_set(Eo *obj, Elm_Win_Data *sd, int rotation)
|
||||
{
|
||||
_win_rotate(obj, sd, rotation, EINA_TRUE);
|
||||
}
|
||||
|
||||
EOLIAN static int
|
||||
_elm_win_rotation_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
|
||||
_elm_win_screen_rotation_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
|
||||
{
|
||||
return sd->rot;
|
||||
}
|
||||
//TODO: query to wm about device's rotation
|
||||
(void)sd;
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_win_wm_rotation_supported_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
|
||||
{
|
||||
return 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);
|
||||
elm_obj_win_wm_preferred_rotation_set((Eo *) obj, rotation);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_win_wm_preferred_rotation_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, int rotation)
|
||||
{
|
||||
int rot;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
EOLIAN static int
|
||||
_elm_win_wm_preferred_rotation_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
|
||||
{
|
||||
return sd->wm_rot.preferred_rot;
|
||||
return 0;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -6152,4 +6097,85 @@ elm_win_wm_manual_rotation_done_manual(Evas_Object *obj)
|
|||
ecore_evas_wm_rotation_manual_rotation_done(sd->ee);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_win_rotation_set(Evas_Object *obj, int rotation)
|
||||
{
|
||||
ELM_WIN_CHECK(obj);
|
||||
ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
|
||||
|
||||
_win_rotate(obj, sd, rotation, EINA_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* This API does not resize the internal window (ex: X window).
|
||||
* But this resizes evas_output, elm window, and its contents.
|
||||
*/
|
||||
EAPI void
|
||||
elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
|
||||
{
|
||||
ELM_WIN_CHECK(obj);
|
||||
ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
|
||||
|
||||
_win_rotate(obj, sd, rotation, EINA_TRUE);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
elm_win_rotation_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_WIN_CHECK(obj) -1;
|
||||
ELM_WIN_DATA_GET_OR_RETURN(obj, sd, -1);
|
||||
|
||||
return sd->rot;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_win_wm_preferred_rotation_set(Evas_Object *obj, int rotation)
|
||||
{
|
||||
int rot;
|
||||
|
||||
ELM_WIN_CHECK(obj);
|
||||
ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
|
||||
|
||||
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_preferred_rotation_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_WIN_CHECK(obj) -1;
|
||||
ELM_WIN_DATA_GET_OR_RETURN(obj, sd, -1);
|
||||
|
||||
return sd->wm_rot.preferred_rot;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_win_wm_rotation_supported_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_WIN_CHECK(obj) EINA_FALSE;
|
||||
ELM_WIN_DATA_GET_OR_RETURN(obj, sd, EINA_FALSE);
|
||||
|
||||
return 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(Evas_Object *obj, int rotation)
|
||||
{
|
||||
ELM_WIN_CHECK(obj);
|
||||
elm_win_wm_preferred_rotation_set(obj, rotation);
|
||||
}
|
||||
|
||||
#include "elm_win.eo.c"
|
||||
|
|
|
@ -198,6 +198,47 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
|
|||
mode: Elm.Win.Keyboard_Mode; [[The mode, one of #Elm_Win_Keyboard_Mode.]]
|
||||
}
|
||||
}
|
||||
@property wm_available_rotations {
|
||||
set {
|
||||
[[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.
|
||||
|
||||
@since 1.9
|
||||
]]
|
||||
legacy: elm_win_wm_rotation_available_rotations_set;
|
||||
values {
|
||||
rotations: const(int)*; [[The array of rotation value.]]
|
||||
count: uint; [[The size of the rotations array.]]
|
||||
}
|
||||
}
|
||||
get {
|
||||
[[Get the array of available window rotations.
|
||||
|
||||
This function is used to get the available rotations.
|
||||
|
||||
@since 1.9
|
||||
]]
|
||||
legacy: elm_win_wm_rotation_available_rotations_get;
|
||||
values {
|
||||
rotations: int*; [[The array of rotation value.]]
|
||||
count: uint; [[The size of the rotations array.]]
|
||||
}
|
||||
return: bool;
|
||||
}
|
||||
}
|
||||
@property screen_rotation {
|
||||
get {
|
||||
[[Get the rotation of the screen.
|
||||
|
||||
Most engines only return multiples of 90.
|
||||
@since 1.19
|
||||
]]
|
||||
return: int;
|
||||
}
|
||||
}
|
||||
@property autodel {
|
||||
set {
|
||||
[[Set the window's autodel state.
|
||||
|
@ -259,37 +300,6 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
|
|||
iconified: bool; [[If true, the window is iconified.]]
|
||||
}
|
||||
}
|
||||
@property wm_available_rotations {
|
||||
set {
|
||||
[[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.
|
||||
|
||||
@since 1.9
|
||||
]]
|
||||
legacy: elm_win_wm_rotation_available_rotations_set;
|
||||
values {
|
||||
rotations: const(int)*; [[The array of rotation value.]]
|
||||
count: uint; [[The size of the rotations array.]]
|
||||
}
|
||||
}
|
||||
get {
|
||||
[[Get the array of available window rotations.
|
||||
|
||||
This function is used to get the available rotations.
|
||||
|
||||
@since 1.9
|
||||
]]
|
||||
legacy: elm_win_wm_rotation_available_rotations_get;
|
||||
values {
|
||||
rotations: int*; [[The array of rotation value.]]
|
||||
count: uint; [[The size of the rotations array.]]
|
||||
}
|
||||
return: bool;
|
||||
}
|
||||
}
|
||||
@property maximized {
|
||||
set {
|
||||
[[Set the maximized state of a window.]]
|
||||
|
@ -520,27 +530,6 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
|
|||
urgent: bool; [[If true, the window is urgent.]]
|
||||
}
|
||||
}
|
||||
@property rotation {
|
||||
set {
|
||||
[[Set the rotation of the window.
|
||||
|
||||
Most engines only work with multiples of 90.
|
||||
|
||||
This function is used to set the orientation of the window
|
||||
$obj to match that of the screen. The window itself will be
|
||||
resized to adjust to the new geometry of its contents. If
|
||||
you want to keep the window size,
|
||||
see @.rotation_with_resize.set.
|
||||
]]
|
||||
}
|
||||
get {
|
||||
[[Get the rotation of the window.]]
|
||||
}
|
||||
values {
|
||||
rotation: int; [[The rotation of the window, in degrees (0-360),
|
||||
counter-clockwise.]]
|
||||
}
|
||||
}
|
||||
@property icon_object {
|
||||
set {
|
||||
[[Set a window object's icon.
|
||||
|
@ -633,31 +622,6 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
|
|||
demand_attention: bool; [[If true, the window is demand_attention.]]
|
||||
}
|
||||
}
|
||||
@property wm_preferred_rotation {
|
||||
set {
|
||||
[[Set the preferred rotation value.
|
||||
|
||||
This function is used to set the orientation of window
|
||||
$obj to spicific angle fixed.
|
||||
|
||||
@since 1.9
|
||||
]]
|
||||
legacy: null;
|
||||
}
|
||||
get {
|
||||
[[Get the preferred rotation value.
|
||||
|
||||
This function is used to get the preferred rotoation value.
|
||||
|
||||
@since 1.9
|
||||
]]
|
||||
legacy: elm_win_wm_rotation_preferred_rotation_get;
|
||||
}
|
||||
values {
|
||||
rotation: int; [[The preferred rotation of the window in degrees
|
||||
(0-360), counter-clockwise.]]
|
||||
}
|
||||
}
|
||||
@property layer {
|
||||
set {
|
||||
[[Set the layer of the window.
|
||||
|
@ -748,19 +712,6 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
|
|||
h: int; [[The base height.]]
|
||||
}
|
||||
}
|
||||
@property rotation_with_resize {
|
||||
set {
|
||||
[[Rotates the window and resizes it.
|
||||
|
||||
Like @.rotation.set, but it also resizes the window's
|
||||
contents so that they fit inside the current window geometry.
|
||||
]]
|
||||
}
|
||||
values {
|
||||
rotation: int; [[The rotation of the window in degrees (0-360),
|
||||
counter-clockwise.]]
|
||||
}
|
||||
}
|
||||
@property prop_focus_skip {
|
||||
set {
|
||||
[[Set the window to be skipped by keyboard focus.
|
||||
|
@ -794,22 +745,6 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
|
|||
y: int; [[The int to store the y coordinate to.]]
|
||||
}
|
||||
}
|
||||
@property wm_rotation_supported {
|
||||
get {
|
||||
[[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.
|
||||
|
||||
See also @.wm_preferred_rotation, @.wm_available_rotations.
|
||||
|
||||
@since 1.9
|
||||
]]
|
||||
return: bool;
|
||||
}
|
||||
}
|
||||
@property focus {
|
||||
get {
|
||||
[[Get whether a window has focus.]]
|
||||
|
|
|
@ -259,7 +259,7 @@ EAPI Ecore_Win32_Window *elm_win_win32_window_get(const Evas_Object *obj);
|
|||
* ingroup Elm_Win
|
||||
* @since 1.9
|
||||
*/
|
||||
EAPI void elm_win_wm_rotation_preferred_rotation_set(const Evas_Object *obj, int rotation);
|
||||
EAPI void elm_win_wm_rotation_preferred_rotation_set(Evas_Object *obj, int rotation);
|
||||
|
||||
/**
|
||||
* Get the Ecore_Window of an Evas_Object
|
||||
|
@ -606,3 +606,72 @@ EAPI Eina_Bool elm_win_wm_rotation_manual_rotation_done_get(const Evas_Object *o
|
|||
*/
|
||||
EAPI void elm_win_wm_rotation_manual_rotation_done(Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Set the rotation of the window.
|
||||
*
|
||||
* Most engines only work with multiples of 90.
|
||||
*
|
||||
* This function is used to set the orientation of the window @c obj to match
|
||||
* that of the screen. The window itself will be resized to adjust to the new
|
||||
* geometry of its contents. If you want to keep the window size, see
|
||||
* @ref elm_win_rotation_with_resize_set.
|
||||
*
|
||||
* @param[in] rotation The rotation of the window, in degrees (0-360),
|
||||
* counter-clockwise.
|
||||
*
|
||||
* @ingroup Elm_Win
|
||||
*/
|
||||
EAPI void elm_win_rotation_set(Evas_Object *obj, int rotation);
|
||||
|
||||
/**
|
||||
* @brief Get the rotation of the window.
|
||||
*
|
||||
* @return The rotation of the window, in degrees (0-360), counter-clockwise.
|
||||
*
|
||||
* @ingroup Elm_Win
|
||||
*/
|
||||
EAPI int elm_win_rotation_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Rotates the window and resizes it.
|
||||
*
|
||||
* Like @ref elm_win_rotation_set, but it also resizes the window's contents so
|
||||
* that they fit inside the current window geometry.
|
||||
*
|
||||
* @param[in] rotation The rotation of the window in degrees (0-360),
|
||||
* counter-clockwise.
|
||||
*
|
||||
* @ingroup Elm_Win
|
||||
*/
|
||||
EAPI void elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation);
|
||||
|
||||
/**
|
||||
* @brief 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.
|
||||
*
|
||||
* See also @ref elm_win_wm_rotation_preferred_rotation_get,
|
||||
* @ref elm_win_wm_rotation_available_rotations_get.
|
||||
*
|
||||
* @since 1.9
|
||||
*
|
||||
* @ingroup Elm_Win
|
||||
*/
|
||||
EAPI Eina_Bool elm_win_wm_rotation_supported_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Get the preferred rotation value.
|
||||
*
|
||||
* This function is used to get the preferred rotoation value.
|
||||
*
|
||||
* @return The preferred rotation of the window in degrees (0-360),
|
||||
* counter-clockwise.
|
||||
*
|
||||
* @since 1.9
|
||||
*
|
||||
* @ingroup Elm_Win
|
||||
*/
|
||||
EAPI int elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj);
|
||||
|
||||
|
|
Loading…
Reference in New Issue