{
unsigned int win;
unsigned int angle;
+ int w, h;
};
struct _Ecore_Wl_Event_Window_Show
EAPI void ecore_wl_window_rotation_preferred_rotation_set(Ecore_Wl_Window *win, int rot);
EAPI void ecore_wl_window_rotation_available_rotations_set(Ecore_Wl_Window *win, const int *rots, unsigned int count);
+EAPI void ecore_wl_window_rotation_change_done_send(Ecore_Wl_Window *win);
+EAPI void ecore_wl_window_rotation_geometry_set(Ecore_Wl_Window *win, int rot, int x, int y, int w, int h);
#ifdef __cplusplus
}
struct tizen_rotation *tz_rotation;
struct tizen_resource *tz_resource;
unsigned int resource_id;
+ unsigned int tz_rotation_serial;
struct wl_region *opaque_region;
struct wl_region *input_region;
#include <xdg-shell-client-protocol.h>
#include <tizen-extension-client-protocol.h>
+typedef struct _Rotation_Geometry Rotation_Geometry;
+
+struct _Rotation_Geometry
+{
+ enum tizen_rotation_angle angle;
+ int x, y, w, h;
+};
+
/* local function prototypes */
static void _ecore_wl_window_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface, unsigned int serial);
static void _ecore_wl_window_cb_configure(void *data, struct wl_shell_surface *shell_surface EINA_UNUSED, unsigned int edges, int w, int h);
static void _ecore_wl_window_cb_visibility_change(void *data, struct tizen_visibility *tizen_visibility, uint32_t visibility);
static void _ecore_wl_window_cb_position_change(void *data, struct tizen_position *tizen_position, int32_t x, int32_t y);
static void _ecore_wl_window_cb_available_angles_done(void *data, struct tizen_rotation *tizen_rotation, uint32_t angles);
-static void _ecore_wl_window_cb_preferred_angles_done(void *data, struct tizen_rotation *tizen_rotation, uint32_t angles);
-static void _ecore_wl_window_cb_angle_change(void *data, struct tizen_rotation *tizen_rotation, uint32_t angle, uint32_t serial);
+static void _ecore_wl_window_cb_preferred_angle_done(void *data, struct tizen_rotation *tizen_rotation, uint32_t angle);
+static void _ecore_wl_window_cb_angle_change(void *data, struct tizen_rotation *tizen_rotation, uint32_t angle, int32_t width, int32_t height, uint32_t serial);
static void _ecore_wl_window_cb_resource_id(void *data, struct tizen_resource *tizen_resource, uint32_t id);
/* local variables */
static const struct tizen_rotation_listener _ecore_tizen_rotation_listener =
{
_ecore_wl_window_cb_available_angles_done,
- _ecore_wl_window_cb_preferred_angles_done,
+ _ecore_wl_window_cb_preferred_angle_done,
_ecore_wl_window_cb_angle_change,
};
EAPI void
ecore_wl_window_rotation_preferred_rotation_set(Ecore_Wl_Window *win, int rot)
{
- enum tizen_rotation_angle angle;
+ enum tizen_rotation_angle angle = TIZEN_ROTATION_ANGLE_NONE;
if (!win) return;
if (!win->tz_rotation) return;
angle = TIZEN_ROTATION_ANGLE_270;
break;
default:
- angle = TIZEN_ROTATION_ANGLE_0;
break;
}
- tizen_rotation_set_preferred_angles(win->tz_rotation, (uint32_t)angle);
+ tizen_rotation_set_preferred_angle(win->tz_rotation, (uint32_t)angle);
}
EAPI void
tizen_rotation_set_available_angles(win->tz_rotation, angles);
}
+EAPI void
+ecore_wl_window_rotation_change_done_send(Ecore_Wl_Window *win)
+{
+ if (!win) return;
+ if (!win->tz_rotation) return;
+
+ tizen_rotation_ack_angle_change(win->tz_rotation, win->tz_rotation_serial);
+}
+
+
+EAPI void
+ecore_wl_window_rotation_geometry_set(Ecore_Wl_Window *win, int rot, int x, int y, int w, int h)
+{
+ struct wl_array geometry;
+ Rotation_Geometry *rot_geo;
+
+ if (!win) return;
+ if (!win->tz_rotation) return;
+
+ if ((rot % 90 != 0) || (rot / 90 > 3) || (rot < 0)) return;
+
+ wl_array_init(&geometry);
+ rot_geo = (Rotation_Geometry *)wl_array_add(&geometry, sizeof(Rotation_Geometry));
+
+ if (!rot_geo)
+ {
+ wl_array_release(&geometry);
+ return;
+ }
+
+ switch (rot)
+ {
+ case 0:
+ rot_geo->angle = TIZEN_ROTATION_ANGLE_0;
+ break;
+ case 90:
+ rot_geo->angle = TIZEN_ROTATION_ANGLE_90;
+ break;
+ case 180:
+ rot_geo->angle = TIZEN_ROTATION_ANGLE_180;
+ break;
+ case 270:
+ rot_geo->angle = TIZEN_ROTATION_ANGLE_270;
+ break;
+ default:
+ break;
+ }
+
+ rot_geo->x = x;
+ rot_geo->y = y;
+ rot_geo->w = w;
+ rot_geo->h = h;
+
+ tizen_rotation_set_geometry_hints(win->tz_rotation, &geometry);
+
+ wl_array_release(&geometry);
+}
+
/* local functions */
static void
_ecore_wl_window_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface, unsigned int serial)
}
static void
-_ecore_wl_window_cb_preferred_angles_done(void *data,
- struct tizen_rotation *tizen_rotation,
- uint32_t angles)
+_ecore_wl_window_cb_preferred_angle_done(void *data,
+ struct tizen_rotation *tizen_rotation,
+ uint32_t angle)
{
return;
}
_ecore_wl_window_cb_angle_change(void *data,
struct tizen_rotation *tizen_rotation,
uint32_t angle,
+ int32_t width,
+ int32_t height,
uint32_t serial)
{
Ecore_Wl_Window *win;
if (!(win = data)) return;
if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Window_Rotate)))) return;
+ win->tz_rotation_serial = serial;
+
ev->win = win->id;
+ ev->w = width;
+ ev->h = height;
switch (angle)
{
#ifndef TIZEN_ROTATION_ANGLE_ENUM
#define TIZEN_ROTATION_ANGLE_ENUM
enum tizen_rotation_angle {
+ TIZEN_ROTATION_ANGLE_NONE = 0,
TIZEN_ROTATION_ANGLE_0 = 1,
TIZEN_ROTATION_ANGLE_90 = 2,
TIZEN_ROTATION_ANGLE_180 = 4,
struct tizen_rotation *tizen_rotation,
uint32_t angles);
/**
- * preferred_angles_done - (none)
- * @angles: (none)
+ * preferred_angle_done - (none)
+ * @angle: (none)
*/
- void (*preferred_angles_done)(void *data,
- struct tizen_rotation *tizen_rotation,
- uint32_t angles);
+ void (*preferred_angle_done)(void *data,
+ struct tizen_rotation *tizen_rotation,
+ uint32_t angle);
/**
* angle_change - suggest a angle_change
* @angle: (none)
+ * @width: (none)
+ * @height: (none)
* @serial: (none)
*
*
void (*angle_change)(void *data,
struct tizen_rotation *tizen_rotation,
uint32_t angle,
+ int32_t width,
+ int32_t height,
uint32_t serial);
};
}
#define TIZEN_ROTATION_SET_AVAILABLE_ANGLES 0
-#define TIZEN_ROTATION_SET_PREFERRED_ANGLES 1
+#define TIZEN_ROTATION_SET_PREFERRED_ANGLE 1
#define TIZEN_ROTATION_ACK_ANGLE_CHANGE 2
+#define TIZEN_ROTATION_SET_GEOMETRY_HINTS 3
static inline void
tizen_rotation_set_user_data(struct tizen_rotation *tizen_rotation, void *user_data)
}
static inline void
-tizen_rotation_set_preferred_angles(struct tizen_rotation *tizen_rotation, uint32_t angles)
+tizen_rotation_set_preferred_angle(struct tizen_rotation *tizen_rotation, uint32_t angle)
{
wl_proxy_marshal((struct wl_proxy *) tizen_rotation,
- TIZEN_ROTATION_SET_PREFERRED_ANGLES, angles);
+ TIZEN_ROTATION_SET_PREFERRED_ANGLE, angle);
}
static inline void
TIZEN_ROTATION_ACK_ANGLE_CHANGE, serial);
}
+static inline void
+tizen_rotation_set_geometry_hints(struct tizen_rotation *tizen_rotation, struct wl_array *geometry_hints)
+{
+ wl_proxy_marshal((struct wl_proxy *) tizen_rotation,
+ TIZEN_ROTATION_SET_GEOMETRY_HINTS, geometry_hints);
+}
+
#ifdef __cplusplus
}
#endif
static const struct wl_interface *types[] = {
NULL,
NULL,
+ NULL,
+ NULL,
&tizen_rotation_interface,
&wl_surface_interface,
};
static const struct wl_message tizen_policy_ext_requests[] = {
- { "get_rotation", "no", types + 2 },
+ { "get_rotation", "no", types + 4 },
};
WL_EXPORT const struct wl_interface tizen_policy_ext_interface = {
static const struct wl_message tizen_rotation_requests[] = {
{ "set_available_angles", "u", types + 0 },
- { "set_preferred_angles", "u", types + 0 },
+ { "set_preferred_angle", "u", types + 0 },
{ "ack_angle_change", "u", types + 0 },
+ { "set_geometry_hints", "a", types + 0 },
};
static const struct wl_message tizen_rotation_events[] = {
{ "available_angles_done", "u", types + 0 },
- { "preferred_angles_done", "u", types + 0 },
- { "angle_change", "uu", types + 0 },
+ { "preferred_angle_done", "u", types + 0 },
+ { "angle_change", "uiiu", types + 0 },
};
WL_EXPORT const struct wl_interface tizen_rotation_interface = {
"tizen_rotation", 1,
- 3, tizen_rotation_requests,
+ 4, tizen_rotation_requests,
3, tizen_rotation_events,
};
static void _ecore_evas_wayland_alpha_do(Ecore_Evas *ee, int alpha);
static void _ecore_evas_wayland_transparent_do(Ecore_Evas *ee, int transparent);
static void _ecore_evas_wl_common_border_update(Ecore_Evas *ee);
+static Eina_Bool _ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout(void *data);
+static void _ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout_update(Ecore_Evas *ee);
/* Frame listener */
static void _ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback, uint32_t tm);
{
Ecore_Evas *ee;
Ecore_Wl_Event_Window_Rotate *ev;
- int resize;
+ Ecore_Evas_Engine_Wl_Data *wdata;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ee) return ECORE_CALLBACK_PASS_ON;
if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
- //FIXME: resize
- resize = 0;
+ wdata = ee->engine.data;
+ if (!wdata) return ECORE_CALLBACK_PASS_ON;
+
+ if ((!ee->prop.wm_rot.supported) || (!ee->prop.wm_rot.app_set))
+ return ECORE_CALLBACK_PASS_ON;
+
+ wdata->wm_rot.request = 1;
+ wdata->wm_rot.done = 0;
+
+ if ((ee->w != ev->w) || (ee->h != ev->h))
+ {
+ _ecore_evas_wl_common_resize(ee, ev->w , ev->h);
+ }
+
+ if (ee->prop.wm_rot.manual_mode.set)
+ {
+ ee->prop.wm_rot.manual_mode.wait_for_done = EINA_TRUE;
+ _ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout_update(ee);
+ }
if (!strcmp(ee->driver, "wayland_shm"))
{
#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
- _ecore_evas_wayland_shm_window_rotate(ee, ev->angle, resize);
+ _ecore_evas_wayland_shm_window_rotate(ee, ev->angle, 1);
#endif
}
else if (!strcmp(ee->driver, "wayland_egl"))
{
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
- _ecore_evas_wayland_egl_window_rotate(ee, ev->angle, resize);
+ _ecore_evas_wayland_egl_window_rotate(ee, ev->angle, 1);
#endif
}
+ wdata->wm_rot.done = 1;
+
+ /* Fixme: rotation done send move to render flush */
+ if (!ee->prop.wm_rot.manual_mode.set)
+ {
+ wdata->wm_rot.request = 0;
+ wdata->wm_rot.done = 0;
+ ecore_wl_window_rotation_change_done_send(wdata->win);
+ }
+
return ECORE_CALLBACK_PASS_ON;
}
}
}
+static void
+_ecore_evas_wl_common_wm_rot_manual_rotation_done_job(void *data)
+{
+ Ecore_Evas *ee = (Ecore_Evas *)data;
+ Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
+
+ wdata->wm_rot.manual_mode_job = NULL;
+ ee->prop.wm_rot.manual_mode.wait_for_done = EINA_FALSE;
+
+ ecore_wl_window_rotation_change_done_send(wdata->win);
+
+ wdata->wm_rot.done = 0;
+}
+
+static Eina_Bool
+_ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout(void *data)
+{
+ Ecore_Evas *ee = data;
+
+ ee->prop.wm_rot.manual_mode.timer = NULL;
+ _ecore_evas_wl_common_wm_rot_manual_rotation_done(ee);
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout_update(Ecore_Evas *ee)
+{
+ if (ee->prop.wm_rot.manual_mode.timer)
+ ecore_timer_del(ee->prop.wm_rot.manual_mode.timer);
+
+ ee->prop.wm_rot.manual_mode.timer = ecore_timer_add
+ (4.0f, _ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout, ee);
+}
+
void
_ecore_evas_wl_common_wm_rot_manual_rotation_done_set(Ecore_Evas *ee, Eina_Bool set)
{
if (ee->prop.wm_rot.manual_mode.timer)
ecore_timer_del(ee->prop.wm_rot.manual_mode.timer);
ee->prop.wm_rot.manual_mode.timer = NULL;
- //Fixme: Add wayland rotation done timer
+
+ if (wdata->wm_rot.manual_mode_job)
+ ecore_job_del(wdata->wm_rot.manual_mode_job);
+ wdata->wm_rot.manual_mode_job = ecore_job_add
+ (_ecore_evas_wl_common_wm_rot_manual_rotation_done_job, ee);
}
}
}
if (!strcmp(global->interface, "tizen_policy_ext"))
{
ee->prop.wm_rot.supported = 1;
+ wdata->wm_rot.supported = 1;
break;
}
}
#endif
Eina_Bool frame_pending : 1;
struct wl_callback *frame_callback;
+ struct
+ {
+ unsigned char supported: 1;
+ unsigned char request : 1;
+ unsigned char done : 1;
+ Ecore_Job *manual_mode_job;
+ } wm_rot;
};
Ecore_Evas_Interface_Wayland *_ecore_evas_wl_interface_new(void);
if (!strcmp(global->interface, "tizen_policy_ext"))
{
ee->prop.wm_rot.supported = 1;
+ wdata->wm_rot.supported = 1;
break;
}
}