2013-10-13 07:47:53 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:meta-surface-actor
|
|
|
|
* @title: MetaSurfaceActor
|
|
|
|
* @short_description: An actor representing a surface in the scene graph
|
|
|
|
*
|
2018-10-19 03:15:54 -04:00
|
|
|
* MetaSurfaceActor is an abstract class which represents a surface in the
|
|
|
|
* Clutter scene graph. A subclass can implement the specifics of a surface
|
|
|
|
* depending on the way it is handled by a display protocol.
|
|
|
|
*
|
|
|
|
* An important feature of #MetaSurfaceActor is that it allows you to set an
|
|
|
|
* "input region": all events that occur in the surface, but outside of the
|
|
|
|
* input region are to be explicitly ignored. By default, this region is to
|
|
|
|
* %NULL, which means events on the whole surface is allowed.
|
2013-10-13 07:47:53 -04:00
|
|
|
*/
|
|
|
|
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "config.h"
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "compositor/meta-surface-actor.h"
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "clutter/clutter.h"
|
2020-02-03 15:25:39 -05:00
|
|
|
#include "compositor/clutter-utils.h"
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "compositor/meta-cullable.h"
|
|
|
|
#include "compositor/meta-shaped-texture-private.h"
|
2019-07-12 13:33:17 -04:00
|
|
|
#include "compositor/meta-window-actor-private.h"
|
2019-07-12 12:56:14 -04:00
|
|
|
#include "compositor/region-utils.h"
|
2018-07-10 04:36:24 -04:00
|
|
|
#include "meta/meta-shaped-texture.h"
|
2013-10-13 07:47:53 -04:00
|
|
|
|
2018-10-31 06:47:17 -04:00
|
|
|
typedef struct _MetaSurfaceActorPrivate
|
2013-10-13 07:47:53 -04:00
|
|
|
{
|
2013-11-19 11:22:49 -05:00
|
|
|
MetaShapedTexture *texture;
|
2014-02-18 21:27:20 -05:00
|
|
|
|
|
|
|
cairo_region_t *input_region;
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
/* MetaCullable regions, see that documentation for more details */
|
|
|
|
cairo_region_t *clip_region;
|
|
|
|
cairo_region_t *unobscured_region;
|
|
|
|
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
/* Freeze/thaw accounting */
|
2016-06-17 11:45:20 -04:00
|
|
|
cairo_region_t *pending_damage;
|
2014-02-24 16:00:12 -05:00
|
|
|
guint frozen : 1;
|
2018-10-31 06:47:17 -04:00
|
|
|
} MetaSurfaceActorPrivate;
|
2013-10-13 07:47:53 -04:00
|
|
|
|
2013-11-21 16:25:20 -05:00
|
|
|
static void cullable_iface_init (MetaCullableInterface *iface);
|
|
|
|
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_TYPE_ACTOR,
|
2018-07-19 07:40:39 -04:00
|
|
|
G_ADD_PRIVATE (MetaSurfaceActor)
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
|
|
|
|
2018-12-19 03:04:25 -05:00
|
|
|
enum
|
|
|
|
{
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
REPAINT_SCHEDULED,
|
2014-07-31 05:05:34 -04:00
|
|
|
SIZE_CHANGED,
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
|
|
|
|
LAST_SIGNAL,
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL];
|
2013-12-06 11:57:40 -05:00
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
static cairo_region_t *
|
|
|
|
effective_unobscured_region (MetaSurfaceActor *surface_actor)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (surface_actor);
|
|
|
|
ClutterActor *actor;
|
|
|
|
|
|
|
|
/* Fail if we have any mapped clones. */
|
|
|
|
actor = CLUTTER_ACTOR (surface_actor);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (clutter_actor_has_mapped_clones (actor))
|
|
|
|
return NULL;
|
|
|
|
actor = clutter_actor_get_parent (actor);
|
|
|
|
}
|
|
|
|
while (actor != NULL);
|
|
|
|
|
|
|
|
return priv->unobscured_region;
|
|
|
|
}
|
|
|
|
|
2020-02-04 18:14:43 -05:00
|
|
|
static cairo_region_t*
|
|
|
|
get_scaled_region (MetaSurfaceActor *surface_actor,
|
|
|
|
cairo_region_t *region)
|
|
|
|
{
|
|
|
|
MetaWindowActor *window_actor;
|
|
|
|
int geometry_scale;
|
|
|
|
|
|
|
|
window_actor = meta_window_actor_from_actor (CLUTTER_ACTOR (surface_actor));
|
|
|
|
geometry_scale = meta_window_actor_get_geometry_scale (window_actor);
|
|
|
|
|
|
|
|
return meta_region_scale_double (region,
|
|
|
|
1.0 / geometry_scale,
|
|
|
|
META_ROUNDING_STRATEGY_GROW);
|
|
|
|
}
|
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
static void
|
|
|
|
set_unobscured_region (MetaSurfaceActor *surface_actor,
|
|
|
|
cairo_region_t *unobscured_region)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (surface_actor);
|
|
|
|
|
|
|
|
g_clear_pointer (&priv->unobscured_region, cairo_region_destroy);
|
|
|
|
if (unobscured_region)
|
|
|
|
{
|
|
|
|
cairo_rectangle_int_t bounds = { 0, };
|
|
|
|
float width, height;
|
|
|
|
|
|
|
|
clutter_content_get_preferred_size (CLUTTER_CONTENT (priv->texture),
|
|
|
|
&width,
|
|
|
|
&height);
|
|
|
|
bounds = (cairo_rectangle_int_t) {
|
|
|
|
.width = width,
|
|
|
|
.height = height,
|
|
|
|
};
|
|
|
|
|
2020-02-04 18:14:43 -05:00
|
|
|
priv->unobscured_region =
|
|
|
|
get_scaled_region (surface_actor, unobscured_region);
|
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_clip_region (MetaSurfaceActor *surface_actor,
|
|
|
|
cairo_region_t *clip_region)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (surface_actor);
|
|
|
|
|
|
|
|
g_clear_pointer (&priv->clip_region, cairo_region_destroy);
|
|
|
|
if (clip_region)
|
2020-02-04 18:14:43 -05:00
|
|
|
priv->clip_region = get_scaled_region (surface_actor, clip_region);
|
2019-01-29 16:53:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-11-13 16:21:58 -05:00
|
|
|
meta_surface_actor_paint (ClutterActor *actor,
|
|
|
|
ClutterPaintContext *paint_context)
|
2019-01-29 16:53:50 -05:00
|
|
|
{
|
|
|
|
MetaSurfaceActor *surface_actor = META_SURFACE_ACTOR (actor);
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (surface_actor);
|
|
|
|
|
|
|
|
if (priv->clip_region && cairo_region_is_empty (priv->clip_region))
|
|
|
|
return;
|
|
|
|
|
2019-11-13 16:21:58 -05:00
|
|
|
CLUTTER_ACTOR_CLASS (meta_surface_actor_parent_class)->paint (actor,
|
|
|
|
paint_context);
|
2019-01-29 16:53:50 -05:00
|
|
|
}
|
|
|
|
|
2014-02-18 21:27:20 -05:00
|
|
|
static void
|
2019-11-20 15:46:41 -05:00
|
|
|
meta_surface_actor_pick (ClutterActor *actor,
|
|
|
|
ClutterPickContext *pick_context)
|
2014-02-18 21:27:20 -05:00
|
|
|
{
|
|
|
|
MetaSurfaceActor *self = META_SURFACE_ACTOR (actor);
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
2014-11-23 07:32:08 -05:00
|
|
|
ClutterActorIter iter;
|
|
|
|
ClutterActor *child;
|
2014-02-18 21:27:20 -05:00
|
|
|
|
|
|
|
if (!clutter_actor_should_pick_paint (actor))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* If there is no region then use the regular pick */
|
|
|
|
if (priv->input_region == NULL)
|
2019-11-20 15:46:41 -05:00
|
|
|
{
|
|
|
|
ClutterActorClass *actor_class =
|
|
|
|
CLUTTER_ACTOR_CLASS (meta_surface_actor_parent_class);
|
|
|
|
|
|
|
|
actor_class->pick (actor, pick_context);
|
|
|
|
}
|
2014-02-18 21:27:20 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int n_rects;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
n_rects = cairo_region_num_rectangles (priv->input_region);
|
|
|
|
|
|
|
|
for (i = 0; i < n_rects; i++)
|
|
|
|
{
|
|
|
|
cairo_rectangle_int_t rect;
|
clutter: Introduce geometric picking
Currently, Clutter does picking by drawing with Cogl and reading
the pixel that's beneath the given point. Since Cogl has a journal
that records drawing operations, and has optimizations to read a
single pixel from a list of rectangle, it would be expected that
we would hit this fast path and not flush the journal while picking.
However, that's not the case: dithering, clipping with scissors, etc,
can all flush the journal, issuing commands to the GPU and making
picking slow. On NVidia-based systems, this glReadPixels() call is
extremely costly.
Introduce geometric picking, and avoid using the Cogl journal entirely.
Do this by introducing a stack of actors in ClutterStage. This stack
is cached, but for now, don't use the cache as much as possible.
The picking routines are still tied to painting.
When projecting the actor vertexes, do it manually and take the modelview
matrix of the framebuffer into account as well.
CPU usage on an Intel i7-7700, tested with two different GPUs/drivers:
| | Intel | Nvidia |
| ------: | --------: | -----: |
| Moving the mouse: |
| Before | 10% | 10% |
| After | 6% | 6% |
| Moving a window: |
| Before | 23% | 81% |
| After | 19% | 40% |
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154,
https://gitlab.gnome.org/GNOME/mutter/issues/691
Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283,
https://gitlab.gnome.org/GNOME/mutter/issues/590,
https://gitlab.gnome.org/GNOME/mutter/issues/700
v2: Fix code style issues
Simplify quadrilateral checks
Remove the 0.5f hack
Differentiate axis-aligned rectangles
https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2018-08-02 07:03:30 -04:00
|
|
|
ClutterActorBox box;
|
2014-02-18 21:27:20 -05:00
|
|
|
|
|
|
|
cairo_region_get_rectangle (priv->input_region, i, &rect);
|
|
|
|
|
clutter: Introduce geometric picking
Currently, Clutter does picking by drawing with Cogl and reading
the pixel that's beneath the given point. Since Cogl has a journal
that records drawing operations, and has optimizations to read a
single pixel from a list of rectangle, it would be expected that
we would hit this fast path and not flush the journal while picking.
However, that's not the case: dithering, clipping with scissors, etc,
can all flush the journal, issuing commands to the GPU and making
picking slow. On NVidia-based systems, this glReadPixels() call is
extremely costly.
Introduce geometric picking, and avoid using the Cogl journal entirely.
Do this by introducing a stack of actors in ClutterStage. This stack
is cached, but for now, don't use the cache as much as possible.
The picking routines are still tied to painting.
When projecting the actor vertexes, do it manually and take the modelview
matrix of the framebuffer into account as well.
CPU usage on an Intel i7-7700, tested with two different GPUs/drivers:
| | Intel | Nvidia |
| ------: | --------: | -----: |
| Moving the mouse: |
| Before | 10% | 10% |
| After | 6% | 6% |
| Moving a window: |
| Before | 23% | 81% |
| After | 19% | 40% |
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154,
https://gitlab.gnome.org/GNOME/mutter/issues/691
Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283,
https://gitlab.gnome.org/GNOME/mutter/issues/590,
https://gitlab.gnome.org/GNOME/mutter/issues/700
v2: Fix code style issues
Simplify quadrilateral checks
Remove the 0.5f hack
Differentiate axis-aligned rectangles
https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2018-08-02 07:03:30 -04:00
|
|
|
box.x1 = rect.x;
|
|
|
|
box.y1 = rect.y;
|
|
|
|
box.x2 = rect.x + rect.width;
|
|
|
|
box.y2 = rect.y + rect.height;
|
2019-11-20 15:46:41 -05:00
|
|
|
clutter_actor_pick_box (actor, pick_context, &box);
|
2014-02-18 21:27:20 -05:00
|
|
|
}
|
2014-11-23 07:32:08 -05:00
|
|
|
}
|
2014-10-20 12:44:55 -04:00
|
|
|
|
2014-11-23 07:32:08 -05:00
|
|
|
clutter_actor_iter_init (&iter, actor);
|
2014-10-20 12:44:55 -04:00
|
|
|
|
2014-11-23 07:32:08 -05:00
|
|
|
while (clutter_actor_iter_next (&iter, &child))
|
2019-11-20 15:46:41 -05:00
|
|
|
clutter_actor_pick (child, pick_context);
|
2014-02-18 21:27:20 -05:00
|
|
|
}
|
|
|
|
|
2018-04-28 12:14:34 -04:00
|
|
|
static gboolean
|
|
|
|
meta_surface_actor_get_paint_volume (ClutterActor *actor,
|
|
|
|
ClutterPaintVolume *volume)
|
|
|
|
{
|
|
|
|
return clutter_paint_volume_set_from_allocation (volume, actor);
|
|
|
|
}
|
|
|
|
|
2014-02-18 21:27:20 -05:00
|
|
|
static void
|
|
|
|
meta_surface_actor_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
MetaSurfaceActor *self = META_SURFACE_ACTOR (object);
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
2014-02-18 21:27:20 -05:00
|
|
|
|
|
|
|
g_clear_pointer (&priv->input_region, cairo_region_destroy);
|
2019-08-26 13:14:00 -04:00
|
|
|
g_clear_object (&priv->texture);
|
2014-02-18 21:27:20 -05:00
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
set_unobscured_region (self, NULL);
|
|
|
|
set_clip_region (self, NULL);
|
|
|
|
|
2014-02-18 21:27:20 -05:00
|
|
|
G_OBJECT_CLASS (meta_surface_actor_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2013-10-13 07:47:53 -04:00
|
|
|
static void
|
|
|
|
meta_surface_actor_class_init (MetaSurfaceActorClass *klass)
|
|
|
|
{
|
2014-02-18 21:27:20 -05:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->dispose = meta_surface_actor_dispose;
|
2019-01-29 16:53:50 -05:00
|
|
|
actor_class->paint = meta_surface_actor_paint;
|
2014-02-18 21:27:20 -05:00
|
|
|
actor_class->pick = meta_surface_actor_pick;
|
2018-04-28 12:14:34 -04:00
|
|
|
actor_class->get_paint_volume = meta_surface_actor_get_paint_volume;
|
2014-02-18 21:27:20 -05:00
|
|
|
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
signals[REPAINT_SCHEDULED] = g_signal_new ("repaint-scheduled",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2014-07-31 05:05:34 -04:00
|
|
|
signals[SIZE_CHANGED] = g_signal_new ("size-changed",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 0);
|
2013-10-13 07:47:53 -04:00
|
|
|
}
|
|
|
|
|
2019-08-17 04:00:46 -04:00
|
|
|
gboolean
|
|
|
|
meta_surface_actor_is_opaque (MetaSurfaceActor *self)
|
|
|
|
{
|
|
|
|
return META_SURFACE_ACTOR_GET_CLASS (self)->is_opaque (self);
|
|
|
|
}
|
|
|
|
|
2013-11-21 16:25:20 -05:00
|
|
|
static void
|
|
|
|
meta_surface_actor_cull_out (MetaCullable *cullable,
|
2013-12-06 20:28:39 -05:00
|
|
|
cairo_region_t *unobscured_region,
|
|
|
|
cairo_region_t *clip_region)
|
2013-11-21 16:25:20 -05:00
|
|
|
{
|
2018-12-26 10:41:26 -05:00
|
|
|
MetaSurfaceActor *surface_actor = META_SURFACE_ACTOR (cullable);
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (surface_actor);
|
|
|
|
uint8_t opacity = clutter_actor_get_opacity (CLUTTER_ACTOR (cullable));
|
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
set_unobscured_region (surface_actor, unobscured_region);
|
|
|
|
set_clip_region (surface_actor, clip_region);
|
|
|
|
|
|
|
|
if (opacity == 0xff)
|
|
|
|
{
|
2019-07-12 13:33:17 -04:00
|
|
|
MetaWindowActor *window_actor;
|
2019-07-12 12:56:14 -04:00
|
|
|
cairo_region_t *scaled_opaque_region;
|
2019-01-29 16:53:50 -05:00
|
|
|
cairo_region_t *opaque_region;
|
2019-07-12 13:33:17 -04:00
|
|
|
int geometry_scale = 1;
|
2019-01-29 16:53:50 -05:00
|
|
|
|
|
|
|
opaque_region = meta_shaped_texture_get_opaque_region (priv->texture);
|
|
|
|
|
2019-07-12 12:56:14 -04:00
|
|
|
if (!opaque_region)
|
|
|
|
return;
|
|
|
|
|
2019-07-12 13:33:17 -04:00
|
|
|
window_actor =
|
|
|
|
meta_window_actor_from_actor (CLUTTER_ACTOR (surface_actor));
|
|
|
|
if (window_actor)
|
|
|
|
geometry_scale = meta_window_actor_get_geometry_scale (window_actor);
|
|
|
|
|
2019-07-12 12:56:14 -04:00
|
|
|
scaled_opaque_region = meta_region_scale (opaque_region, geometry_scale);
|
|
|
|
|
|
|
|
if (unobscured_region)
|
|
|
|
cairo_region_subtract (unobscured_region, scaled_opaque_region);
|
|
|
|
if (clip_region)
|
|
|
|
cairo_region_subtract (clip_region, scaled_opaque_region);
|
|
|
|
|
|
|
|
cairo_region_destroy (scaled_opaque_region);
|
2019-01-29 16:53:50 -05:00
|
|
|
}
|
2013-11-21 16:25:20 -05:00
|
|
|
}
|
|
|
|
|
2020-02-03 15:25:39 -05:00
|
|
|
static gboolean
|
|
|
|
meta_surface_actor_is_untransformed (MetaCullable *cullable)
|
|
|
|
{
|
|
|
|
ClutterActor *actor = CLUTTER_ACTOR (cullable);
|
|
|
|
MetaWindowActor *window_actor;
|
|
|
|
float width, height;
|
|
|
|
graphene_point3d_t verts[4];
|
|
|
|
int geometry_scale;
|
|
|
|
|
|
|
|
clutter_actor_get_size (actor, &width, &height);
|
|
|
|
clutter_actor_get_abs_allocation_vertices (actor, verts);
|
|
|
|
|
|
|
|
window_actor = meta_window_actor_from_actor (actor);
|
|
|
|
geometry_scale = meta_window_actor_get_geometry_scale (window_actor);
|
|
|
|
|
|
|
|
return meta_actor_vertices_are_untransformed (verts,
|
|
|
|
width * geometry_scale,
|
|
|
|
height * geometry_scale,
|
|
|
|
NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2013-11-21 16:25:20 -05:00
|
|
|
static void
|
|
|
|
meta_surface_actor_reset_culling (MetaCullable *cullable)
|
|
|
|
{
|
2018-12-26 10:41:26 -05:00
|
|
|
MetaSurfaceActor *surface_actor = META_SURFACE_ACTOR (cullable);
|
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
set_clip_region (surface_actor, NULL);
|
2013-11-21 16:25:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cullable_iface_init (MetaCullableInterface *iface)
|
|
|
|
{
|
|
|
|
iface->cull_out = meta_surface_actor_cull_out;
|
2020-02-03 15:25:39 -05:00
|
|
|
iface->is_untransformed = meta_surface_actor_is_untransformed;
|
2013-11-21 16:25:20 -05:00
|
|
|
iface->reset_culling = meta_surface_actor_reset_culling;
|
|
|
|
}
|
|
|
|
|
2014-07-31 05:05:34 -04:00
|
|
|
static void
|
|
|
|
texture_size_changed (MetaShapedTexture *texture,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
MetaSurfaceActor *actor = META_SURFACE_ACTOR (user_data);
|
|
|
|
g_signal_emit (actor, signals[SIZE_CHANGED], 0);
|
|
|
|
}
|
|
|
|
|
2013-10-13 07:47:53 -04:00
|
|
|
static void
|
|
|
|
meta_surface_actor_init (MetaSurfaceActor *self)
|
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
2013-10-13 07:47:53 -04:00
|
|
|
|
2018-12-26 10:41:26 -05:00
|
|
|
priv->texture = meta_shaped_texture_new ();
|
2014-07-31 05:05:34 -04:00
|
|
|
g_signal_connect_object (priv->texture, "size-changed",
|
|
|
|
G_CALLBACK (texture_size_changed), self, 0);
|
2018-12-26 10:41:26 -05:00
|
|
|
clutter_actor_set_content (CLUTTER_ACTOR (self),
|
|
|
|
CLUTTER_CONTENT (priv->texture));
|
|
|
|
clutter_actor_set_request_mode (CLUTTER_ACTOR (self),
|
|
|
|
CLUTTER_REQUEST_CONTENT_SIZE);
|
2013-10-13 07:47:53 -04:00
|
|
|
}
|
|
|
|
|
2019-09-13 00:01:54 -04:00
|
|
|
/**
|
|
|
|
* meta_surface_actor_get_image:
|
|
|
|
* @self: A #MetaSurfaceActor
|
|
|
|
* @clip: (nullable): A clipping rectangle. The clip region is in
|
|
|
|
* the same coordinate space as the contents preferred size.
|
|
|
|
* For a shaped texture of a wl_surface, this means surface
|
|
|
|
* coordinate space. If NULL, the whole content will be used.
|
|
|
|
*
|
|
|
|
* Get the image from the texture content. The resulting size of
|
|
|
|
* the returned image may be different from the preferred size of
|
|
|
|
* the shaped texture content.
|
|
|
|
*
|
|
|
|
* Returns: (nullable) (transfer full): a new cairo surface to be freed
|
|
|
|
* with cairo_surface_destroy().
|
|
|
|
*/
|
2013-10-13 07:47:53 -04:00
|
|
|
cairo_surface_t *
|
|
|
|
meta_surface_actor_get_image (MetaSurfaceActor *self,
|
|
|
|
cairo_rectangle_int_t *clip)
|
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return meta_shaped_texture_get_image (priv->texture, clip);
|
2013-10-13 07:47:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
MetaShapedTexture *
|
|
|
|
meta_surface_actor_get_texture (MetaSurfaceActor *self)
|
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return priv->texture;
|
2013-10-13 07:47:53 -04:00
|
|
|
}
|
|
|
|
|
2014-08-21 16:19:23 -04:00
|
|
|
static void
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
meta_surface_actor_update_area (MetaSurfaceActor *self,
|
|
|
|
int x, int y, int width, int height)
|
2013-12-06 11:57:40 -05:00
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
2019-01-29 16:53:50 -05:00
|
|
|
gboolean repaint_scheduled = FALSE;
|
|
|
|
cairo_rectangle_int_t clip;
|
|
|
|
|
|
|
|
if (meta_shaped_texture_update_area (priv->texture, x, y, width, height, &clip))
|
|
|
|
{
|
|
|
|
cairo_region_t *unobscured_region;
|
2013-12-06 11:57:40 -05:00
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
unobscured_region = effective_unobscured_region (self);
|
|
|
|
|
|
|
|
if (unobscured_region)
|
|
|
|
{
|
|
|
|
cairo_region_t *intersection;
|
|
|
|
|
|
|
|
if (cairo_region_is_empty (unobscured_region))
|
|
|
|
return;
|
|
|
|
|
|
|
|
intersection = cairo_region_copy (unobscured_region);
|
|
|
|
cairo_region_intersect_rectangle (intersection, &clip);
|
|
|
|
|
|
|
|
if (!cairo_region_is_empty (intersection))
|
|
|
|
{
|
|
|
|
cairo_rectangle_int_t damage_rect;
|
|
|
|
|
|
|
|
cairo_region_get_extents (intersection, &damage_rect);
|
|
|
|
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (self), &damage_rect);
|
|
|
|
repaint_scheduled = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
cairo_region_destroy (intersection);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (self), &clip);
|
|
|
|
repaint_scheduled = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (repaint_scheduled)
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
g_signal_emit (self, signals[REPAINT_SCHEDULED], 0);
|
2013-12-06 11:57:40 -05:00
|
|
|
}
|
|
|
|
|
2013-10-13 07:47:53 -04:00
|
|
|
gboolean
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
meta_surface_actor_is_obscured (MetaSurfaceActor *self)
|
2013-10-13 07:47:53 -04:00
|
|
|
{
|
2019-01-29 16:53:50 -05:00
|
|
|
cairo_region_t *unobscured_region;
|
2018-10-31 06:47:17 -04:00
|
|
|
|
2019-01-29 16:53:50 -05:00
|
|
|
unobscured_region = effective_unobscured_region (self);
|
|
|
|
|
|
|
|
if (unobscured_region)
|
|
|
|
return cairo_region_is_empty (unobscured_region);
|
|
|
|
else
|
|
|
|
return FALSE;
|
2013-12-06 11:57:40 -05:00
|
|
|
}
|
|
|
|
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
void
|
|
|
|
meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
|
|
|
cairo_region_t *region)
|
2013-12-06 11:57:40 -05:00
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
2013-12-06 11:57:40 -05:00
|
|
|
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
if (priv->input_region)
|
|
|
|
cairo_region_destroy (priv->input_region);
|
|
|
|
|
|
|
|
if (region)
|
|
|
|
priv->input_region = cairo_region_reference (region);
|
|
|
|
else
|
|
|
|
priv->input_region = NULL;
|
2014-02-05 14:06:32 -05:00
|
|
|
}
|
|
|
|
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
void
|
|
|
|
meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
|
|
|
cairo_region_t *region)
|
2014-02-05 14:06:32 -05:00
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
meta_shaped_texture_set_opaque_region (priv->texture, region);
|
2013-10-13 07:47:53 -04:00
|
|
|
}
|
|
|
|
|
2016-03-21 16:43:50 -04:00
|
|
|
cairo_region_t *
|
2018-10-31 06:47:17 -04:00
|
|
|
meta_surface_actor_get_opaque_region (MetaSurfaceActor *self)
|
2016-03-21 16:43:50 -04:00
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
2016-03-21 16:43:50 -04:00
|
|
|
return meta_shaped_texture_get_opaque_region (priv->texture);
|
|
|
|
}
|
|
|
|
|
2013-11-21 17:45:05 -05:00
|
|
|
void
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
|
|
|
int x, int y, int width, int height)
|
2013-12-09 16:01:07 -05:00
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
|
2019-12-06 10:35:37 -05:00
|
|
|
if (meta_surface_actor_is_frozen (self))
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
{
|
|
|
|
/* The window is frozen due to an effect in progress: we ignore damage
|
|
|
|
* here on the off chance that this will stop the corresponding
|
|
|
|
* texture_from_pixmap from being update.
|
|
|
|
*
|
2016-06-17 11:45:20 -04:00
|
|
|
* pending_damage tracks any damage that happened while the window was
|
|
|
|
* frozen so that when can apply it when the window becomes unfrozen.
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
*
|
|
|
|
* It should be noted that this is an unreliable mechanism since it's
|
|
|
|
* quite likely that drivers will aim to provide a zero-copy
|
|
|
|
* implementation of the texture_from_pixmap extension and in those cases
|
|
|
|
* any drawing done to the window is always immediately reflected in the
|
|
|
|
* texture regardless of damage event handling.
|
|
|
|
*/
|
2016-06-17 11:45:20 -04:00
|
|
|
cairo_rectangle_int_t rect = { .x = x, .y = y, .width = width, .height = height };
|
|
|
|
|
|
|
|
if (!priv->pending_damage)
|
|
|
|
priv->pending_damage = cairo_region_create_rectangle (&rect);
|
|
|
|
else
|
|
|
|
cairo_region_union_rectangle (priv->pending_damage, &rect);
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width, height);
|
2014-08-21 18:30:56 -04:00
|
|
|
|
|
|
|
if (meta_surface_actor_is_visible (self))
|
|
|
|
meta_surface_actor_update_area (self, x, y, width, height);
|
2013-12-09 16:01:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
meta_surface_actor_pre_paint (MetaSurfaceActor *self)
|
2013-12-09 16:01:07 -05:00
|
|
|
{
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
META_SURFACE_ACTOR_GET_CLASS (self)->pre_paint (self);
|
|
|
|
}
|
2014-02-18 21:27:20 -05:00
|
|
|
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
gboolean
|
|
|
|
meta_surface_actor_is_visible (MetaSurfaceActor *self)
|
|
|
|
{
|
|
|
|
return META_SURFACE_ACTOR_GET_CLASS (self)->is_visible (self);
|
2013-12-09 16:01:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-02-24 16:00:12 -05:00
|
|
|
meta_surface_actor_set_frozen (MetaSurfaceActor *self,
|
|
|
|
gboolean frozen)
|
2013-12-09 16:01:07 -05:00
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
|
2014-02-24 16:00:12 -05:00
|
|
|
priv->frozen = frozen;
|
2013-12-06 14:19:32 -05:00
|
|
|
|
2016-06-17 11:45:20 -04:00
|
|
|
if (!frozen && priv->pending_damage)
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
{
|
2016-06-17 11:45:20 -04:00
|
|
|
int i, n_rects = cairo_region_num_rectangles (priv->pending_damage);
|
|
|
|
cairo_rectangle_int_t rect;
|
|
|
|
|
2014-02-24 16:00:12 -05:00
|
|
|
/* Since we ignore damage events while a window is frozen for certain effects
|
2016-06-17 11:45:20 -04:00
|
|
|
* we need to apply the tracked damage now. */
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
|
2016-06-17 11:45:20 -04:00
|
|
|
for (i = 0; i < n_rects; i++)
|
|
|
|
{
|
|
|
|
cairo_region_get_rectangle (priv->pending_damage, i, &rect);
|
|
|
|
meta_surface_actor_process_damage (self, rect.x, rect.y,
|
|
|
|
rect.width, rect.height);
|
|
|
|
}
|
|
|
|
g_clear_pointer (&priv->pending_damage, cairo_region_destroy);
|
window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:
* X11 compositor. In this case, we're a traditional X11 compositor,
not a Wayland compositor. We use XCompositeNameWindowPixmap to get
the backing pixmap for the window, and deal with the COMPOSITE
extension messiness.
In this case, meta_is_wayland_compositor() is FALSE.
* Wayland clients. In this case, we're a Wayland compositor managing
Wayland surfaces. The rendering for this is fairly straightforward,
as Cogl handles most of the complexity with EGL and SHM buffers...
Wayland clients give us the input and opaque regions through
wl_surface.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.
* XWayland clients. In this case, we're a Wayland compositor, like
above, and XWayland hands us Wayland surfaces. XWayland handles
the COMPOSITE extension messiness for us, and hands us a buffer
like any other Wayland client. We have to fetch the input and
opaque regions from the X11 window ourselves.
In this case, meta_is_wayland_compositor() is TRUE and
priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.
We now split the rendering logic into two subclasses, which are:
* MetaSurfaceActorX11, which handles the X11 compositor case, in that
it uses XCompositeNameWindowPixmap to get the backing pixmap, and
deal with all the COMPOSITE extension messiness.
* MetaSurfaceActorWayland, which handles the Wayland compositor case
for both native Wayland clients and XWayland clients. XWayland handles
COMPOSITE for us, and handles pushing a surface over through the
xf86-video-wayland DDX.
Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 17:21:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:35:37 -05:00
|
|
|
gboolean
|
|
|
|
meta_surface_actor_is_frozen (MetaSurfaceActor *self)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return priv->frozen;
|
|
|
|
}
|
|
|
|
|
2018-11-24 12:27:29 -05:00
|
|
|
void
|
|
|
|
meta_surface_actor_set_transform (MetaSurfaceActor *self,
|
|
|
|
MetaMonitorTransform transform)
|
|
|
|
{
|
2018-10-31 06:47:17 -04:00
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
2018-11-24 12:27:29 -05:00
|
|
|
|
|
|
|
meta_shaped_texture_set_transform (priv->texture, transform);
|
|
|
|
}
|
2018-11-30 09:34:00 -05:00
|
|
|
|
|
|
|
void
|
2019-02-20 10:23:04 -05:00
|
|
|
meta_surface_actor_set_viewport_src_rect (MetaSurfaceActor *self,
|
|
|
|
graphene_rect_t *src_rect)
|
2018-11-30 09:34:00 -05:00
|
|
|
{
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
meta_shaped_texture_set_viewport_src_rect (priv->texture, src_rect);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_surface_actor_reset_viewport_src_rect (MetaSurfaceActor *self)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
meta_shaped_texture_reset_viewport_src_rect (priv->texture);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_surface_actor_set_viewport_dst_size (MetaSurfaceActor *self,
|
|
|
|
int dst_width,
|
|
|
|
int dst_height)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
meta_shaped_texture_set_viewport_dst_size (priv->texture,
|
|
|
|
dst_width,
|
|
|
|
dst_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_surface_actor_reset_viewport_dst_size (MetaSurfaceActor *self)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorPrivate *priv =
|
|
|
|
meta_surface_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
meta_shaped_texture_reset_viewport_dst_size (priv->texture);
|
|
|
|
}
|