forked from enlightenment/efl
Merge branch 'subsurfaces'
This commit is contained in:
commit
f7a43e9dbc
|
@ -1007,6 +1007,7 @@ AC_ARG_ENABLE([wayland],
|
|||
|
||||
if test "${want_wayland}" = "yes"; then
|
||||
EFL_PKG_CHECK_STRICT([wayland-client])
|
||||
AC_PATH_PROG([wayland_scanner], [wayland-scanner], [AC_MSG_ERROR("wayland-scanner is needed to compile ecore_wayland protocol")])
|
||||
fi
|
||||
|
||||
# Fb
|
||||
|
|
|
@ -0,0 +1,244 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="subsurface">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2012-2013 Collabora, Ltd.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation, and that the name of
|
||||
the copyright holders not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission. The copyright holders make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="wl_subcompositor" version="1">
|
||||
<description summary="sub-surface compositing">
|
||||
The global interface exposing sub-surface compositing capabilities.
|
||||
A wl_surface, that has sub-surfaces associated, is called the
|
||||
parent surface. Sub-surfaces can be arbitrarily nested and create
|
||||
a tree of sub-surfaces.
|
||||
|
||||
The root surface in a tree of sub-surfaces is the main
|
||||
surface. The main surface cannot be a sub-surface, because
|
||||
sub-surfaces must always have a parent.
|
||||
|
||||
A main surface with its sub-surfaces forms a (compound) window.
|
||||
For window management purposes, this set of wl_surface objects is
|
||||
to be considered as a single window, and it should also behave as
|
||||
such.
|
||||
|
||||
The aim of sub-surfaces is to offload some of the compositing work
|
||||
within a window from clients to the compositor. A prime example is
|
||||
a video player with decorations and video in separate wl_surface
|
||||
objects. This should allow the compositor to pass YUV video buffer
|
||||
processing to dedicated overlay hardware when possible.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="unbind from the subcompositor interface">
|
||||
Informs the server that the client will not be using this
|
||||
protocol object anymore. This does not affect any other
|
||||
objects, wl_subsurface objects included.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="bad_surface" value="0"
|
||||
summary="the to-be sub-surface is invalid"/>
|
||||
</enum>
|
||||
|
||||
<request name="get_subsurface">
|
||||
<description summary="give a surface the role sub-surface">
|
||||
Create a sub-surface interface for the given surface, and
|
||||
associate it with the given parent surface. This turns a
|
||||
plain wl_surface into a sub-surface.
|
||||
|
||||
The to-be sub-surface must not already have a dedicated
|
||||
purpose, like any shell surface type, cursor image, drag icon,
|
||||
or sub-surface. Otherwise a protocol error is raised.
|
||||
</description>
|
||||
|
||||
<arg name="id" type="new_id" interface="wl_subsurface"
|
||||
summary="the new subsurface object id"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
summary="the surface to be turned into a sub-surface"/>
|
||||
<arg name="parent" type="object" interface="wl_surface"
|
||||
summary="the parent surface"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="wl_subsurface" version="1">
|
||||
<description summary="sub-surface interface to a wl_surface">
|
||||
An additional interface to a wl_surface object, which has been
|
||||
made a sub-surface. A sub-surface has one parent surface. A
|
||||
sub-surface's size and position are not limited to that of the parent.
|
||||
Particularly, a sub-surface is not automatically clipped to its
|
||||
parent's area.
|
||||
|
||||
A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
|
||||
and the parent surface is mapped. The order of which one happens
|
||||
first is irrelevant. A sub-surface is hidden if the parent becomes
|
||||
hidden, or if a NULL wl_buffer is applied. These rules apply
|
||||
recursively through the tree of surfaces.
|
||||
|
||||
The behaviour of wl_surface.commit request on a sub-surface
|
||||
depends on the sub-surface's mode. The possible modes are
|
||||
synchronized and desynchronized, see methods
|
||||
wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
|
||||
mode caches the wl_surface state to be applied when the parent's
|
||||
state gets applied, and desynchronized mode applies the pending
|
||||
wl_surface state directly. A sub-surface is initially in the
|
||||
synchronized mode.
|
||||
|
||||
Sub-surfaces have also other kind of state, which is managed by
|
||||
wl_subsurface requests, as opposed to wl_surface requests. This
|
||||
state includes the sub-surface position relative to the parent
|
||||
surface (wl_subsurface.set_position), and the stacking order of
|
||||
the parent and its sub-surfaces (wl_subsurface.place_above and
|
||||
.place_below). This state is applied when the parent surface's
|
||||
wl_surface state is applied, regardless of the sub-surface's mode.
|
||||
As the exception, set_sync and set_desync are effective immediately.
|
||||
|
||||
The main surface can be thought to be always in desynchronized mode,
|
||||
since it does not have a parent in the sub-surfaces sense.
|
||||
|
||||
Even if a sub-surface is in desynchronized mode, it will behave as
|
||||
in synchronized mode, if its parent surface behaves as in
|
||||
synchronized mode. This rule is applied recursively throughout the
|
||||
tree of surfaces. This means, that one can set a sub-surface into
|
||||
synchronized mode, and then assume that all its child and grand-child
|
||||
sub-surfaces are synchronized, too, without explicitly setting them.
|
||||
|
||||
If the wl_surface associated with the wl_subsurface is destroyed, the
|
||||
wl_subsurface object becomes inert. Note, that destroying either object
|
||||
takes effect immediately. If you need to synchronize the removal
|
||||
of a sub-surface to the parent surface update, unmap the sub-surface
|
||||
first by attaching a NULL wl_buffer, update parent, and then destroy
|
||||
the sub-surface.
|
||||
|
||||
If the parent wl_surface object is destroyed, the sub-surface is
|
||||
unmapped.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="remove sub-surface interface">
|
||||
The sub-surface interface is removed from the wl_surface object
|
||||
that was turned into a sub-surface with
|
||||
wl_subcompositor.get_subsurface request. The wl_surface's association
|
||||
to the parent is deleted, and the wl_surface loses its role as
|
||||
a sub-surface. The wl_surface is unmapped.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="bad_surface" value="0"
|
||||
summary="wl_surface is not a sibling or the parent"/>
|
||||
</enum>
|
||||
|
||||
<request name="set_position">
|
||||
<description summary="reposition the sub-surface">
|
||||
This schedules a sub-surface position change.
|
||||
The sub-surface will be moved so, that its origin (top-left
|
||||
corner pixel) will be at the location x, y of the parent surface
|
||||
coordinate system. The coordinates are not restricted to the parent
|
||||
surface area. Negative values are allowed.
|
||||
|
||||
The next wl_surface.commit on the parent surface will reset
|
||||
the sub-surface's position to the scheduled coordinates.
|
||||
|
||||
The initial position is 0, 0.
|
||||
</description>
|
||||
|
||||
<arg name="x" type="int" summary="coordinate in the parent surface"/>
|
||||
<arg name="y" type="int" summary="coordinate in the parent surface"/>
|
||||
</request>
|
||||
|
||||
<request name="place_above">
|
||||
<description summary="restack the sub-surface">
|
||||
This sub-surface is taken from the stack, and put back just
|
||||
above the reference surface, changing the z-order of the sub-surfaces.
|
||||
The reference surface must be one of the sibling surfaces, or the
|
||||
parent surface. Using any other surface, including this sub-surface,
|
||||
will cause a protocol error.
|
||||
|
||||
The z-order is double-buffered state, and will be applied on the
|
||||
next commit of the parent surface.
|
||||
See wl_surface.commit and wl_subcompositor.get_subsurface.
|
||||
|
||||
A new sub-surface is initially added as the top-most in the stack
|
||||
of its siblings and parent.
|
||||
</description>
|
||||
|
||||
<arg name="sibling" type="object" interface="wl_surface"
|
||||
summary="the reference surface"/>
|
||||
</request>
|
||||
|
||||
<request name="place_below">
|
||||
<description summary="restack the sub-surface">
|
||||
The sub-surface is placed just below of the reference surface.
|
||||
See wl_subsurface.place_above.
|
||||
</description>
|
||||
|
||||
<arg name="sibling" type="object" interface="wl_surface"
|
||||
summary="the reference surface"/>
|
||||
</request>
|
||||
|
||||
<request name="set_sync">
|
||||
<description summary="set sub-surface to synchronized mode">
|
||||
Change the commit behaviour of the sub-surface to synchronized
|
||||
mode, also described as the parent dependant mode.
|
||||
|
||||
In synchronized mode, wl_surface.commit on a sub-surface will
|
||||
accumulate the committed state in a cache, but the state will
|
||||
not be applied and hence will not change the compositor output.
|
||||
The cached state is applied to the sub-surface immediately after
|
||||
the parent surface's state is applied. This ensures atomic
|
||||
updates of the parent and all its synchronized sub-surfaces.
|
||||
Applying the cached state will invalidate the cache, so further
|
||||
parent surface commits do not (re-)apply old state.
|
||||
|
||||
See wl_subsurface for the recursive effect of this mode.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="set_desync">
|
||||
<description summary="set sub-surface to desynchronized mode">
|
||||
Change the commit behaviour of the sub-surface to desynchronized
|
||||
mode, also described as independent or freely running mode.
|
||||
|
||||
In desynchronized mode, wl_surface.commit on a sub-surface will
|
||||
apply the pending state directly, without caching, as happens
|
||||
normally with a wl_surface. Calling wl_surface.commit on the
|
||||
parent surface has no effect on the sub-surface's wl_surface
|
||||
state. This mode allows a sub-surface to be updated on its own.
|
||||
|
||||
If cached state exists when wl_surface.commit is called in
|
||||
desynchronized mode, the pending state is added to the cached
|
||||
state, and applied as whole. This invalidates the cache.
|
||||
|
||||
Note: even if a sub-surface is set to desynchronized, a parent
|
||||
sub-surface may override it to behave as synchronized. For details,
|
||||
see wl_subsurface.
|
||||
|
||||
If a surface's parent surface behaves as desynchronized, then
|
||||
the cached state is applied on set_desync.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
</interface>
|
||||
</protocol>
|
|
@ -14,10 +14,30 @@ lib/ecore_wayland/ecore_wl_dnd.c \
|
|||
lib/ecore_wayland/ecore_wl_input.c \
|
||||
lib/ecore_wayland/ecore_wl_output.c \
|
||||
lib/ecore_wayland/ecore_wl_window.c \
|
||||
lib/ecore_wayland/ecore_wl_subsurf.c \
|
||||
lib/ecore_wayland/ecore_wl_private.h
|
||||
|
||||
lib_ecore_wayland_libecore_wayland_la_BUILT_SOURCES = \
|
||||
lib/ecore_wayland/subsurface-protocol.c \
|
||||
lib/ecore_wayland/subsurface-client-protocol.h
|
||||
|
||||
CLEANFILES += $(lib_ecore_wayland_libecore_wayland_la_BUILT_SOURCES)
|
||||
|
||||
lib_ecore_wayland_libecore_wayland_la_SOURCES += $(lib_ecore_wayland_libecore_wayland_la_BUILT_SOURCES)
|
||||
|
||||
BUILT_SOURCES += $(lib_ecore_wayland_libecore_wayland_la_BUILT_SOURCES)
|
||||
|
||||
lib_ecore_wayland_libecore_wayland_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_WAYLAND_CFLAGS@
|
||||
lib_ecore_wayland_libecore_wayland_la_LIBADD = @ECORE_WAYLAND_LIBS@
|
||||
lib_ecore_wayland_libecore_wayland_la_DEPENDENCIES = @ECORE_WAYLAND_INTERNAL_LIBS@
|
||||
lib_ecore_wayland_libecore_wayland_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||
|
||||
wayland_protocoldir = $(top_srcdir)/data/ecore/ecore_wayland/protocol
|
||||
|
||||
lib/ecore_wayland/subsurface-protocol.c: $(wayland_protocoldir)/subsurface.xml
|
||||
$(AM_V_GEN)$(wayland_scanner) code < $< > $@
|
||||
|
||||
lib/ecore_wayland/subsurface-client-protocol.h: $(wayland_protocoldir)/subsurface.xml
|
||||
$(AM_V_GEN)$(wayland_scanner) client-header < $< > $@
|
||||
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
subsurface-protocol.c
|
||||
subsurface-client-protocol.h
|
|
@ -35,6 +35,7 @@ typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
|
|||
typedef struct _Ecore_Wl_Output Ecore_Wl_Output;
|
||||
typedef struct _Ecore_Wl_Input Ecore_Wl_Input;
|
||||
typedef struct _Ecore_Wl_Global Ecore_Wl_Global; /** @since 1.7.6 */
|
||||
typedef struct _Ecore_Wl_Subsurf Ecore_Wl_Subsurf; /** @since 1.8 */
|
||||
|
||||
# ifndef _ECORE_WAYLAND_WINDOW_PREDEF
|
||||
typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
|
||||
|
@ -101,6 +102,7 @@ struct _Ecore_Wl_Display
|
|||
struct wl_display *display;
|
||||
struct wl_registry *registry;
|
||||
struct wl_compositor *compositor;
|
||||
struct wl_subcompositor *subcompositor;
|
||||
struct wl_shell *shell;
|
||||
struct wl_shell *desktop_shell;
|
||||
struct wl_shm *shm;
|
||||
|
@ -251,6 +253,8 @@ struct _Ecore_Wl_Window
|
|||
/* FIXME: Ideally we should record the cursor name for this window
|
||||
* so we can compare and avoid unnecessary cursor set calls to wayland */
|
||||
|
||||
Ecore_Wl_Subsurf *subsurfs;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
@ -381,6 +385,7 @@ struct _Ecore_Wl_Event_Interfaces_Bound
|
|||
* @li @ref Ecore_Wl_Window_Group
|
||||
* @li @ref Ecore_Wl_Input_Group
|
||||
* @li @ref Ecore_Wl_Dnd_Group
|
||||
* @li @ref Ecore_Wl_Subsurf
|
||||
*/
|
||||
|
||||
EAPI extern int ECORE_WL_EVENT_MOUSE_IN;
|
||||
|
@ -864,6 +869,93 @@ EAPI struct wl_array *ecore_wl_dnd_drag_types_get(Ecore_Wl_Input *input);
|
|||
|
||||
EAPI void ecore_wl_server_mode_set(Eina_Bool on);
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Wl_Subsurf Functions to manipulate subsurfaces.
|
||||
* @ingroup Ecore_Wl_Group
|
||||
*
|
||||
* Functions to manipulate wayland subsurfaces, using Ecore_Wl_Subsurf.
|
||||
*
|
||||
* This API is intended to expose Wayland subsurface functionality, although it
|
||||
* should not be necessary for most applications to use it, as soon as we have
|
||||
* means to make Evas automatically switch Evas images to use subsurfaces.
|
||||
*
|
||||
* It can/should be used, for instance, when subsurfaces are needed to be not
|
||||
* in sync with the main window surface.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create and return a new subsurface.
|
||||
*
|
||||
* Create a new surface (and subsurface interface), with the parent surface
|
||||
* being the one associated with the given @param win.
|
||||
*
|
||||
* The @param win must be visible, otherwise there will be no surface created
|
||||
* for it yet.
|
||||
*
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI Ecore_Wl_Subsurf *ecore_wl_subsurf_create(Ecore_Wl_Window *win);
|
||||
|
||||
/**
|
||||
* Destroy the given subsurface, as well as the surface associated with it.
|
||||
*
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void ecore_wl_subsurf_del(Ecore_Wl_Subsurf *ess);
|
||||
|
||||
/**
|
||||
* Return the wl_surface associated with this subsurface.
|
||||
*
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI struct wl_surface *ecore_wl_subsurf_surface_get(Ecore_Wl_Subsurf *ess);
|
||||
|
||||
/**
|
||||
* Set the position of this subsurface, relative to its parent surface.
|
||||
*
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void ecore_wl_subsurf_position_set(Ecore_Wl_Subsurf *ess, int x, int y);
|
||||
|
||||
/**
|
||||
* Get the position of this subsurface, relative to its parent surface.
|
||||
*
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void ecore_wl_subsurf_position_get(Ecore_Wl_Subsurf *ess, int *x, int *y);
|
||||
|
||||
/**
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void ecore_wl_subsurf_place_above(Ecore_Wl_Subsurf *ess, struct wl_surface *surface);
|
||||
|
||||
/**
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void ecore_wl_subsurf_place_below(Ecore_Wl_Subsurf *ess, struct wl_surface *surface);
|
||||
|
||||
/**
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void ecore_wl_subsurf_sync_set(Ecore_Wl_Subsurf *ess, Eina_Bool val);
|
||||
|
||||
/**
|
||||
* Set an opaque region for the given subsurface.
|
||||
*
|
||||
* Use a 0x0 region size to unset the opaque region.
|
||||
*
|
||||
* @ingroup Ecore_Wl_Subsurf
|
||||
* @since 1.8
|
||||
*/
|
||||
EAPI void ecore_wl_subsurf_opaque_region_set(Ecore_Wl_Subsurf *ess, int x, int y, int w, int h);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <fcntl.h>
|
||||
#include "ecore_wl_private.h"
|
||||
#include <subsurface-client-protocol.h>
|
||||
|
||||
/* local function prototypes */
|
||||
static Eina_Bool _ecore_wl_shutdown(Eina_Bool close);
|
||||
|
@ -397,6 +398,8 @@ _ecore_wl_shutdown(Eina_Bool close)
|
|||
wl_data_device_manager_destroy(_ecore_wl_disp->wl.data_device_manager);
|
||||
if (_ecore_wl_disp->wl.compositor)
|
||||
wl_compositor_destroy(_ecore_wl_disp->wl.compositor);
|
||||
if (_ecore_wl_disp->wl.subcompositor)
|
||||
wl_subcompositor_destroy(_ecore_wl_disp->wl.subcompositor);
|
||||
if (_ecore_wl_disp->wl.display)
|
||||
{
|
||||
wl_registry_destroy(_ecore_wl_disp->wl.registry);
|
||||
|
@ -515,6 +518,11 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
|
|||
ewd->wl.compositor =
|
||||
wl_registry_bind(registry, id, &wl_compositor_interface, 3);
|
||||
}
|
||||
else if (!strcmp(interface, "wl_subcompositor"))
|
||||
{
|
||||
ewd->wl.subcompositor =
|
||||
wl_registry_bind(registry, id, &wl_subcompositor_interface, 1);
|
||||
}
|
||||
else if (!strcmp(interface, "wl_output"))
|
||||
_ecore_wl_output_add(ewd, id);
|
||||
else if (!strcmp(interface, "wl_seat"))
|
||||
|
|
|
@ -95,4 +95,6 @@ void _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source);
|
|||
void _ecore_wl_events_init(void);
|
||||
void _ecore_wl_events_shutdown(void);
|
||||
|
||||
void _ecore_wl_subsurfs_del_all(Ecore_Wl_Window *win);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_wl_private.h"
|
||||
#include <subsurface-client-protocol.h>
|
||||
|
||||
struct _Ecore_Wl_Subsurf
|
||||
{
|
||||
EINA_INLIST;
|
||||
Ecore_Wl_Window *parent_win;
|
||||
struct wl_surface *surface;
|
||||
struct wl_subsurface *subsurface;
|
||||
|
||||
int x, y;
|
||||
|
||||
Eina_Bool sync : 1;
|
||||
};
|
||||
|
||||
EAPI Ecore_Wl_Subsurf *
|
||||
ecore_wl_subsurf_create(Ecore_Wl_Window *win)
|
||||
{
|
||||
struct wl_subsurface *subsurface;
|
||||
struct wl_surface *surface;
|
||||
Ecore_Wl_Subsurf *ess;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!win) return NULL;
|
||||
if (!win->surface) return NULL;
|
||||
if (!_ecore_wl_disp->wl.subcompositor) return NULL;
|
||||
|
||||
surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
|
||||
if (!surface)
|
||||
return NULL;
|
||||
|
||||
subsurface = wl_subcompositor_get_subsurface
|
||||
(_ecore_wl_disp->wl.subcompositor, surface, win->surface);
|
||||
if (!subsurface)
|
||||
{
|
||||
wl_surface_destroy(surface);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ess = calloc(1, sizeof(*ess));
|
||||
ess->surface = surface;
|
||||
ess->subsurface = subsurface;
|
||||
ess->parent_win = win;
|
||||
|
||||
win->subsurfs = (Ecore_Wl_Subsurf *)eina_inlist_append
|
||||
(EINA_INLIST_GET(win->subsurfs), EINA_INLIST_GET(ess));
|
||||
|
||||
return ess;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_wl_subsurf_destroy(Ecore_Wl_Subsurf *ess)
|
||||
{
|
||||
Ecore_Wl_Window *parent;
|
||||
|
||||
wl_subsurface_destroy(ess->subsurface);
|
||||
wl_surface_destroy(ess->surface);
|
||||
|
||||
parent = ess->parent_win;
|
||||
parent->subsurfs = (Ecore_Wl_Subsurf *)eina_inlist_remove
|
||||
(EINA_INLIST_GET(parent->subsurfs), EINA_INLIST_GET(ess));
|
||||
|
||||
free(ess);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_subsurf_del(Ecore_Wl_Subsurf *ess)
|
||||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!ess) return;
|
||||
|
||||
_ecore_wl_subsurf_destroy(ess);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl_subsurfs_del_all(Ecore_Wl_Window *win)
|
||||
{
|
||||
Ecore_Wl_Subsurf *ess;
|
||||
|
||||
if (!win) return;
|
||||
|
||||
EINA_INLIST_FREE(win->subsurfs, ess)
|
||||
{
|
||||
_ecore_wl_subsurf_destroy(ess);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI struct wl_surface *
|
||||
ecore_wl_subsurf_surface_get(Ecore_Wl_Subsurf *ess)
|
||||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!ess) return NULL;
|
||||
|
||||
return ess->surface;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_subsurf_position_set(Ecore_Wl_Subsurf *ess, int x, int y)
|
||||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!ess) return;
|
||||
|
||||
if ((x == ess->x) && (y == ess->y))
|
||||
return;
|
||||
|
||||
ess->x = x;
|
||||
ess->y = y;
|
||||
|
||||
wl_subsurface_set_position(ess->subsurface, x, y);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_subsurf_position_get(Ecore_Wl_Subsurf *ess, int *x, int *y)
|
||||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!ess) return;
|
||||
|
||||
if (x) *x = ess->x;
|
||||
if (y) *y = ess->y;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_subsurf_place_above(Ecore_Wl_Subsurf *ess, struct wl_surface *surface)
|
||||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!ess) return;
|
||||
if (!surface) return;
|
||||
|
||||
wl_subsurface_place_above(ess->subsurface, surface);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_subsurf_place_below(Ecore_Wl_Subsurf *ess, struct wl_surface *surface)
|
||||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!ess) return;
|
||||
if (!surface) return;
|
||||
|
||||
wl_subsurface_place_below(ess->subsurface, surface);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_subsurf_sync_set(Ecore_Wl_Subsurf *ess, Eina_Bool val)
|
||||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!ess) return;
|
||||
|
||||
val = !!val;
|
||||
if (val == ess->sync) return;
|
||||
|
||||
ess->sync = val;
|
||||
|
||||
if (ess->sync)
|
||||
wl_subsurface_set_sync(ess->subsurface);
|
||||
else
|
||||
wl_subsurface_set_desync(ess->subsurface);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl_subsurf_opaque_region_set(Ecore_Wl_Subsurf *ess, int x, int y, int w, int h)
|
||||
{
|
||||
Ecore_Wl_Window *parent;
|
||||
struct wl_region *region = NULL;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!ess) return;
|
||||
|
||||
if ((w > 0) && (h > 0))
|
||||
{
|
||||
parent = ess->parent_win;
|
||||
region = wl_compositor_create_region(parent->display->wl.compositor);
|
||||
wl_region_add(region, x, y, w, h);
|
||||
wl_surface_set_opaque_region(ess->surface, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
else
|
||||
wl_surface_set_opaque_region(ess->surface, NULL);
|
||||
}
|
|
@ -114,6 +114,8 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
|
|||
if (win->anim_callback) wl_callback_destroy(win->anim_callback);
|
||||
win->anim_callback = NULL;
|
||||
|
||||
if (win->subsurfs) _ecore_wl_subsurfs_del_all(win);
|
||||
|
||||
if (win->shell_surface) wl_shell_surface_destroy(win->shell_surface);
|
||||
win->shell_surface = NULL;
|
||||
if (win->surface) wl_surface_destroy(win->surface);
|
||||
|
|
Loading…
Reference in New Issue