*/
EAPI const char *ecore_evas_profile_get(const Ecore_Evas *ee);
-EAPI Eina_Bool ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee);
-EAPI int ecore_evas_wm_rotation_get(const Ecore_Evas *ee);
+EAPI Eina_Bool ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee);
+EAPI void ecore_evas_wm_rotation_preferred_rotation_set(Ecore_Evas *ee, int rotation);
+EAPI int ecore_evas_wm_rotation_preferred_rotation_get(const Ecore_Evas *ee);
+EAPI void ecore_evas_wm_rotation_available_rotations_set(Ecore_Evas *ee, const int *rotations, unsigned int count);
+EAPI Eina_Bool ecore_evas_wm_rotation_available_rotations_get(const Ecore_Evas *ee, int **rotations, unsigned int *count);
+
/**
* @brief Send message to parent ecore
*
return ee->prop.wm_rot.supported;
}
+EAPI void
+ecore_evas_wm_rotation_preferred_rotation_set(Ecore_Evas *ee, int rotation)
+{
+ if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+ {
+ ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+ "ecore_evas_wm_rotation_preferred_rotation_set");
+ return;
+ }
+ if (rotation != -1)
+ {
+ if (ee->prop.wm_rot.available_rots)
+ {
+ Eina_Bool found = EINA_FALSE;
+ unsigned int i;
+ for (i = 0; i < ee->prop.wm_rot.count; i++)
+ {
+ if (ee->prop.wm_rot.available_rots[i] == rotation)
+ {
+ found = EINA_TRUE;
+ break;
+ }
+ }
+ if (!found) return;
+ }
+ }
+ IFC(ee, fn_wm_rot_preferred_rotation_set) (ee, rotation);
+ IFE;
+}
+
EAPI int
-ecore_evas_wm_rotation_get(const Ecore_Evas *ee)
+ecore_evas_wm_rotation_preferred_rotation_get(const Ecore_Evas *ee)
{
if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
{
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
- "ecore_evas_wm_rotation_get");
+ "ecore_evas_wm_rotation_preferred_rotation_get");
return 0;
}
- return ee->prop.wm_rot.angle;
+ return ee->prop.wm_rot.rot;
+}
+
+EAPI void
+ecore_evas_wm_rotation_available_rotations_set(Ecore_Evas *ee, const int *rotations, unsigned int count)
+{
+ if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+ {
+ ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+ "ecore_evas_wm_rotation_available_rotations_set");
+ return;
+ }
+ IFC(ee, fn_wm_rot_available_rotations_set) (ee, rotations, count);
+ IFE;
+}
+
+EAPI Eina_Bool
+ecore_evas_wm_rotation_available_rotations_get(const Ecore_Evas *ee, int **rotations, unsigned int *count)
+{
+ if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+ {
+ ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+ "ecore_evas_wm_rotation_available_rotations_get");
+ return EINA_FALSE;
+ }
+ if ((!rotations) || (!count))
+ return EINA_FALSE;
+
+ if ((!ee->prop.wm_rot.available_rots) || (ee->prop.wm_rot.count == 0))
+ return EINA_FALSE;
+
+ *rotations = calloc(ee->prop.wm_rot.count, sizeof(int));
+ if (!*rotations) return EINA_FALSE;
+
+ memcpy(*rotations, ee->prop.wm_rot.available_rots, sizeof(int) * ee->prop.wm_rot.count);
+ *count = ee->prop.wm_rot.count;
+
+ return EINA_TRUE;
}
EAPI void
ee->prop.name = NULL;
if (ee->prop.clas) free(ee->prop.clas);
ee->prop.clas = NULL;
+ if (ee->prop.wm_rot.available_rots) free(ee->prop.wm_rot.available_rots);
+ ee->prop.wm_rot.available_rots = NULL;
if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
ee->prop.cursor.object = NULL;
if (ee->evas) evas_free(ee->evas);
NULL, // screen_geometry_get
NULL, // screen_dpi_get
_ecore_evas_buffer_msg_parent_send,
- _ecore_evas_buffer_msg_send
+ _ecore_evas_buffer_msg_send,
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
#endif
NULL,
NULL, // screen_dpi_get
NULL,
- NULL // msg_send
+ NULL, // msg_send
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
#endif
NULL, // render
NULL, // screen_geometry_get
- NULL // screen_dpi_get
+ NULL, // screen_dpi_get
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
#endif
_ecore_evas_ews_screen_geometry_get,
NULL, // screen_dpi_get
NULL,
- NULL // msg_send
+ NULL, // msg_send
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
void
NULL, // screen_geometry_get
NULL, // screen_dpi_get
_ecore_evas_extn_plug_msg_parent_send,
- NULL // msg_send
+ NULL, // msg_send
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
static Eina_Bool
NULL, // screen_geometry_get
NULL, // screen_dpi_get
NULL,
- NULL // msg_send
+ NULL, // msg_send
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
#endif
void (*fn_screen_dpi_get) (const Ecore_Evas *ee, int *xdpi, int *ydpi);
void (*fn_msg_parent_send) (Ecore_Evas *ee, int maj, int min, void *data, int size);
void (*fn_msg_send) (Ecore_Evas *ee, int maj, int min, void *data, int size);
+
+ void (*fn_wm_rot_preferred_rotation_set) (Ecore_Evas *ee, int rot);
+ void (*fn_wm_rot_available_rotations_set) (Ecore_Evas *ee, const int *rots, unsigned int count);
};
struct _Ecore_Evas_Engine
char *profile;
struct {
Eina_Bool supported;
- int angle;
- Eina_Bool win_resize;
- int w, h;
+ int angle; // v0
+ Eina_Bool win_resize; // v0
+ int w, h; // v0
+ // added for the window manager rotation protocol
+ Eina_Bool app_set; // v1: app wants to communicate with the window manager to rotate
+ int rot; // v1: decided rotation by the window manager
+ int preferred_rot; // v1: app specified rotation
+ int *available_rots;// v1: app specified available rotations
+ unsigned int count; // v1: number of elements of available rotations
} wm_rot;
struct {
int w, h;
_ecore_evas_screen_geometry_get, // screen_geometry_get
NULL, // screen_dpi_get
NULL,
- NULL //msg_send
+ NULL, //msg_send
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
EAPI Ecore_Evas *
NULL, // screen_geometry_get
NULL, // screen_dpi_get
NULL,
- NULL // msg_send
+ NULL, // msg_send
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
static Ecore_Evas*
_ecore_evas_wl_common_screen_geometry_get,
_ecore_evas_wl_common_screen_dpi_get,
NULL,
- NULL // msg_send
+ NULL, // msg_send
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
/* external variables */
NULL, // focus skip set
_ecore_evas_wl_render,
_ecore_evas_wl_common_screen_geometry_get,
- _ecore_evas_wl_common_screen_dpi_get
+ _ecore_evas_wl_common_screen_dpi_get,
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
/* external variables */
NULL, // screen_geometry_get
_ecore_evas_win32_screen_dpi_get,
NULL,
- NULL // msg_send
+ NULL, // msg_send
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
#endif /* BUILD_ECORE_EVAS_WIN32 */
NULL, // render
NULL, // screen_geometry_get
- _ecore_evas_wince_screen_dpi_get
+ _ecore_evas_wince_screen_dpi_get,
+
+ NULL, // wm_rot_preferred_rotation_set
+ NULL // wm_rot_available_rotations_set
};
/* API */
return ECORE_CALLBACK_PASS_ON;
if (ee->prop.wm_rot.supported)
{
- ee->prop.wm_rot.angle = (int)e->data.l[1];
- ee->prop.wm_rot.win_resize = (int)e->data.l[2];
- ee->prop.wm_rot.w = (int)e->data.l[3];
- ee->prop.wm_rot.h = (int)e->data.l[4];
- if (ee->prop.wm_rot.win_resize)
- ee->engine.x.wm_rot.configure_coming = 1;
- ee->engine.x.wm_rot.prepare = 1;
- ee->engine.x.wm_rot.request = 0;
- ee->engine.x.wm_rot.done = 0;
+ if (ee->prop.wm_rot.app_set)
+ {
+ // v1
+ ee->prop.wm_rot.angle = (int)e->data.l[1];
+ ee->prop.wm_rot.win_resize = (int)e->data.l[2];
+ ee->prop.wm_rot.w = (int)e->data.l[3];
+ ee->prop.wm_rot.h = (int)e->data.l[4];
+ if (ee->prop.wm_rot.win_resize)
+ ee->engine.x.wm_rot.configure_coming = 1;
+ ee->engine.x.wm_rot.prepare = 1;
+ ee->engine.x.wm_rot.request = 0;
+ ee->engine.x.wm_rot.done = 0;
+ }
+ else
+ {
+ // v0
+ ee->prop.wm_rot.angle = (int)e->data.l[1];
+ ee->prop.wm_rot.win_resize = (int)e->data.l[2];
+ ee->prop.wm_rot.w = (int)e->data.l[3];
+ ee->prop.wm_rot.h = (int)e->data.l[4];
+ if (ee->prop.wm_rot.win_resize)
+ ee->engine.x.wm_rot.configure_coming = 1;
+ ee->engine.x.wm_rot.prepare = 1;
+ ee->engine.x.wm_rot.request = 0;
+ ee->engine.x.wm_rot.done = 0;
+ }
}
}
else if (e->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
return ECORE_CALLBACK_PASS_ON;
if (ee->prop.wm_rot.supported)
{
- ee->engine.x.wm_rot.prepare = 0;
- ee->engine.x.wm_rot.request = 1;
- ee->engine.x.wm_rot.done = 0;
- if (ee->prop.wm_rot.win_resize)
+ if (ee->prop.wm_rot.app_set)
{
- if ((ee->w == ee->prop.wm_rot.w) &&
- (ee->h == ee->prop.wm_rot.h))
+ // v1
+ ee->engine.x.wm_rot.prepare = 0;
+ ee->engine.x.wm_rot.request = 1;
+ ee->engine.x.wm_rot.done = 0;
+ if (ee->prop.wm_rot.win_resize)
{
- ee->engine.x.wm_rot.configure_coming = 0;
+ if ((ee->w == ee->prop.wm_rot.w) &&
+ (ee->h == ee->prop.wm_rot.h))
+ {
+ ee->engine.x.wm_rot.configure_coming = 0;
+ }
}
+ if (!ee->engine.x.wm_rot.configure_coming)
+ _ecore_evas_x_rotation_set(ee, ee->prop.wm_rot.angle, 1);
}
- if (!ee->engine.x.wm_rot.configure_coming)
+ else
{
- if (ee->prop.wm_rot.angle == ee->rotation)
+ ee->engine.x.wm_rot.prepare = 0;
+ ee->engine.x.wm_rot.request = 1;
+ ee->engine.x.wm_rot.done = 0;
+ if (ee->prop.wm_rot.win_resize)
{
- if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
- ee->engine.x.wm_rot.request = 0;
- ee->engine.x.wm_rot.done = 1;
+ if ((ee->w == ee->prop.wm_rot.w) &&
+ (ee->h == ee->prop.wm_rot.h))
+ {
+ ee->engine.x.wm_rot.configure_coming = 0;
+ }
+ }
+ if (!ee->engine.x.wm_rot.configure_coming)
+ {
+ if (ee->prop.wm_rot.angle == ee->rotation)
+ {
+ if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
+ ee->engine.x.wm_rot.request = 0;
+ ee->engine.x.wm_rot.done = 1;
+ }
}
}
}
{
if (ee->prop.wm_rot.supported)
{
- if (ee->engine.x.wm_rot.request)
+ if (ee->prop.wm_rot.app_set)
{
- if (ee->prop.wm_rot.win_resize)
+ // v1
+ if (ee->engine.x.wm_rot.request)
{
- if (!((ee->w == ee->prop.wm_rot.w) && (ee->h == ee->prop.wm_rot.h)))
+ if (ee->prop.wm_rot.win_resize)
{
- return EINA_FALSE;
+ if (!((ee->w == ee->prop.wm_rot.w) && (ee->h == ee->prop.wm_rot.h)))
+ {
+ return EINA_FALSE;
+ }
+ else
+ ee->engine.x.wm_rot.configure_coming = 0;
+ }
+ }
+ }
+ else
+ {
+ if (ee->engine.x.wm_rot.request)
+ {
+ if (ee->prop.wm_rot.win_resize)
+ {
+ if (!((ee->w == ee->prop.wm_rot.w) && (ee->h == ee->prop.wm_rot.h)))
+ {
+ return EINA_FALSE;
+ }
+ else
+ ee->engine.x.wm_rot.configure_coming = 0;
}
- else
- ee->engine.x.wm_rot.configure_coming = 0;
}
}
}
{
if (ee->prop.wm_rot.supported)
{
- if (ee->engine.x.wm_rot.request)
+ // v1
+ if (ee->prop.wm_rot.app_set)
{
- if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
- ee->engine.x.wm_rot.request = 0;
- ee->engine.x.wm_rot.done = 1;
+ if (ee->engine.x.wm_rot.request)
+ {
+ if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
+ ee->engine.x.wm_rot.request = 0;
+ ee->engine.x.wm_rot.done = 1;
+ }
+ }
+ // v0
+ else
+ {
+ if (ee->engine.x.wm_rot.request)
+ {
+ if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
+ ee->engine.x.wm_rot.request = 0;
+ ee->engine.x.wm_rot.done = 1;
+ }
}
}
int angles[2] = { rotation, rotation };
}
static void
+_ecore_evas_x_wm_rot_preferred_rotation_set(Ecore_Evas *ee, int rot)
+{
+ if (ee->prop.wm_rot.supported)
+ {
+ if (!ee->prop.wm_rot.app_set)
+ {
+ ecore_x_e_window_rotation_app_set(ee->prop.window, EINA_TRUE);
+ ee->prop.wm_rot.app_set = EINA_TRUE;
+ }
+ ecore_x_e_window_rotation_preferred_rotation_set(ee->prop.window, rot);
+ ee->prop.wm_rot.preferred_rot = rot;
+ }
+}
+
+static void
+_ecore_evas_x_wm_rot_available_rotations_set(Ecore_Evas *ee, const int *rots, unsigned int count)
+{
+ if (ee->prop.wm_rot.supported)
+ {
+ if (!ee->prop.wm_rot.app_set)
+ {
+ ecore_x_e_window_rotation_app_set(ee->prop.window, EINA_TRUE);
+ ee->prop.wm_rot.app_set = EINA_TRUE;
+ }
+
+ if (ee->prop.wm_rot.available_rots)
+ {
+ free(ee->prop.wm_rot.available_rots);
+ ee->prop.wm_rot.available_rots = NULL;
+ }
+
+ ee->prop.wm_rot.count = 0;
+
+ if (count > 0)
+ {
+ ee->prop.wm_rot.available_rots = calloc(count, sizeof(int));
+ if (!ee->prop.wm_rot.available_rots) return;
+
+ memcpy(ee->prop.wm_rot.available_rots, rots, sizeof(int) * count);
+ }
+
+ ee->prop.wm_rot.count = count;
+
+ ecore_x_e_window_rotation_available_rotations_set(ee->prop.window, rots, count);
+ }
+}
+
+static void
_ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on)
{
if (ee->prop.avoid_damage == on) return;
_ecore_evas_x_screen_geometry_get,
_ecore_evas_x_screen_dpi_get,
NULL,
- NULL //fn_msg_send
+ NULL, //fn_msg_send
+
+ _ecore_evas_x_wm_rot_preferred_rotation_set,
+ _ecore_evas_x_wm_rot_available_rotations_set
};
#endif /* BUILD_ECORE_EVAS_X11 */
EAPI void ecore_x_e_window_rotation_supported_set(Ecore_X_Window root, Eina_Bool enabled);
EAPI Eina_Bool ecore_x_e_window_rotation_supported_get(Ecore_X_Window root);
-EAPI void ecore_x_e_window_available_rotations_set(Ecore_X_Window win, const int *rots, unsigned int count);
-EAPI Eina_Bool ecore_x_e_window_available_rotations_get(Ecore_X_Window win, int **rots, unsigned int *count);
-EAPI void ecore_x_e_window_preferred_rotation_set(Ecore_X_Window win, const int rot);
-EAPI Eina_Bool ecore_x_e_window_preferred_rotation_get(Ecore_X_Window win, int *rot);
+EAPI void ecore_x_e_window_rotation_app_set(Ecore_X_Window win, Eina_Bool set);
+EAPI Eina_Bool ecore_x_e_window_rotation_app_get(Ecore_X_Window win);
+EAPI void ecore_x_e_window_rotation_preferred_rotation_set(Ecore_X_Window win, int rot);
+EAPI Eina_Bool ecore_x_e_window_rotation_preferred_rotation_get(Ecore_X_Window win, int *rot);
+EAPI void ecore_x_e_window_rotation_available_rotations_set(Ecore_X_Window win, const int *rots, unsigned int count);
+EAPI Eina_Bool ecore_x_e_window_rotation_available_rotations_get(Ecore_X_Window win, int **rots, unsigned int *count);
EAPI void ecore_x_e_window_rotation_change_prepare_send(Ecore_X_Window win, int rot, Eina_Bool resize, int w, int h);
EAPI void ecore_x_e_window_rotation_change_prepare_done_send(Ecore_X_Window root, Ecore_X_Window win, int rot);
EAPI void ecore_x_e_window_rotation_change_request_send(Ecore_X_Window win, int rot);
/* E window rotation extension */
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST;
/* E window rotation extension */
EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST = 0;
{ "_E_PROFILE_LIST", &ECORE_X_ATOM_E_PROFILE_LIST },
{ "_E_WINDOW_ROTATION_SUPPORTED", &ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED },
+ { "_E_WINDOW_ROTATION_APP_SUPPORTED", &ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED },
{ "_E_WINDOW_ROTATION_AVAILABLE_LIST", &ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST },
- { "_E_WINDOW_ROTATION_PREFERRED_MODE", &ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE },
+ { "_E_WINDOW_ROTATION_PREFERRED_ROTATION", &ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION },
{ "_E_WINDOW_ROTATION_CHANGE_PREPARE", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE },
{ "_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE },
{ "_E_WINDOW_ROTATION_CHANGE_REQUEST", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST },
}
EAPI void
-ecore_x_e_window_available_rotations_set(Ecore_X_Window win,
- const int *rots,
- unsigned int count)
+ecore_x_e_window_rotation_app_set(Ecore_X_Window win,
+ Eina_Bool set)
{
+ unsigned int val = 0;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (set) val = 1;
+
ecore_x_window_prop_card32_set(win,
- ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST,
- (unsigned int *)rots, count);
+ ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED,
+ &val, 1);
}
EAPI Eina_Bool
-ecore_x_e_window_available_rotations_get(Ecore_X_Window win,
- int **rots,
- unsigned int *count)
+ecore_x_e_window_rotation_app_get(Ecore_X_Window win)
{
- unsigned char *data;
- int num;
+ unsigned int val = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED,
+ &val, 1))
+ return EINA_FALSE;
- if (count) *count = 0;
- if (rots) *rots = NULL;
- if (!win) return EINA_FALSE;
+ return val ? EINA_TRUE : EINA_FALSE;
+}
- if (!ecore_x_window_prop_property_get(win,
- ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST,
- XA_CARDINAL, 32, &data, &num))
- return EINA_FALSE;
+EAPI void
+ecore_x_e_window_rotation_preferred_rotation_set(Ecore_X_Window win,
+ int rot)
+{
+ unsigned int val = 0;
- if (count) *count = num;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (rots)
+ if (rot != -1)
{
- (*rots) = calloc(num, sizeof(int));
- if (!(*rots))
- {
- if (count) *count = 0;
- if (data) free(data);
- return EINA_FALSE;
- }
-
- memcpy(*rots, (int *)data, sizeof(int) * num);
+ val = (unsigned int)rot;
+ ecore_x_window_prop_card32_set(win,
+ ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION,
+ &val, 1);
+ }
+ else
+ {
+ ecore_x_window_prop_property_del(win,
+ ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION);
}
+}
- if (data) XFree(data);
- return EINA_TRUE;
+EAPI Eina_Bool
+ecore_x_e_window_rotation_preferred_rotation_get(Ecore_X_Window win,
+ int *rot)
+{
+ unsigned int val = 0;
+ int ret = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ret = ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION,
+ &val, 1);
+ if (ret == 1)
+ {
+ if (rot) *rot = (int)val;
+ return EINA_TRUE;
+ }
+ return EINA_FALSE;
}
EAPI void
-ecore_x_e_window_preferred_rotation_set(Ecore_X_Window win,
- int rot)
+ecore_x_e_window_rotation_available_rotations_set(Ecore_X_Window win,
+ const int *rots,
+ unsigned int count)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- ecore_x_window_prop_property_set(win,
- ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE,
- XA_CARDINAL, 32, (void *)&rot, 1);
+ if (!win) return;
+
+ if ((rots) && (count > 0))
+ ecore_x_window_prop_card32_set(win,
+ ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST,
+ (unsigned int *)rots, count);
+ else
+ ecore_x_window_prop_property_del(win,
+ ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST);
}
EAPI Eina_Bool
-ecore_x_e_window_preferred_rotation_get(Ecore_X_Window win,
- int *rot)
+ecore_x_e_window_rotation_available_rotations_get(Ecore_X_Window win,
+ int **rots,
+ unsigned int *count)
{
unsigned char *data = NULL;
- int num;
+ int num, i;
+ int *val = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!win) || (!rots) || (!count))
+ return EINA_FALSE;
+
+ *rots = NULL;
+ *count = 0;
+
if (!ecore_x_window_prop_property_get(win,
- ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE,
+ ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST,
XA_CARDINAL, 32, &data, &num))
return EINA_FALSE;
- if ((data) && (num == 1) && (rot))
+ *count = num;
+
+ if ((num >= 1) && (data))
{
- *rot = (int)(*data);
+ val = calloc(num, sizeof(int));
+ if (!val)
+ {
+ if (data) XFree(data);
+ return EINA_FALSE;
+ }
+ for (i = 0; i < num; i++)
+ val[i] = ((int *)data)[i];
if (data) XFree(data);
+ *rots = val;
return EINA_TRUE;
}
if (data) XFree(data);