lib/ecore_wl2/ecore_wl2_private.h
nodist_lib_ecore_wl2_libecore_wl2_la_SOURCES = \
+lib/ecore_wl2/efl-aux-hints-protocol.c \
+lib/ecore_wl2/efl-aux-hints-client-protocol.h \
lib/ecore_wl2/teamwork-protocol.c \
lib/ecore_wl2/teamwork-client-protocol.h \
lib/ecore_wl2/session-recovery-client-protocol.h \
lib_ecore_wl2_libecore_wl2_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
BUILT_SOURCES += \
+lib/ecore_wl2/efl-aux-hints-protocol.c \
+lib/ecore_wl2/efl-aux-hints-client-protocol.h \
lib/ecore_wl2/www-client-protocol.h \
lib/ecore_wl2/www-protocol.c \
lib/ecore_wl2/teamwork-protocol.c \
EXTRA_DIST2 += \
+wayland_protocol/aux-hints.xml \
wayland_protocol/session-recovery.xml \
wayland_protocol/teamwork.xml \
wayland_protocol/www.xml
typedef struct _Ecore_Wl2_Keyboard Ecore_Wl2_Keyboard;
typedef struct _Ecore_Wl2_Touch Ecore_Wl2_Touch;
typedef struct _Ecore_Wl2_Offer Ecore_Wl2_Offer;
-typedef struct _Ecore_Wl2_Aux_Hint Ecore_Wl2_Aux_Hint;
/* matches protocol values */
typedef enum
{
unsigned int win;
int id;
+ Ecore_Wl2_Display *display;
} Ecore_Wl2_Event_Aux_Hint_Allowed;
+typedef struct _Ecore_Wl2_Event_Aux_Hint_Supported
+{
+ unsigned int win;
+ Ecore_Wl2_Display *display;
+} Ecore_Wl2_Event_Aux_Hint_Supported;
+
+typedef struct Ecore_Wl2_Event_Aux_Message
+{
+ unsigned int win;
+ Eina_Stringshare *key;
+ Eina_Stringshare *val;
+ Eina_List *options;
+ Ecore_Wl2_Display *display;
+} Ecore_Wl2_Event_Aux_Message;
+
typedef void (*Ecore_Wl2_Bind_Cb)(struct wl_client *client, void *data, uint32_t version, uint32_t id);
typedef void (*Ecore_Wl2_Unbind_Cb)(struct wl_resource *resource);
EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_AUX_HINT_ALLOWED; /** @since 1.20 */
+EAPI extern int ECORE_WL2_EVENT_AUX_HINT_SUPPORTED; /** @since 1.20 */
+EAPI extern int ECORE_WL2_EVENT_AUX_MESSAGE; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_SHOW; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_HIDE; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_ACTIVATE; /** @since 1.20 */
EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE = 0;
EAPI int ECORE_WL2_EVENT_AUX_HINT_ALLOWED = 0;
+EAPI int ECORE_WL2_EVENT_AUX_HINT_SUPPORTED = 0;
+EAPI int ECORE_WL2_EVENT_AUX_MESSAGE = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_SHOW = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_HIDE = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_ACTIVATE = 0;
ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE = ecore_event_type_new();
ECORE_WL2_EVENT_AUX_HINT_ALLOWED = ecore_event_type_new();
+ ECORE_WL2_EVENT_AUX_HINT_SUPPORTED = ecore_event_type_new();
+ ECORE_WL2_EVENT_AUX_MESSAGE = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_SHOW = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_HIDE = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_ACTIVATE = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST,
ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE,
ECORE_WL2_EVENT_AUX_HINT_ALLOWED,
+ ECORE_WL2_EVENT_AUX_HINT_SUPPORTED,
+ ECORE_WL2_EVENT_AUX_MESSAGE,
ECORE_WL2_EVENT_WINDOW_SHOW,
ECORE_WL2_EVENT_WINDOW_HIDE,
ECORE_WL2_EVENT_WINDOW_ACTIVATE,
};
static void
+_aux_hints_supported_aux_hints(void *data, struct efl_aux_hints *aux_hints EINA_UNUSED, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints)
+{
+ Ecore_Wl2_Display *ewd = data;
+ struct wl_surface *surface = surface_resource;
+ Ecore_Wl2_Window *win = NULL;
+ char *p = NULL;
+ char **str = NULL;
+ const char *hint = NULL;
+ unsigned int i = 0;
+ Ecore_Wl2_Event_Aux_Hint_Supported *ev;
+
+ if (!surface) return;
+ win = _ecore_wl2_display_window_surface_find(ewd, surface_resource);
+ 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);
+ }
+
+ if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Hint_Supported)))) return;
+ ev->win = win->id;
+ ev->display = ewd;
+ ewd->refs++;
+ ecore_event_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED, ev, _display_event_free, NULL);
+}
+
+static void
+_aux_hints_allowed_aux_hint(void *data, struct efl_aux_hints *aux_hints EINA_UNUSED, struct wl_surface *surface_resource, int id)
+{
+ struct wl_surface *surface = surface_resource;
+ Ecore_Wl2_Window *win = NULL;
+ Ecore_Wl2_Display *ewd = data;
+ Ecore_Wl2_Event_Aux_Hint_Allowed *ev;
+
+ if (!surface) return;
+ win = _ecore_wl2_display_window_surface_find(ewd, surface_resource);
+ if (!win) return;
+
+ if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Hint_Allowed)))) return;
+ ev->win = win->id;
+ ev->id = id;
+ ev->display = ewd;
+ ewd->refs++;
+ ecore_event_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED, ev, _display_event_free, NULL);
+}
+
+ static void
+_cb_aux_message_free(void *data EINA_UNUSED, void *event)
+{
+ Ecore_Wl2_Event_Aux_Message *ev;
+ char *str;
+
+ ev = event;
+ ecore_wl2_display_disconnect(ev->display);
+ eina_stringshare_del(ev->key);
+ eina_stringshare_del(ev->val);
+ EINA_LIST_FREE(ev->options, str)
+ eina_stringshare_del(str);
+ free(ev);
+}
+
+ static void
+_aux_hints_aux_message(void *data, struct efl_aux_hints *aux_hints EINA_UNUSED, struct wl_surface *surface_resource, const char *key, const char *val, struct wl_array *options)
+{
+ Ecore_Wl2_Window *win = NULL;
+ Ecore_Wl2_Event_Aux_Message *ev;
+ char *p = NULL, *str = NULL;
+ Eina_List *opt_list = NULL;
+ Ecore_Wl2_Display *ewd = data;
+
+ if (!surface_resource) return;
+ win = _ecore_wl2_display_window_surface_find(ewd, surface_resource);
+ if (!win) return;
+
+ if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Message)))) return;
+
+ if ((options) && (options->size))
+ {
+ p = options->data;
+ while ((const char *)p < ((const char *)options->data + options->size))
+ {
+ str = (char *)eina_stringshare_add(p);
+ opt_list = eina_list_append(opt_list, str);
+ p += strlen(p) + 1;
+ }
+ }
+
+ ev->win = win->id;
+ ev->key = eina_stringshare_add(key);
+ ev->val = eina_stringshare_add(val);
+ ev->options = opt_list;
+ ev->display = ewd;
+ ewd->refs++;
+
+ ecore_event_add(ECORE_WL2_EVENT_AUX_MESSAGE, ev, _cb_aux_message_free, NULL);
+}
+
+static const struct efl_aux_hints_listener _aux_hints_listener =
+{
+ _aux_hints_supported_aux_hints,
+ _aux_hints_allowed_aux_hint,
+ _aux_hints_aux_message,
+};
+
+static void
_cb_global_event_free(void *data EINA_UNUSED, void *event)
{
Ecore_Wl2_Event_Global *ev;
zwp_e_session_recovery_add_listener(ewd->wl.session_recovery,
&_session_listener, ewd);
}
+ else if (!strcmp(interface, "efl_aux_hints"))
+ {
+ Ecore_Wl2_Window *window;
+ ewd->wl.efl_aux_hints =
+ wl_registry_bind(registry, id,
+ &efl_aux_hints_interface, 1);
+ efl_aux_hints_add_listener(ewd->wl.efl_aux_hints, &_aux_hints_listener, ewd);
+ EINA_INLIST_FOREACH(ewd->windows, window)
+ if (window->surface) efl_aux_hints_get_supported_aux_hints(ewd->wl.efl_aux_hints, window->surface);
+ }
else if (!strcmp(interface, "zwp_teamwork"))
{
ewd->wl.teamwork =
if (ewd->wl.compositor) wl_compositor_destroy(ewd->wl.compositor);
if (ewd->wl.subcompositor) wl_subcompositor_destroy(ewd->wl.subcompositor);
if (ewd->wl.dmabuf) zwp_linux_dmabuf_v1_destroy(ewd->wl.dmabuf);
+ if (ewd->wl.efl_aux_hints) efl_aux_hints_destroy(ewd->wl.efl_aux_hints);
if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry);
}
# include "session-recovery-client-protocol.h"
# include "xdg-shell-unstable-v6-client-protocol.h"
+# include "efl-aux-hints-client-protocol.h"
extern int _ecore_wl2_log_dom;
extern Eina_Bool no_session_recovery;
struct zxdg_shell_v6 *zxdg_shell;
struct www *www;
struct zwp_e_session_recovery *session_recovery;
+ struct efl_aux_hints *efl_aux_hints;
struct zwp_teamwork *teamwork;
int compositor_version;
} wl;
Ecore_Wl2_Window_Type type;
Eina_Inlist *subsurfs;
- Eina_Inlist *supported_aux_hints;
+ Eina_List *supported_aux_hints;
Eina_Bool moving : 1;
Eina_Bool minimized : 1;
window->surface_id =
wl_proxy_get_id((struct wl_proxy *)window->surface);
+ if (window->display->wl.efl_aux_hints)
+ efl_aux_hints_get_supported_aux_hints(window->display->wl.efl_aux_hints, window->surface);
}
}
static void
-_ecore_wl2_aux_hint_free(Ecore_Wl2_Aux_Hint *ehint)
-{
- eina_stringshare_del(ehint->hint);
- eina_stringshare_del(ehint->val);
- free(ehint);
-}
-
-static void
_ecore_wl2_window_show_send(Ecore_Wl2_Window *window)
{
Ecore_Wl2_Event_Window_Show *ev;
window->configure_ack = NULL;
}
+void
+_ecore_wl_window_aux_hint_free(Ecore_Wl2_Window *win)
+{
+ const char *supported;
+ EINA_LIST_FREE(win->supported_aux_hints, supported)
+ if (supported) eina_stringshare_del(supported);
+}
+
EAPI void
ecore_wl2_window_free(Ecore_Wl2_Window *window)
{
Ecore_Wl2_Display *display;
Ecore_Wl2_Input *input;
Ecore_Wl2_Subsurface *subsurf;
- Ecore_Wl2_Aux_Hint *ehint;
Eina_Inlist *tmp;
EINA_SAFETY_ON_NULL_RETURN(window);
EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf)
_ecore_wl2_subsurf_free(subsurf);
- EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint)
- _ecore_wl2_aux_hint_free(ehint);
+ _ecore_wl_window_aux_hint_free(window);
if (window->uuid && window->surface && window->display->wl.session_recovery)
zwp_e_session_recovery_destroy_uuid(window->display->wl.session_recovery,
}
EAPI Eina_List *
-ecore_wl2_window_aux_hints_supported_get(Ecore_Wl2_Window *window)
+ecore_wl2_window_aux_hints_supported_get(Ecore_Wl2_Window *win)
{
- Eina_List *ret = NULL;
- Ecore_Wl2_Aux_Hint *ehint;
+ Eina_List *res = NULL;
+ Eina_List *ll;
+ char *supported_hint = NULL;
+ const char *hint = NULL;
- EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
-
- EINA_INLIST_FOREACH(window->supported_aux_hints, ehint)
- ret = eina_list_append(ret, eina_stringshare_add(ehint->val));
+ if (!win) return NULL;
+ if (!win->surface) return NULL;
- return ret;
+ 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_wl2_window_aux_hint_add(Ecore_Wl2_Window *window, int id, const char *hint, const char *val)
+ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *win, int id, const char *hint, const char *val)
{
- Ecore_Wl2_Aux_Hint *ehint;
-
- EINA_SAFETY_ON_NULL_RETURN(window);
-
- ehint = calloc(1, sizeof(Ecore_Wl2_Aux_Hint));
- if (!ehint) return;
-
- ehint->id = id;
- ehint->hint = eina_stringshare_add(hint);
- ehint->val = eina_stringshare_add(val);
-
- window->supported_aux_hints =
- eina_inlist_append(window->supported_aux_hints, EINA_INLIST_GET(ehint));
+ if (!win) return;
+ if ((win->surface) && (win->display->wl.efl_aux_hints))
+ efl_aux_hints_add_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, hint, val);
}
EAPI void
-ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *window, int id, const char *val)
+ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *win, int id, const char *val)
{
- Eina_Inlist *tmp;
- Ecore_Wl2_Aux_Hint *ehint;
-
- EINA_SAFETY_ON_NULL_RETURN(window);
-
- EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint)
- {
- if (ehint->id == id)
- {
- eina_stringshare_replace(&ehint->val, val);
- break;
- }
- }
+ if (!win) return;
+ if ((win->surface) && (win->display->wl.efl_aux_hints))
+ efl_aux_hints_change_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, val);
}
EAPI void
-ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *window, int id)
+ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *win, int id)
{
- Eina_Inlist *tmp;
- Ecore_Wl2_Aux_Hint *ehint;
-
- EINA_SAFETY_ON_NULL_RETURN(window);
-
- EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint)
- {
- if (ehint->id == id)
- {
- window->supported_aux_hints =
- eina_inlist_remove(window->supported_aux_hints,
- EINA_INLIST_GET(ehint));
-
- eina_stringshare_del(ehint->hint);
- eina_stringshare_del(ehint->val);
- free(ehint);
-
- break;
- }
- }
+ if (!win) return;
+ if ((win->surface) && (win->display->wl.efl_aux_hints))
+ efl_aux_hints_del_aux_hint(win->display->wl.efl_aux_hints, win->surface, id);
}
-
EAPI void
ecore_wl2_window_focus_skip_set(Ecore_Wl2_Window *window, Eina_Bool focus_skip)
{
/* local variables */
static int _ecore_evas_wl_init_count = 0;
-static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[14];
+static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[20];
static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
static void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize);
return ECORE_CALLBACK_PASS_ON;
}
+ static Eina_Bool
+_ecore_evas_wl_common_cb_aux_hint_supported(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl2_Event_Aux_Hint_Supported *ev;
+ Eina_Stringshare *hint;
+ Ecore_Evas_Engine_Wl_Data *wdata;
+
+ 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;
+ wdata = ee->engine.data;
+ EINA_LIST_FREE(ee->prop.aux_hint.supported_list, hint) eina_stringshare_del(hint);
+ ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win);
+ return ECORE_CALLBACK_RENEW;
+}
+
+ 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_Wl2_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_wl_event_hdls[13] =
ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE,
_ecore_evas_wl_common_cb_window_rotate, NULL);
+ _ecore_evas_wl_event_hdls[14] =
+ ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED,
+ _ecore_evas_wl_common_cb_aux_hint_allowed, NULL);
+ _ecore_evas_wl_event_hdls[15] =
+ ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED,
+ _ecore_evas_wl_common_cb_aux_hint_supported, NULL);
ecore_event_evas_init();
ecore_wl2_input_pointer_xy_get(input, x, y);
}
+ 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_wl2_window_aux_hints_supported_get(wdata->win);
+}
+
static void
_ecore_evas_wl_common_raise(Ecore_Evas *ee)
{
--- /dev/null
+<protocol name="efl_aux_hints">
+
+ <interface name="efl_aux_hints" version="1">
+ <request name="add_aux_hint">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="id" type="int"/>
+ <arg name="hint" type="string"/>
+ <arg name="val" type="string"/>
+ </request>
+ <request name="change_aux_hint">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="id" type="int"/>
+ <arg name="val" type="string"/>
+ </request>
+ <request name="del_aux_hint">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="id" type="int"/>
+ </request>
+ <request name="get_supported_aux_hints">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </request>
+ <event name="supported_aux_hints">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="hints" type="array"/>
+ <arg name="num_hints" type="uint"/>
+ </event>
+ <event name="allowed_aux_hint">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="id" type="int"/>
+ </event>
+ <event name="aux_message">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="key" type="string"/>
+ <arg name="val" type="string"/>
+ <arg name="options" type="array"/>
+ </event>
+ </interface>
+
+</protocol>