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);
+EAPI void ecore_wl_window_rotation_changed_callback_set(Ecore_Wl_Window *win, void *data, void (*func)(Ecore_Wl_Window *win, int rot, Eina_Bool resize, int w, int h, void *data));
EAPI Eina_List * ecore_wl_window_aux_hints_supported_get(Ecore_Wl_Window *win);
EAPI void ecore_wl_window_aux_hint_add(Ecore_Wl_Window *win, int id, const char *hint, const char *val);
else if (!strcmp(interface, "tizen_policy_ext"))
{
ewd->wl.tz_policy_ext =
- wl_registry_bind(registry, id, &tizen_policy_ext_interface, 1);
+ wl_registry_bind(registry, id, &tizen_policy_ext_interface, 2);
if (ewd->wl.tz_policy_ext)
- tizen_policy_add_listener(_ecore_wl_disp->wl.tz_policy_ext, &_ecore_tizen_policy_ext_listener, ewd->wl.display);
+ tizen_policy_ext_add_listener(_ecore_wl_disp->wl.tz_policy_ext, &_ecore_tizen_policy_ext_listener, ewd->wl.display);
}
else if (!strcmp(interface, "tizen_surface"))
{
Ecore_Wl_Subsurf *subsurfs;
void *data;
+
+ void (*cb_rot_changed)(int win_id, int rot, Eina_Bool resize, int w, int h, void *data);
+ void *cb_rot_changed_data;
};
struct _Ecore_Wl_Input_Device
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_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, uint32_t serial);
+static void _ecore_wl_window_cb_angle_change_with_resize(void *data, struct tizen_rotation *tizen_rotation EINA_UNUSED, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height);
static void _ecore_wl_window_cb_resource_id(void *data, struct tizen_resource *tizen_resource, uint32_t id);
static void _ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified, Eina_Bool send_event);
_ecore_wl_window_cb_available_angles_done,
_ecore_wl_window_cb_preferred_angle_done,
_ecore_wl_window_cb_angle_change,
+ _ecore_wl_window_cb_angle_change_with_resize,
};
static const struct tizen_resource_listener _ecore_tizen_resource_listener =
}
}
+EAPI void
+ecore_wl_window_rotation_changed_callback_set(Ecore_Wl_Window *win, void *data, void (*func)(Ecore_Wl_Window *win, int rot, Eina_Bool resize, int w, int h, void *data))
+{
+ if (!win) return;
+ win->cb_rot_changed = func;
+ win->cb_rot_changed_data = data;
+}
+
/* local functions */
static void
_ecore_wl_window_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface, unsigned int serial)
ecore_wl_window_rotation_set(win, ev->angle);
}
+static void
+_ecore_wl_window_cb_angle_change_with_resize(void *data, struct tizen_rotation *tizen_rotation EINA_UNUSED, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height)
+{
+ Ecore_Wl_Window *win = (Ecore_Wl_Window *)data;
+ int rot = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ EINA_SAFETY_ON_NULL_RETURN(win);
+ EINA_SAFETY_ON_NULL_RETURN(win->cb_rot_changed);
+
+ win->tz_rot.serial = serial;
+
+ switch (angle)
+ {
+ case TIZEN_ROTATION_ANGLE_0: rot = 0; break;
+ case TIZEN_ROTATION_ANGLE_90: rot = 90; break;
+ case TIZEN_ROTATION_ANGLE_180: rot = 180; break;
+ case TIZEN_ROTATION_ANGLE_270: rot = 270; break;
+ default: rot = 0; break;
+ }
+
+ ecore_wl_window_rotation_set(win, rot);
+
+ win->cb_rot_changed(win, rot, 0, width, height, win->cb_rot_changed_data);
+}
+
static void
_ecore_wl_window_cb_resource_id(void *data, struct tizen_resource *tizen_resource EINA_UNUSED, uint32_t id)
{
struct tizen_policy_ext;
struct tizen_rotation;
+struct wl_surface;
extern const struct wl_interface tizen_policy_ext_interface;
extern const struct wl_interface tizen_rotation_interface;
#define TIZEN_POLICY_EXT_GET_ROTATION 0
#define TIZEN_POLICY_EXT_GET_ACTIVE_ANGLE 1
+#define TIZEN_POLICY_EXT_GET_ROTATION_SINCE_VERSION 1
+#define TIZEN_POLICY_EXT_GET_ACTIVE_ANGLE_SINCE_VERSION 1
+
static inline void
tizen_policy_ext_set_user_data(struct tizen_policy_ext *tizen_policy_ext, void *user_data)
{
return wl_proxy_get_user_data((struct wl_proxy *) tizen_policy_ext);
}
+static inline uint32_t
+tizen_policy_ext_get_version(struct tizen_policy_ext *tizen_policy_ext)
+{
+ return wl_proxy_get_version((struct wl_proxy *) tizen_policy_ext);
+}
+
static inline void
tizen_policy_ext_destroy(struct tizen_policy_ext *tizen_policy_ext)
{
struct tizen_rotation *tizen_rotation,
uint32_t angle,
uint32_t serial);
+ /**
+ * angle_change_with_resize - suggest a angle change with resize
+ * of window
+ * @angle: (none)
+ * @serial: (none)
+ * @width: (none)
+ * @height: (none)
+ *
+ *
+ * @since: 2
+ */
+ void (*angle_change_with_resize)(void *data,
+ struct tizen_rotation *tizen_rotation,
+ uint32_t angle,
+ uint32_t serial,
+ uint32_t width,
+ uint32_t height);
};
static inline int
#define TIZEN_ROTATION_SET_PREFERRED_ANGLE 2
#define TIZEN_ROTATION_ACK_ANGLE_CHANGE 3
+#define TIZEN_ROTATION_DESTROY_SINCE_VERSION 1
+#define TIZEN_ROTATION_SET_AVAILABLE_ANGLES_SINCE_VERSION 1
+#define TIZEN_ROTATION_SET_PREFERRED_ANGLE_SINCE_VERSION 1
+#define TIZEN_ROTATION_ACK_ANGLE_CHANGE_SINCE_VERSION 1
+
static inline void
tizen_rotation_set_user_data(struct tizen_rotation *tizen_rotation, void *user_data)
{
extern const struct wl_interface wl_surface_interface;
static const struct wl_interface *types[] = {
+ NULL,
+ NULL,
NULL,
NULL,
&tizen_rotation_interface,
};
static const struct wl_message tizen_policy_ext_requests[] = {
- { "get_rotation", "no", types + 2 },
- { "get_active_angle", "?o", types + 4 },
+ { "get_rotation", "no", types + 4 },
+ { "get_active_angle", "?o", types + 6 },
};
static const struct wl_message tizen_policy_ext_events[] = {
};
WL_EXPORT const struct wl_interface tizen_policy_ext_interface = {
- "tizen_policy_ext", 1,
+ "tizen_policy_ext", 2,
2, tizen_policy_ext_requests,
1, tizen_policy_ext_events,
};
{ "available_angles_done", "u", types + 0 },
{ "preferred_angle_done", "u", types + 0 },
{ "angle_change", "uu", types + 0 },
+ { "angle_change_with_resize", "2uuuu", types + 0 },
};
WL_EXPORT const struct wl_interface tizen_rotation_interface = {
- "tizen_rotation", 1,
+ "tizen_rotation", 2,
4, tizen_rotation_requests,
- 3, tizen_rotation_events,
+ 4, tizen_rotation_events,
};
}
}
+void
+_ecore_evas_wl_common_wm_rot_cb_angle_changed(Ecore_Wl_Window *win, int rot, Eina_Bool resize, int w, int h, void *data)
+{
+ Ecore_Evas *ee;
+ Ecore_Evas_Engine_Wl_Data *wdata;
+ int minw, minh, maxw, maxh;
+ int basew, baseh, stepw, steph;
+
+ ee = (Ecore_Evas *)data;
+ EINA_SAFETY_ON_NULL_RETURN(ee);
+
+ wdata = ee->engine.data;
+ EINA_SAFETY_ON_NULL_RETURN(wdata);
+
+ EINA_SAFETY_ON_FALSE_RETURN(win == wdata->win);
+
+ if ((!ee->prop.wm_rot.supported) || (!ee->prop.wm_rot.app_set))
+ return;
+
+ /* get min, max, base, & step sizes */
+ ecore_evas_size_min_get(ee, &minw, &minh);
+ ecore_evas_size_max_get(ee, &maxw, &maxh);
+ ecore_evas_size_base_get(ee, &basew, &baseh);
+ ecore_evas_size_step_get(ee, &stepw, &steph);
+
+ wdata->wm_rot.request = 1;
+ wdata->wm_rot.done = 0;
+
+ ee->rotation = rot;
+
+ _ecore_evas_wl_common_resize(ee, w, 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 (ee->in_async_render)
+ {
+ ee->delayed.rotation = rot;
+ ee->delayed.rotation_resize = resize;
+ ee->delayed.rotation_changed = EINA_TRUE;
+ return;
+ }
+
+ if (ECORE_EVAS_PORTRAIT(ee))
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
+ else
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
+
+ /* reset min, max, base, & step sizes */
+ ecore_evas_size_min_set(ee, minh, minw);
+ ecore_evas_size_max_set(ee, maxh, maxw);
+ ecore_evas_size_base_set(ee, baseh, basew);
+ ecore_evas_size_step_set(ee, steph, stepw);
+
+ /* send a mouse_move process
+ *
+ * NB: Is This Really Needed ?
+ * Yes, it's required to update the mouse position, relatively to
+ * widgets. After a rotation change, e.g., the mouse might not be over
+ * a button anymore. */
+ _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
+ ecore_loop_time_get());
+
+ if (!strcmp(ee->driver, "wayland_shm"))
+ {
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+ Evas_Engine_Info_Wayland_Shm *einfo;
+ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
+ if (!einfo) return;
+
+ einfo->info.rotation = rot;
+
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+#endif
+ }
+ else if (!strcmp(ee->driver, "wayland_egl"))
+ {
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+ Evas_Engine_Info_Wayland_Egl *einfo;
+ einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
+ if (!einfo) return;
+
+ einfo->info.rotation = rot;
+
+ /* TIZEN_ONLY(20160728):
+ wayland spec is not define whether wl_egl_window_create() can use null surface or not.
+ so current tizen device does not allow to create null surface wayland window.
+ */
+ if ((einfo->info.surface) &&
+ (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)))
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+#endif
+ }
+
+ _ecore_evas_wl_common_state_update(ee);
+
+ wdata->wm_rot.done = 1;
+}
+
void
_ecore_evas_wl_common_raise(Ecore_Evas *ee)
{
ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
ee->prop.window = ecore_wl_window_id_get(wdata->win);
+ if (wdata->win)
+ ecore_wl_window_rotation_changed_callback_set
+ (wdata->win, ee, _ecore_evas_wl_common_wm_rot_cb_angle_changed);
+
EINA_INLIST_FOREACH(globals, global)
{
if (!strcmp(global->interface, "tizen_policy_ext"))
void _ecore_evas_wl_common_wm_rot_available_rotations_set(Ecore_Evas *ee, const int *rots, unsigned int count);
void _ecore_evas_wl_common_wm_rot_manual_rotation_done_set(Ecore_Evas *ee, Eina_Bool set);
void _ecore_evas_wl_common_wm_rot_manual_rotation_done(Ecore_Evas *ee);
+void _ecore_evas_wl_common_wm_rot_cb_angle_changed(Ecore_Wl_Window *win, int rot, Eina_Bool resize, int w, int h, void *data);
int _ecore_evas_common_init_count_get(void);
ECORE_WL_WINDOW_BUFFER_TYPE_SHM);
ee->prop.window = ecore_wl_window_id_get(wdata->win);
+ if (wdata->win)
+ ecore_wl_window_rotation_changed_callback_set
+ (wdata->win, ee, _ecore_evas_wl_common_wm_rot_cb_angle_changed);
+
EINA_INLIST_FOREACH(globals, global)
{
if (!strcmp(global->interface, "tizen_policy_ext"))