aux->val = eina_stringshare_add(val);
ee->prop.aux_hint.hints = eina_list_append(ee->prop.aux_hint.hints, aux);
+ ee->prop.aux_hint.id++;
- Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
- if (buf)
+ if (!strncmp(ee->driver, "wayland", 7))
{
- if (ee->engine.func->fn_aux_hints_set)
- ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+ Ecore_Evas_Interface_Wayland *iface;
+ iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(iface, -1);
- eina_strbuf_free(buf);
-
- ee->prop.aux_hint.id++;
+ if (iface->aux_hint_add)
+ iface->aux_hint_add(ee, aux->id, hint, val);
return aux->id;
}
+ else
+ {
+ Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
+ if (buf)
+ {
+ if (ee->engine.func->fn_aux_hints_set)
+ ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+
+ eina_strbuf_free(buf);
+
+ return aux->id;
+ }
+ }
eina_stringshare_del(aux->hint);
eina_stringshare_del(aux->val);
eina_stringshare_del(aux->val);
free(aux);
- Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
- if (buf)
+ if (!strncmp(ee->driver, "wayland", 7))
{
- if (ee->engine.func->fn_aux_hints_set)
- ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+ Ecore_Evas_Interface_Wayland *iface;
+ iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(iface, -1);
- eina_strbuf_free(buf);
+ if (iface->aux_hint_del)
+ iface->aux_hint_del(ee, id);
return EINA_TRUE;
}
+ else
+ {
+ Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
+ if (buf)
+ {
+ if (ee->engine.func->fn_aux_hints_set)
+ ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+
+ eina_strbuf_free(buf);
+
+ return EINA_TRUE;
+ }
+ }
break;
}
}
aux->allowed = 0;
aux->notified = 0;
- Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
- if (buf)
+ if (!strncmp(ee->driver, "wayland", 7))
{
- if (ee->engine.func->fn_aux_hints_set)
- ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+ Ecore_Evas_Interface_Wayland *iface;
+ iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(iface, -1);
- eina_strbuf_free(buf);
+ if (iface->aux_hint_change)
+ iface->aux_hint_change(ee, id, val);
return EINA_TRUE;
}
+ else
+ {
+ Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
+ if (buf)
+ {
+ if (ee->engine.func->fn_aux_hints_set)
+ ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+
+ eina_strbuf_free(buf);
+
+ return EINA_TRUE;
+ }
+ }
break;
}
}
void (*type_set)(Ecore_Evas *ee, int type);
Ecore_Wl_Window* (*window_get)(const Ecore_Evas *ee);
void (*pre_post_swap_callback_set)(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e));
+ void (*aux_hint_add)(Ecore_Evas *ee, int id, const char *hint, const char *val);
+ void (*aux_hint_change)(Ecore_Evas *ee, int id, const char *val);
+ void (*aux_hint_del)(Ecore_Evas *ee, int id);
};
#endif
typedef struct _Ecore_Wl_Dnd_Source Ecore_Wl_Dnd_Source;
typedef struct _Ecore_Wl_Dnd_Target Ecore_Wl_Dnd_Target;
+typedef struct _Ecore_Wl_Aux_Hint Ecore_Wl_Aux_Hint;
typedef struct _Ecore_Wl_Event_Mouse_In Ecore_Wl_Event_Mouse_In;
typedef struct _Ecore_Wl_Event_Mouse_Out Ecore_Wl_Event_Mouse_Out;
typedef struct _Ecore_Wl_Event_Selection_Data_Ready Ecore_Wl_Event_Selection_Data_Ready; /** @since 1.7 */
typedef struct _Ecore_Wl_Event_Interfaces_Bound Ecore_Wl_Event_Interfaces_Bound;
typedef struct _Ecore_Wl_Event_Conformant_Change Ecore_Wl_Event_Conformant_Change;
+typedef struct _Ecore_Wl_Event_Aux_Hint_Allowed Ecore_Wl_Event_Aux_Hint_Allowed;
enum _Ecore_Wl_Window_Type
{
Eina_Bool state;
};
+struct _Ecore_Wl_Event_Aux_Hint_Allowed
+{
+ unsigned int win;
+ int id;
+};
+
/**
* @file
* @brief Ecore functions for dealing with the Wayland window system
EAPI extern int ECORE_WL_EVENT_SELECTION_DATA_READY; /** @since 1.7 */
EAPI extern int ECORE_WL_EVENT_INTERFACES_BOUND;
EAPI extern int ECORE_WL_EVENT_CONFORMANT_CHANGE;
+EAPI extern int ECORE_WL_EVENT_AUX_HINT_ALLOWED;
/**
* @defgroup Ecore_Wl_Init_Group Wayland Library Init and Shutdown Functions
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 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);
+EAPI void ecore_wl_window_aux_hint_change(Ecore_Wl_Window *win, int id, const char *val);
+EAPI void ecore_wl_window_aux_hint_del(Ecore_Wl_Window *win, int id);
+
#ifdef __cplusplus
}
#endif
static void _ecore_wl_cb_notification_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, int32_t level, uint32_t state);
static void _ecore_wl_cb_transient_for_done(void *data, struct tizen_policy *tizen_policy, uint32_t child_id);
static void _ecore_wl_cb_scr_mode_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t mode, uint32_t state);
+static void _ecore_wl_cb_supported_aux_hints(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints);
+static void _ecore_wl_cb_allowed_aux_hint(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, int id);
static void _ecore_wl_window_conformant_area_send(Ecore_Wl_Window *win, uint32_t conformant_part, uint32_t state);
/* local variables */
_ecore_wl_cb_notification_done,
_ecore_wl_cb_transient_for_done,
_ecore_wl_cb_scr_mode_done,
+ _ecore_wl_cb_supported_aux_hints,
+ _ecore_wl_cb_allowed_aux_hint,
};
static void
xdg_shell_ping(void *data EINA_UNUSED, struct xdg_shell *shell, uint32_t serial)
EAPI int ECORE_WL_EVENT_DATA_SOURCE_CANCELLED = 0;
EAPI int ECORE_WL_EVENT_INTERFACES_BOUND = 0;
EAPI int ECORE_WL_EVENT_CONFORMANT_CHANGE = 0;
+EAPI int ECORE_WL_EVENT_AUX_HINT_ALLOWED = 0;
static void
_ecore_wl_init_callback(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED)
ECORE_WL_EVENT_DATA_SOURCE_CANCELLED = ecore_event_type_new();
ECORE_WL_EVENT_INTERFACES_BOUND = ecore_event_type_new();
ECORE_WL_EVENT_CONFORMANT_CHANGE = ecore_event_type_new();
+ ECORE_WL_EVENT_AUX_HINT_ALLOWED = ecore_event_type_new();
}
if (!(_ecore_wl_disp = malloc(sizeof(Ecore_Wl_Display))))
_ecore_wl_cb_scr_mode_done(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface EINA_UNUSED, uint32_t mode EINA_UNUSED, uint32_t state EINA_UNUSED)
{
}
+
+static void
+_ecore_wl_cb_supported_aux_hints(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints)
+{
+ struct wl_surface *surface = surface_resource;
+ Ecore_Wl_Window *win = NULL;
+ char *p = NULL;
+ char **str = NULL;
+ const char *hint = NULL;
+ unsigned int i = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!surface) return;
+ win = ecore_wl_window_surface_find(surface);
+ if (!win) return;
+
+ p = hints->data;
+ str = calloc(num_hints, sizeof(char *));
+ if (!str) return;
+
+ while ((const char *)p < ((const char *)hints->data + hints->size))
+ {
+ str[i] = (char *)eina_stringshare_add(p);
+ p += strlen(p) + 1;
+ i++;
+ }
+ for (i = 0; i < num_hints; i++)
+ {
+ hint = eina_stringshare_add(str[i]);
+ win->supported_aux_hints =
+ eina_list_append(win->supported_aux_hints, hint);
+ }
+ if (str)
+ {
+ for (i = 0; i < num_hints; i++)
+ {
+ if (str[i])
+ {
+ eina_stringshare_del(str[i]);
+ str[i] = NULL;
+ }
+ }
+ free(str);
+ }
+}
+
+static void
+_ecore_wl_cb_allowed_aux_hint(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, int id)
+{
+ struct wl_surface *surface = surface_resource;
+ Ecore_Wl_Window *win = NULL;
+ Ecore_Wl_Event_Aux_Hint_Allowed *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!surface) return;
+ win = ecore_wl_window_surface_find(surface);
+ if (!win) return;
+
+ if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Aux_Hint_Allowed)))) return;
+ ev->win = win->id;
+ ev->id = id;
+ ecore_event_add(ECORE_WL_EVENT_AUX_HINT_ALLOWED, ev, NULL, NULL);
+}
Eina_Bool valid : 1;
} rotation_geometry_hints[4];
+ Eina_List *supported_aux_hints;
+
/* Eina_Bool redraw_scheduled : 1; */
/* Eina_Bool resize_scheduled : 1; */
Eina_Bool alpha : 1;
return win;
}
+void
+_ecore_wl_window_aux_hint_free(Ecore_Wl_Window *win)
+{
+ char *supported;
+ EINA_LIST_FREE(win->supported_aux_hints, supported)
+ if (supported) eina_stringshare_del(supported);
+}
+
EAPI void
ecore_wl_window_free(Ecore_Wl_Window *win)
{
if (win->class_name) eina_stringshare_del(win->class_name);
if (win->role) eina_stringshare_del(win->role);
+ _ecore_wl_window_aux_hint_free(win);
+
/* HMMM, why was this disabled ? */
free(win);
}
return win->conformant;
}
+
+EAPI Eina_List *
+ecore_wl_window_aux_hints_supported_get(Ecore_Wl_Window *win)
+{
+ Eina_List *res = NULL;
+ Eina_List *ll;
+ char *supported_hint = NULL;
+ const char *hint = NULL;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!win) return 0;
+ if (!win->surface) return 0;
+ if (!_ecore_wl_disp->wl.tz_policy) return 0;
+
+ tizen_policy_get_supported_aux_hints(_ecore_wl_disp->wl.tz_policy, win->surface);
+
+ ecore_wl_sync();
+
+ EINA_LIST_FOREACH(win->supported_aux_hints, ll, supported_hint)
+ {
+ hint = eina_stringshare_add(supported_hint);
+ res = eina_list_append(res, hint);
+ }
+ return res;
+}
+
+EAPI void
+ecore_wl_window_aux_hint_add(Ecore_Wl_Window *win, int id, const char *hint, const char *val)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!win) return;
+ if ((win->surface) && (_ecore_wl_disp->wl.tz_policy))
+ tizen_policy_add_aux_hint(_ecore_wl_disp->wl.tz_policy, win->surface, id, hint, val);
+}
+
+EAPI void
+ecore_wl_window_aux_hint_change(Ecore_Wl_Window *win, int id, const char *val)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!win) return;
+ if ((win->surface) && (_ecore_wl_disp->wl.tz_policy))
+ tizen_policy_change_aux_hint(_ecore_wl_disp->wl.tz_policy, win->surface, id, val);
+}
+
+EAPI void
+ecore_wl_window_aux_hint_del(Ecore_Wl_Window *win, int id)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!win) return;
+ if ((win->surface) && (_ecore_wl_disp->wl.tz_policy))
+ tizen_policy_del_aux_hint(_ecore_wl_disp->wl.tz_policy, win->surface, id);
+}
/* local variables */
static int _ecore_evas_wl_init_count = 0;
-static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[7];
+static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[8];
static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
}
static Eina_Bool
+_ecore_evas_wl_common_cb_aux_hint_allowed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Aux_Hint_Allowed *ev;
+ Eina_List *l;
+ Ecore_Evas_Aux_Hint *aux;
+
+ ev = event;
+ ee = ecore_event_window_match(ev->win);
+ if (!ee) return ECORE_CALLBACK_PASS_ON;
+ if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+
+ EINA_LIST_FOREACH(ee->prop.aux_hint.hints, l, aux)
+ {
+ if (aux->id == ev->id)
+ {
+ aux->allowed = 1;
+ if (!aux->notified)
+ {
+ _ecore_evas_wl_common_state_update(ee);
+ aux->notified = 1;
+ }
+ break;
+ }
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
_ecore_evas_wl_common_cb_window_rotate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Evas *ee;
_ecore_evas_wl_event_hdls[6] =
ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_ROTATE,
_ecore_evas_wl_common_cb_window_rotate, NULL);
+ _ecore_evas_wl_event_hdls[7] =
+ ecore_event_handler_add(ECORE_WL_EVENT_AUX_HINT_ALLOWED,
+ _ecore_evas_wl_common_cb_aux_hint_allowed, NULL);
ecore_event_evas_init();
}
void
+_ecore_evas_wl_common_aux_hints_supported_update(Ecore_Evas *ee)
+{
+ Ecore_Evas_Engine_Wl_Data *wdata;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ wdata = ee->engine.data;
+ ee->prop.aux_hint.supported_list = ecore_wl_window_aux_hints_supported_get(wdata->win);
+}
+
+void
_ecore_evas_wl_common_raise(Ecore_Evas *ee)
{
Ecore_Evas_Engine_Wl_Data *wdata;
}
+static void
+_ecore_evas_wayland_aux_hint_add(Ecore_Evas *ee EINA_UNUSED, int id, const char *hint, const char *val)
+{
+ Ecore_Evas_Engine_Wl_Data *wdata;
+
+ if (!ee) return;
+ wdata = ee->engine.data;
+ ecore_wl_window_aux_hint_add(wdata->win, id, hint, val);
+}
+
+static void
+_ecore_evas_wayland_aux_hint_change(Ecore_Evas *ee EINA_UNUSED, int id, const char *val)
+{
+ Ecore_Evas_Engine_Wl_Data *wdata;
+
+ if (!ee) return;
+ wdata = ee->engine.data;
+ ecore_wl_window_aux_hint_change(wdata->win, id, val);
+}
+
+static void
+_ecore_evas_wayland_aux_hint_del(Ecore_Evas *ee EINA_UNUSED, int id)
+{
+ Ecore_Evas_Engine_Wl_Data *wdata;
+
+ if (!ee) return;
+ wdata = ee->engine.data;
+ ecore_wl_window_aux_hint_del(wdata->win, id);
+}
+
Ecore_Evas_Interface_Wayland *
_ecore_evas_wl_interface_new(void)
{
iface->pointer_set = _ecore_evas_wayland_pointer_set;
iface->type_set = _ecore_evas_wayland_type_set;
iface->window_get = _ecore_evas_wayland_window_get;
+ iface->aux_hint_add = _ecore_evas_wayland_aux_hint_add;
+ iface->aux_hint_change = _ecore_evas_wayland_aux_hint_change;
+ iface->aux_hint_del = _ecore_evas_wayland_aux_hint_del;
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
iface->pre_post_swap_callback_set =
evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
}
+ _ecore_evas_wl_common_aux_hints_supported_update(ee);
+
ee->engine.func->fn_render = _ecore_evas_wl_common_render;
_ecore_evas_register(ee);
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_aux_hints_supported_update(Ecore_Evas *ee);
#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location);
evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
}
+ _ecore_evas_wl_common_aux_hints_supported_update(ee);
+
ee->engine.func->fn_render = _ecore_evas_wl_common_render;
_ecore_evas_register(ee);