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
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Red Hat
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* Written by:
|
|
|
|
* Jasper St. Pierre <jstpierre@mecheye.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "meta-surface-actor-wayland.h"
|
|
|
|
|
wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.
DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.
https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-02-03 02:49:52 -05:00
|
|
|
#include <math.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
|
|
|
#include <cogl/cogl-wayland-server.h>
|
|
|
|
#include "meta-shaped-texture-private.h"
|
2014-03-18 22:01:31 -04:00
|
|
|
|
2016-12-12 21:37:11 -05:00
|
|
|
#include "backends/meta-logical-monitor.h"
|
2015-03-25 05:18:35 -04:00
|
|
|
#include "wayland/meta-wayland-buffer.h"
|
2014-03-18 22:01:31 -04:00
|
|
|
#include "wayland/meta-wayland-private.h"
|
2015-03-23 09:10:20 -04:00
|
|
|
#include "wayland/meta-window-wayland.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
|
|
|
|
2015-03-02 09:56:35 -05:00
|
|
|
#include "compositor/region-utils.h"
|
|
|
|
|
2015-07-10 04:14:51 -04:00
|
|
|
enum {
|
|
|
|
PAINTING,
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL];
|
|
|
|
|
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
|
|
|
struct _MetaSurfaceActorWaylandPrivate
|
|
|
|
{
|
|
|
|
MetaWaylandSurface *surface;
|
2015-07-23 11:22:22 -04:00
|
|
|
struct wl_list frame_callback_list;
|
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
|
|
|
};
|
|
|
|
typedef struct _MetaSurfaceActorWaylandPrivate MetaSurfaceActorWaylandPrivate;
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorWayland, meta_surface_actor_wayland, META_TYPE_SURFACE_ACTOR)
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_surface_actor_wayland_process_damage (MetaSurfaceActor *actor,
|
|
|
|
int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_surface_actor_wayland_pre_paint (MetaSurfaceActor *actor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_surface_actor_wayland_is_visible (MetaSurfaceActor *actor)
|
|
|
|
{
|
|
|
|
/* TODO: ensure that the buffer isn't NULL, implement
|
|
|
|
* wayland mapping semantics */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_surface_actor_wayland_should_unredirect (MetaSurfaceActor *actor)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_surface_actor_wayland_set_unredirected (MetaSurfaceActor *actor,
|
|
|
|
gboolean unredirected)
|
|
|
|
{
|
|
|
|
/* Do nothing. In the future, we'll use KMS to set this
|
|
|
|
* up as a hardware overlay or something. */
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_surface_actor_wayland_is_unredirected (MetaSurfaceActor *actor)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-26 06:55:54 -04:00
|
|
|
double
|
2016-01-18 03:56:27 -05:00
|
|
|
meta_surface_actor_wayland_get_scale (MetaSurfaceActorWayland *self)
|
2014-04-26 06:55:54 -04:00
|
|
|
{
|
2016-01-18 03:56:27 -05:00
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
2015-03-23 09:10:20 -04:00
|
|
|
MetaWindow *window;
|
2014-04-26 06:55:54 -04:00
|
|
|
int output_scale = 1;
|
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
g_assert (surface);
|
2015-07-03 00:27:41 -04:00
|
|
|
|
2015-03-23 09:10:20 -04:00
|
|
|
window = meta_wayland_surface_get_toplevel_window (surface);
|
2014-04-26 06:55:54 -04:00
|
|
|
|
|
|
|
/* XXX: We do not handle x11 clients yet */
|
|
|
|
if (window && window->client_type != META_WINDOW_CLIENT_TYPE_X11)
|
2015-03-23 09:10:20 -04:00
|
|
|
output_scale = meta_window_wayland_get_main_monitor_scale (window);
|
2014-04-26 06:55:54 -04:00
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
return (double) output_scale / (double) surface->scale;
|
2014-04-26 06:55:54 -04:00
|
|
|
}
|
|
|
|
|
2015-03-04 22:11:09 -05:00
|
|
|
static void
|
|
|
|
logical_to_actor_position (MetaSurfaceActorWayland *self,
|
|
|
|
int *x,
|
|
|
|
int *y)
|
|
|
|
{
|
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
|
|
|
MetaWindow *toplevel_window;
|
|
|
|
int monitor_scale = 1;
|
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
g_assert (surface);
|
|
|
|
|
2015-03-04 22:11:09 -05:00
|
|
|
toplevel_window = meta_wayland_surface_get_toplevel_window (surface);
|
|
|
|
if (toplevel_window)
|
|
|
|
monitor_scale = meta_window_wayland_get_main_monitor_scale (toplevel_window);
|
|
|
|
|
|
|
|
*x = *x * monitor_scale;
|
|
|
|
*y = *y * monitor_scale;
|
|
|
|
}
|
|
|
|
|
2015-03-25 05:18:35 -04:00
|
|
|
/* Convert the current actor state to the corresponding subsurface rectangle
|
|
|
|
* in logical pixel coordinate space. */
|
|
|
|
void
|
|
|
|
meta_surface_actor_wayland_get_subsurface_rect (MetaSurfaceActorWayland *self,
|
|
|
|
MetaRectangle *rect)
|
|
|
|
{
|
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
2016-03-16 02:47:53 -04:00
|
|
|
MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface);
|
2016-01-18 03:56:27 -05:00
|
|
|
CoglTexture *texture;
|
2015-03-25 05:18:35 -04:00
|
|
|
MetaWindow *toplevel_window;
|
|
|
|
int monitor_scale;
|
|
|
|
float x, y;
|
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
g_assert (surface);
|
|
|
|
|
|
|
|
texture = buffer->texture;
|
2015-03-25 05:18:35 -04:00
|
|
|
toplevel_window = meta_wayland_surface_get_toplevel_window (surface);
|
|
|
|
monitor_scale = meta_window_wayland_get_main_monitor_scale (toplevel_window);
|
|
|
|
|
|
|
|
clutter_actor_get_position (CLUTTER_ACTOR (self), &x, &y);
|
|
|
|
*rect = (MetaRectangle) {
|
|
|
|
.x = x / monitor_scale,
|
|
|
|
.y = y / monitor_scale,
|
|
|
|
.width = cogl_texture_get_width (texture) / surface->scale,
|
|
|
|
.height = cogl_texture_get_height (texture) / surface->scale,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-03-04 22:11:09 -05:00
|
|
|
void
|
|
|
|
meta_surface_actor_wayland_sync_subsurface_state (MetaSurfaceActorWayland *self)
|
|
|
|
{
|
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
|
|
|
MetaWindow *window;
|
|
|
|
int x = surface->offset_x + surface->sub.x;
|
|
|
|
int y = surface->offset_y + surface->sub.y;
|
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
g_assert (surface);
|
|
|
|
|
2015-03-04 22:11:09 -05:00
|
|
|
window = meta_wayland_surface_get_toplevel_window (surface);
|
|
|
|
if (window && window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
|
|
|
{
|
|
|
|
/* Bail directly if this is part of a Xwayland window and warn
|
|
|
|
* if there happen to be offsets anyway since that is not supposed
|
|
|
|
* to happen. */
|
|
|
|
g_warn_if_fail (x == 0 && y == 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
logical_to_actor_position (self, &x, &y);
|
|
|
|
clutter_actor_set_position (CLUTTER_ACTOR (self), x, y);
|
|
|
|
}
|
|
|
|
|
2014-05-03 05:59:07 -04:00
|
|
|
void
|
2015-03-02 09:56:35 -05:00
|
|
|
meta_surface_actor_wayland_sync_state (MetaSurfaceActorWayland *self)
|
2014-05-03 05:59:07 -04:00
|
|
|
{
|
2015-03-02 09:56:35 -05:00
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
|
|
|
MetaShapedTexture *stex =
|
|
|
|
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
|
|
|
double texture_scale;
|
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
g_assert (surface);
|
|
|
|
|
2015-03-02 09:56:35 -05:00
|
|
|
/* Given the surface's window type and what output the surface actor has the
|
|
|
|
* largest region, scale the actor with the determined scale. */
|
|
|
|
texture_scale = meta_surface_actor_wayland_get_scale (self);
|
|
|
|
|
|
|
|
/* Actor scale. */
|
|
|
|
clutter_actor_set_scale (CLUTTER_ACTOR (stex), texture_scale, texture_scale);
|
|
|
|
|
|
|
|
/* Input region */
|
|
|
|
if (surface->input_region)
|
|
|
|
{
|
|
|
|
cairo_region_t *scaled_input_region;
|
|
|
|
int region_scale;
|
|
|
|
|
|
|
|
/* The input region from the Wayland surface is in the Wayland surface
|
|
|
|
* coordinate space, while the surface actor input region is in the
|
|
|
|
* physical pixel coordinate space. */
|
|
|
|
region_scale = (int)(surface->scale * texture_scale);
|
|
|
|
scaled_input_region = meta_region_scale (surface->input_region,
|
|
|
|
region_scale);
|
|
|
|
meta_surface_actor_set_input_region (META_SURFACE_ACTOR (self),
|
|
|
|
scaled_input_region);
|
|
|
|
cairo_region_destroy (scaled_input_region);
|
|
|
|
}
|
2015-08-04 02:58:26 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_surface_actor_set_input_region (META_SURFACE_ACTOR (self), NULL);
|
|
|
|
}
|
2014-05-03 05:59:07 -04:00
|
|
|
|
2015-03-02 09:56:35 -05:00
|
|
|
/* Opaque region */
|
|
|
|
if (surface->opaque_region)
|
|
|
|
{
|
|
|
|
cairo_region_t *scaled_opaque_region;
|
|
|
|
|
|
|
|
/* The opaque region from the Wayland surface is in Wayland surface
|
|
|
|
* coordinate space, while the surface actor opaque region is in the
|
|
|
|
* same coordinate space as the unscaled buffer texture. */
|
|
|
|
scaled_opaque_region = meta_region_scale (surface->opaque_region,
|
|
|
|
surface->scale);
|
|
|
|
meta_surface_actor_set_opaque_region (META_SURFACE_ACTOR (self),
|
|
|
|
scaled_opaque_region);
|
|
|
|
cairo_region_destroy (scaled_opaque_region);
|
|
|
|
}
|
2015-08-04 02:58:26 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_surface_actor_set_opaque_region (META_SURFACE_ACTOR (self), NULL);
|
|
|
|
}
|
2015-03-04 22:11:09 -05:00
|
|
|
|
|
|
|
meta_surface_actor_wayland_sync_subsurface_state (self);
|
2014-05-03 05:59:07 -04:00
|
|
|
}
|
|
|
|
|
2015-03-02 22:13:05 -05:00
|
|
|
void
|
|
|
|
meta_surface_actor_wayland_sync_state_recursive (MetaSurfaceActorWayland *self)
|
|
|
|
{
|
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
2016-01-18 03:56:27 -05:00
|
|
|
MetaWindow *window;
|
2015-03-02 22:13:05 -05:00
|
|
|
GList *iter;
|
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
g_assert (surface);
|
|
|
|
|
|
|
|
window = meta_wayland_surface_get_toplevel_window (surface);
|
2015-03-02 22:13:05 -05:00
|
|
|
meta_surface_actor_wayland_sync_state (self);
|
|
|
|
|
2015-03-04 22:11:09 -05:00
|
|
|
if (window && window->client_type != META_WINDOW_CLIENT_TYPE_X11)
|
2015-03-02 22:13:05 -05:00
|
|
|
{
|
2015-03-04 22:11:09 -05:00
|
|
|
for (iter = surface->subsurfaces; iter != NULL; iter = iter->next)
|
|
|
|
{
|
|
|
|
MetaWaylandSurface *subsurf = iter->data;
|
2015-03-02 22:13:05 -05:00
|
|
|
|
2015-03-04 22:11:09 -05:00
|
|
|
meta_surface_actor_wayland_sync_state_recursive (
|
|
|
|
META_SURFACE_ACTOR_WAYLAND (subsurf->surface_actor));
|
|
|
|
}
|
2015-03-02 22:13:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.
DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.
https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-02-03 02:49:52 -05:00
|
|
|
gboolean
|
|
|
|
meta_surface_actor_wayland_is_on_monitor (MetaSurfaceActorWayland *self,
|
2016-11-25 01:31:38 -05:00
|
|
|
MetaLogicalMonitor *logical_monitor)
|
wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.
DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.
https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-02-03 02:49:52 -05:00
|
|
|
{
|
|
|
|
float x, y, width, height;
|
|
|
|
cairo_rectangle_int_t actor_rect;
|
|
|
|
cairo_region_t *region;
|
|
|
|
gboolean is_on_monitor;
|
|
|
|
|
|
|
|
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
|
|
|
|
clutter_actor_get_transformed_size (CLUTTER_ACTOR (self), &width, &height);
|
|
|
|
|
|
|
|
actor_rect.x = (int)roundf (x);
|
|
|
|
actor_rect.y = (int)roundf (y);
|
|
|
|
actor_rect.width = (int)roundf (x + width) - actor_rect.x;
|
|
|
|
actor_rect.height = (int)roundf (y + height) - actor_rect.y;
|
|
|
|
|
|
|
|
/* Calculate the scaled surface actor region. */
|
|
|
|
region = cairo_region_create_rectangle (&actor_rect);
|
|
|
|
|
|
|
|
cairo_region_intersect_rectangle (region,
|
|
|
|
&((cairo_rectangle_int_t) {
|
2016-11-25 01:31:38 -05:00
|
|
|
.x = logical_monitor->rect.x,
|
|
|
|
.y = logical_monitor->rect.y,
|
|
|
|
.width = logical_monitor->rect.width,
|
|
|
|
.height = logical_monitor->rect.height,
|
wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.
DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.
https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-02-03 02:49:52 -05:00
|
|
|
}));
|
|
|
|
|
|
|
|
is_on_monitor = !cairo_region_is_empty (region);
|
|
|
|
cairo_region_destroy (region);
|
|
|
|
|
|
|
|
return is_on_monitor;
|
|
|
|
}
|
|
|
|
|
2015-07-23 11:22:22 -04:00
|
|
|
void
|
|
|
|
meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
|
|
|
|
struct wl_list *frame_callbacks)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
|
|
|
|
|
|
|
wl_list_insert_list (&priv->frame_callback_list, frame_callbacks);
|
|
|
|
}
|
|
|
|
|
2014-02-26 20:21:51 -05:00
|
|
|
static MetaWindow *
|
|
|
|
meta_surface_actor_wayland_get_window (MetaSurfaceActor *actor)
|
|
|
|
{
|
2016-01-18 03:56:27 -05:00
|
|
|
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
|
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
2014-02-26 20:21:51 -05:00
|
|
|
|
2015-09-08 05:52:10 -04:00
|
|
|
if (!surface)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return surface->window;
|
2014-02-26 20:21:51 -05:00
|
|
|
}
|
|
|
|
|
2014-04-26 06:55:54 -04:00
|
|
|
static void
|
2016-01-18 03:56:27 -05:00
|
|
|
meta_surface_actor_wayland_get_preferred_width (ClutterActor *actor,
|
2014-04-26 06:55:54 -04:00
|
|
|
gfloat for_height,
|
|
|
|
gfloat *min_width_p,
|
|
|
|
gfloat *natural_width_p)
|
|
|
|
{
|
2016-01-18 03:56:27 -05:00
|
|
|
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
|
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
|
|
|
MetaShapedTexture *stex;
|
|
|
|
double scale;
|
|
|
|
|
|
|
|
if (surface)
|
|
|
|
scale = meta_surface_actor_wayland_get_scale (self);
|
|
|
|
else
|
|
|
|
scale = 1.0;
|
2014-04-26 06:55:54 -04:00
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
|
|
|
clutter_actor_get_preferred_width (CLUTTER_ACTOR (stex),
|
|
|
|
for_height,
|
|
|
|
min_width_p,
|
|
|
|
natural_width_p);
|
2014-04-26 06:55:54 -04:00
|
|
|
|
|
|
|
if (min_width_p)
|
|
|
|
*min_width_p *= scale;
|
|
|
|
|
|
|
|
if (natural_width_p)
|
|
|
|
*natural_width_p *= scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-01-18 03:56:27 -05:00
|
|
|
meta_surface_actor_wayland_get_preferred_height (ClutterActor *actor,
|
2014-04-26 06:55:54 -04:00
|
|
|
gfloat for_width,
|
|
|
|
gfloat *min_height_p,
|
|
|
|
gfloat *natural_height_p)
|
|
|
|
{
|
2016-01-18 03:56:27 -05:00
|
|
|
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
|
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
|
|
|
MetaShapedTexture *stex;
|
|
|
|
double scale;
|
|
|
|
|
|
|
|
if (surface)
|
|
|
|
scale = meta_surface_actor_wayland_get_scale (self);
|
|
|
|
else
|
|
|
|
scale = 1.0;
|
2014-04-26 06:55:54 -04:00
|
|
|
|
2016-01-18 03:56:27 -05:00
|
|
|
stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
|
|
|
clutter_actor_get_preferred_height (CLUTTER_ACTOR (stex),
|
|
|
|
for_width,
|
|
|
|
min_height_p,
|
|
|
|
natural_height_p);
|
2014-04-26 06:55:54 -04:00
|
|
|
|
|
|
|
if (min_height_p)
|
|
|
|
*min_height_p *= scale;
|
|
|
|
|
|
|
|
if (natural_height_p)
|
|
|
|
*natural_height_p *= scale;
|
|
|
|
}
|
|
|
|
|
wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.
DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.
https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-02-03 02:49:52 -05:00
|
|
|
static void
|
|
|
|
meta_surface_actor_wayland_paint (ClutterActor *actor)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
|
|
|
|
MetaSurfaceActorWaylandPrivate *priv =
|
|
|
|
meta_surface_actor_wayland_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->surface)
|
2015-07-23 11:22:22 -04:00
|
|
|
{
|
|
|
|
MetaWaylandCompositor *compositor = priv->surface->compositor;
|
|
|
|
|
|
|
|
wl_list_insert_list (&compositor->frame_callbacks, &priv->frame_callback_list);
|
|
|
|
wl_list_init (&priv->frame_callback_list);
|
|
|
|
}
|
wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.
DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.
https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-02-03 02:49:52 -05:00
|
|
|
|
2015-07-10 04:14:51 -04:00
|
|
|
g_signal_emit (actor, signals[PAINTING], 0);
|
|
|
|
|
wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.
DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.
https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-02-03 02:49:52 -05:00
|
|
|
CLUTTER_ACTOR_CLASS (meta_surface_actor_wayland_parent_class)->paint (actor);
|
|
|
|
}
|
|
|
|
|
2014-03-25 11:59:52 -04:00
|
|
|
static void
|
|
|
|
meta_surface_actor_wayland_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (object);
|
2016-01-18 03:59:45 -05:00
|
|
|
MetaSurfaceActorWaylandPrivate *priv =
|
|
|
|
meta_surface_actor_wayland_get_instance_private (self);
|
|
|
|
MetaWaylandFrameCallback *cb, *next;
|
2016-10-20 03:48:12 -04:00
|
|
|
MetaShapedTexture *stex =
|
|
|
|
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
2014-03-25 11:59:52 -04:00
|
|
|
|
2016-10-20 03:48:12 -04:00
|
|
|
meta_shaped_texture_set_texture (stex, NULL);
|
2016-01-18 03:59:45 -05:00
|
|
|
if (priv->surface)
|
|
|
|
{
|
|
|
|
g_object_remove_weak_pointer (G_OBJECT (priv->surface),
|
|
|
|
(gpointer *) &priv->surface);
|
|
|
|
priv->surface = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
wl_list_for_each_safe (cb, next, &priv->frame_callback_list, link)
|
|
|
|
wl_resource_destroy (cb->resource);
|
2014-03-25 11:59:52 -04:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (meta_surface_actor_wayland_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorClass *surface_actor_class = META_SURFACE_ACTOR_CLASS (klass);
|
2014-04-26 06:55:54 -04:00
|
|
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
2014-03-25 11:59:52 -04:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
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-04-26 06:55:54 -04:00
|
|
|
actor_class->get_preferred_width = meta_surface_actor_wayland_get_preferred_width;
|
|
|
|
actor_class->get_preferred_height = meta_surface_actor_wayland_get_preferred_height;
|
wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.
DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.
https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-02-03 02:49:52 -05:00
|
|
|
actor_class->paint = meta_surface_actor_wayland_paint;
|
2014-04-26 06:55:54 -04: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
|
|
|
surface_actor_class->process_damage = meta_surface_actor_wayland_process_damage;
|
|
|
|
surface_actor_class->pre_paint = meta_surface_actor_wayland_pre_paint;
|
|
|
|
surface_actor_class->is_visible = meta_surface_actor_wayland_is_visible;
|
|
|
|
|
|
|
|
surface_actor_class->should_unredirect = meta_surface_actor_wayland_should_unredirect;
|
|
|
|
surface_actor_class->set_unredirected = meta_surface_actor_wayland_set_unredirected;
|
|
|
|
surface_actor_class->is_unredirected = meta_surface_actor_wayland_is_unredirected;
|
2014-02-26 20:21:51 -05:00
|
|
|
|
|
|
|
surface_actor_class->get_window = meta_surface_actor_wayland_get_window;
|
2014-03-25 11:59:52 -04:00
|
|
|
|
|
|
|
object_class->dispose = meta_surface_actor_wayland_dispose;
|
2015-07-10 04:14:51 -04:00
|
|
|
|
|
|
|
signals[PAINTING] = g_signal_new ("painting",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 0);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_surface_actor_wayland_init (MetaSurfaceActorWayland *self)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaSurfaceActor *
|
|
|
|
meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND, NULL);
|
|
|
|
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
|
|
|
|
|
|
|
g_assert (meta_is_wayland_compositor ());
|
|
|
|
|
2015-07-23 11:22:22 -04:00
|
|
|
wl_list_init (&priv->frame_callback_list);
|
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
|
|
|
priv->surface = surface;
|
2016-01-18 03:59:45 -05:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (priv->surface),
|
|
|
|
(gpointer *) &priv->surface);
|
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 (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaWaylandSurface *
|
|
|
|
meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
|
|
|
|
{
|
|
|
|
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
|
|
|
return priv->surface;
|
|
|
|
}
|