*/
EAPI void ecore_wl2_subsurface_aux_hint_set(Ecore_Wl2_Subsurface *subsurface, const char *hint, const char *val);
//
+
+
+//TIZEN_ONLY(20210503): support foreign shell
+/**
+ * @brief Export given subsurface
+ *
+ * @param subsurface The subsurface to export
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI Eina_Bool ecore_wl2_subsurface_export(Ecore_Wl2_Subsurface *subsurface);
+
+/**
+ * @brief Get exported surface handle for a given subsurface
+ *
+ * @param subsurface The subsurface to get exported surface handle
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI const char* ecore_wl2_subsurface_exported_surface_handle_get(Ecore_Wl2_Subsurface *subsurface);
+
+/**
+ * @brief Show exported surface for a given subsurface
+ *
+ * @param subsurface The subsurface to show exported surface
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_surface_show(Ecore_Wl2_Subsurface *subsurface);
+
+/**
+ * @brief Hide exported surface for a given subsurface
+ *
+ * @param subsurface The subsurface to hide exported surface
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_surface_hide(Ecore_Wl2_Subsurface *subsurface);
+
+/**
+ * @brief Place exported surface for a given subsurface on layer above a reference subsurface
+ *
+ * @param subsurface the subsurface
+ * @param other the sibling reference subsurface, or NULL for parent surface
+ * @see ecore_wl2_subsurface_place_surface_above
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_surface_place_above(Ecore_Wl2_Subsurface *subsurface, Ecore_Wl2_Subsurface *other);
+
+/**
+ * @brief Place exported surface for a given subsurface on layer below a reference subsurface
+ *
+ * @param subsurface the subsurface
+ * @param other the sibling reference subsurface, or NULL for parent surface
+ * @see ecore_wl2_subsurface_place_surface_above
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_surface_place_below(Ecore_Wl2_Subsurface *subsurface, Ecore_Wl2_Subsurface *other);
+
+/**
+ * @brief Set position of exported surface for a given subsurface
+ *
+ * @param subsurface the subsurface
+ * @param x X position of exported surface
+ * @param y Y position of exported surface
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_surface_move(Ecore_Wl2_Subsurface *subsurface, int x, int y);
+
+/**
+ * @brief Set size of exported surface for a given subsurface
+ *
+ * @param subsurface the subsurface
+ * @param w Width of exported surface
+ * @param h Height of exported surface
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_surface_resize(Ecore_Wl2_Subsurface *subsurface, int w, int h);
+
+/**
+ * @brief Set transform of exported surface for a given subsurface
+ *
+ * @param subsurface the subsurface
+ * @param transform The exported surface transform being requested
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_surface_transform_set(Ecore_Wl2_Subsurface *subsurface, int transform);
+
+/**
+ * @brief Enables or disables exported surface synchronization for a given subsurface
+ *
+ * @param subsurface the subsurface
+ * @param sync true to enable synchronization, false to desynchronize
+ *
+ * @see ecore_wl2_subsurface_sync_set
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_surface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync);
+
+/**
+ * @brief Commit exported surface for a given subsurface
+ *
+ * This generates a wl_surface_commit() immediately
+ *
+ * @param subsurface the subsurface
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.5
+ */
+EAPI void ecore_wl2_subsurface_exported_shell_commit(Ecore_Wl2_Subsurface *subsurface);
+//
# undef EAPI
# define EAPI
#include "ecore_wl2_private.h"
+//TIZEN_ONLY(20210503): support foreign shell
+#include <wtz-foreign-client-protocol.h>
+//
+
// TIZEN_ONLY(20201022): support restack video
#include <wayland-tbm-client.h>
_ecore_wl2_subsurface_video_surface_del(subsurf);
//
+ //TIZEN_ONLY(20210503): support foreign shell
+ if (subsurf->wl.fs) wtz_exported_shell_destroy(subsurf->wl.fs);
+ if (subsurf->wl.fs_handle) free((char *)subsurf->wl.fs_handle);
+ //
+
_ecore_wl2_subsurf_unmap(subsurf);
parent = subsurf->parent;
}
+//TIZEN_ONLY(20210503): support foreign shell
+static void
+_exported_shell_cb_handle(void *data,
+ struct wtz_exported_shell *sh EINA_UNUSED,
+ const char *handle)
+{
+ Ecore_Wl2_Subsurface *subsurface = data;
+
+ subsurface->wl.fs_handle = strdup(handle);
+}
+
+static const struct wtz_exported_shell_listener _exported_shell_listener =
+{
+ _exported_shell_cb_handle
+};
+
+EAPI Eina_Bool
+ecore_wl2_subsurface_export(Ecore_Wl2_Subsurface *subsurface)
+{
+ Ecore_Wl2_Display *display;
+ struct wl_registry *registry;
+ Eina_Iterator *globals;
+ Ecore_Wl2_Global *global;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(subsurface, EINA_FALSE);
+
+ if (subsurface->wl.fs_handle) return EINA_TRUE;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(subsurface->parent, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(subsurface->parent->display, EINA_FALSE);
+
+ display = subsurface->parent->display;
+ if (!display->wl.fs_exporter)
+ {
+ registry = ecore_wl2_display_registry_get(display);
+ if (!registry) return EINA_FALSE;
+
+ globals = ecore_wl2_display_globals_get(display);
+ if (!globals) return EINA_FALSE;
+
+ EINA_ITERATOR_FOREACH(globals, global)
+ {
+ if (strcmp(global->interface, "wtz_exporter") == 0)
+ {
+ display->wl.fs_exporter = wl_registry_bind(registry,
+ global->id, &wtz_exporter_interface, 1);
+ break;
+ }
+ }
+ }
+
+ if (!subsurface->wl.fs)
+ {
+ subsurface->wl.fs = wtz_exporter_export_shell(display->wl.fs_exporter,
+ subsurface->wl.surface);
+ }
+
+ wtz_exported_shell_add_listener(subsurface->wl.fs,
+ &_exported_shell_listener, subsurface);
+ wl_display_roundtrip(display->wl.display);
+
+ return EINA_TRUE;
+}
+
+EAPI const char*
+ecore_wl2_subsurface_exported_surface_handle_get(Ecore_Wl2_Subsurface *subsurface)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(subsurface, NULL);
+
+ return subsurface->wl.fs_handle;
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_show(Ecore_Wl2_Subsurface *subsurface)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.fs);
+
+ wtz_exported_shell_map(subsurface->wl.fs);
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_hide(Ecore_Wl2_Subsurface *subsurface)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.fs);
+
+ wtz_exported_shell_unmap(subsurface->wl.fs);
+}
+
+void
+_ecore_wl2_subsurfae_place_surface_stack(Ecore_Wl2_Subsurface *subsurf, Ecore_Wl2_Subsurface *other, Eina_Bool above)
+{
+ struct wl_surface *psurface;
+
+ EINA_SAFETY_ON_NULL_RETURN(subsurf);
+
+ /* every subsurface is created by window base now,
+ someday we could use another subsurface as a parent */
+ if (other)
+ {
+ if (subsurf->parent != other->parent)
+ {
+ ERR("Check parent of subsurf(%p) and other(%p)", subsurf, other);
+ return;
+ }
+ if (above)
+ wl_subsurface_place_above(subsurf->wl.subsurface, other->wl.surface);
+ else
+ wl_subsurface_place_below(subsurf->wl.subsurface, other->wl.surface);
+ }
+ else
+ {
+ psurface = ecore_wl2_window_surface_get(subsurf->parent);
+ if (above)
+ wl_subsurface_place_above(subsurf->wl.subsurface, psurface);
+ else
+ wl_subsurface_place_below(subsurf->wl.subsurface, psurface);
+ }
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_place_above(Ecore_Wl2_Subsurface *subsurface, Ecore_Wl2_Subsurface *other)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ _ecore_wl2_subsurfae_place_surface_stack(subsurface, other, EINA_TRUE);
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_place_below(Ecore_Wl2_Subsurface *subsurface, Ecore_Wl2_Subsurface *other)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ _ecore_wl2_subsurfae_place_surface_stack(subsurface, other, EINA_FALSE);
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_move(Ecore_Wl2_Subsurface *subsurface, int x, int y)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ wl_subsurface_set_position(subsurface->wl.subsurface, x, y);
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_resize(Ecore_Wl2_Subsurface *subsurface, int w, int h)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.fs);
+ wtz_exported_shell_set_destination(subsurface->wl.fs, w, h);
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_transform_set(Ecore_Wl2_Subsurface *subsurface, int transform)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ EINA_SAFETY_ON_NULL_RETURN(subsurface->wl.fs);
+ wtz_exported_shell_set_transform(subsurface->wl.fs, transform);
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ ecore_wl2_subsurface_sync_set(subsurface, sync);
+}
+
+EAPI void
+ecore_wl2_subsurface_exported_surface_commit(Ecore_Wl2_Subsurface *subsurface)
+{
+ EINA_SAFETY_ON_NULL_RETURN(subsurface);
+ wl_surface_commit(subsurface->wl.surface);
+}
+//
+
// TIZEN_ONLY(20201022): support restack video
EAPI Eina_Bool
ecore_wl2_subsurface_video_surface_prepare(Ecore_Wl2_Subsurface *subsurface)
return EINA_TRUE;
}
-void
-_ecore_wl2_subsurfae_place_surface_stack(Ecore_Wl2_Subsurface *subsurf, Ecore_Wl2_Subsurface *other, Eina_Bool above)
-{
- struct wl_surface *psurface;
-
- EINA_SAFETY_ON_NULL_RETURN(subsurf);
-
- /* every subsurface is created by window base now,
- someday we could use another subsurface as a parent */
- if (other)
- {
- if (subsurf->parent != other->parent)
- {
- ERR("Check parent of subsurf(%p) and other(%p)", subsurf, other);
- return;
- }
- if (above)
- wl_subsurface_place_above(subsurf->wl.subsurface, other->wl.surface);
- else
- wl_subsurface_place_below(subsurf->wl.subsurface, other->wl.surface);
- }
- else
- {
- psurface = ecore_wl2_window_surface_get(subsurf->parent);
- if (above)
- wl_subsurface_place_above(subsurf->wl.subsurface, psurface);
- else
- wl_subsurface_place_below(subsurf->wl.subsurface, psurface);
- }
-}
-
EAPI void
ecore_wl2_subsurface_place_surface_above(Ecore_Wl2_Subsurface *subsurface, Ecore_Wl2_Subsurface *other)
{