2009-06-26 19:33:20 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2013-03-11 15:52:36 +00:00
|
|
|
/**
|
|
|
|
* SECTION:meta-window-actor
|
|
|
|
* @title: MetaWindowActor
|
|
|
|
* @short_description: An actor representing a top-level window in the scene graph
|
|
|
|
*/
|
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "config.h"
|
2010-09-10 14:06:37 +00:00
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#include <gdk/gdk.h>
|
2009-06-29 18:30:26 +00:00
|
|
|
#include <math.h>
|
2012-04-27 04:14:42 +00:00
|
|
|
#include <string.h>
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-04 15:29:47 +00:00
|
|
|
#include "backends/meta-screen-cast-window.h"
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "core/frame.h"
|
|
|
|
#include "compositor/compositor-private.h"
|
|
|
|
#include "compositor/meta-cullable.h"
|
|
|
|
#include "compositor/meta-surface-actor-x11.h"
|
|
|
|
#include "compositor/meta-surface-actor.h"
|
|
|
|
#include "compositor/meta-texture-rectangle.h"
|
|
|
|
#include "compositor/meta-window-actor-private.h"
|
|
|
|
#include "compositor/region-utils.h"
|
|
|
|
#include "meta/meta-enum-types.h"
|
|
|
|
#include "meta/meta-shadow-factory.h"
|
|
|
|
#include "meta/window.h"
|
2017-08-26 16:26:30 +00:00
|
|
|
|
2014-08-14 00:19:35 +00:00
|
|
|
#ifdef HAVE_WAYLAND
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "compositor/meta-surface-actor-wayland.h"
|
2014-03-19 02:01:31 +00:00
|
|
|
#include "wayland/meta-wayland-surface.h"
|
2014-08-27 16:41:26 +00:00
|
|
|
#endif
|
2014-03-19 02:01:31 +00:00
|
|
|
|
2014-05-21 13:57:15 +00:00
|
|
|
typedef enum {
|
|
|
|
INITIALLY_FROZEN,
|
|
|
|
DRAWING_FIRST_FRAME,
|
|
|
|
EMITTED_FIRST_FRAME
|
|
|
|
} FirstFrameState;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
typedef struct _MetaWindowActorPrivate
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-10-31 10:47:17 +00:00
|
|
|
ClutterActor parent;
|
|
|
|
|
2014-03-18 21:31:22 +00:00
|
|
|
MetaWindow *window;
|
|
|
|
MetaCompositor *compositor;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2013-10-13 11:47:53 +00:00
|
|
|
MetaSurfaceActor *surface;
|
2013-11-05 03:13:33 +00:00
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
/* MetaShadowFactory only caches shadows that are actually in use;
|
|
|
|
* to avoid unnecessary recomputation we do two things: 1) we store
|
|
|
|
* both a focused and unfocused shadow for the window. If the window
|
|
|
|
* doesn't have different focused and unfocused shadow parameters,
|
|
|
|
* these will be the same. 2) when the shadow potentially changes we
|
|
|
|
* don't immediately unreference the old shadow, we just flag it as
|
|
|
|
* dirty and recompute it when we next need it (recompute_focused_shadow,
|
|
|
|
* recompute_unfocused_shadow.) Because of our extraction of
|
|
|
|
* size-invariant window shape, we'll often find that the new shadow
|
|
|
|
* is the same as the old shadow.
|
|
|
|
*/
|
|
|
|
MetaShadow *focused_shadow;
|
|
|
|
MetaShadow *unfocused_shadow;
|
|
|
|
|
2013-01-15 02:47:46 +00:00
|
|
|
/* A region that matches the shape of the window, including frame bounds */
|
2010-10-18 15:32:50 +00:00
|
|
|
cairo_region_t *shape_region;
|
2010-11-11 23:23:25 +00:00
|
|
|
/* The region we should clip to when painting the shadow */
|
|
|
|
cairo_region_t *shadow_clip;
|
2009-06-29 18:30:26 +00:00
|
|
|
|
2014-01-22 14:16:56 +00:00
|
|
|
/* Extracted size-invariant shape used for shadows */
|
|
|
|
MetaWindowShape *shadow_shape;
|
|
|
|
char * shadow_class;
|
|
|
|
|
2015-07-06 06:27:49 +00:00
|
|
|
MetaShadowMode shadow_mode;
|
|
|
|
|
2014-07-31 09:05:34 +00:00
|
|
|
guint size_changed_id;
|
2014-02-24 18:32:17 +00:00
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
/*
|
|
|
|
* These need to be counters rather than flags, since more plugins
|
|
|
|
* can implement same effect; the practicality of stacking effects
|
|
|
|
* might be dubious, but we have to at least handle it correctly.
|
|
|
|
*/
|
|
|
|
gint minimize_in_progress;
|
2013-06-14 01:01:17 +00:00
|
|
|
gint unminimize_in_progress;
|
2015-07-06 04:08:08 +00:00
|
|
|
gint size_change_in_progress;
|
2009-06-26 19:33:20 +00:00
|
|
|
gint map_in_progress;
|
|
|
|
gint destroy_in_progress;
|
|
|
|
|
2014-02-24 21:00:12 +00:00
|
|
|
guint freeze_count;
|
2011-06-13 22:09:59 +00:00
|
|
|
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
guint visible : 1;
|
2009-06-26 19:33:20 +00:00
|
|
|
guint disposed : 1;
|
|
|
|
|
2014-02-27 01:52:44 +00:00
|
|
|
guint needs_reshape : 1;
|
2010-11-11 21:24:43 +00:00
|
|
|
guint recompute_focused_shadow : 1;
|
|
|
|
guint recompute_unfocused_shadow : 1;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
guint needs_destroy : 1;
|
|
|
|
|
2012-01-07 22:21:32 +00:00
|
|
|
guint updates_frozen : 1;
|
2014-05-21 13:57:15 +00:00
|
|
|
guint first_frame_state : 2; /* FirstFrameState */
|
2018-12-21 20:12:49 +00:00
|
|
|
} MetaWindowActorPrivate;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2014-05-21 13:57:15 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
FIRST_FRAME,
|
2018-04-04 08:10:32 +00:00
|
|
|
EFFECTS_COMPLETED,
|
|
|
|
|
2014-05-21 13:57:15 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
enum
|
|
|
|
{
|
2010-10-18 17:27:14 +00:00
|
|
|
PROP_META_WINDOW = 1,
|
2015-07-06 06:27:49 +00:00
|
|
|
PROP_SHADOW_MODE,
|
2010-11-11 21:24:43 +00:00
|
|
|
PROP_SHADOW_CLASS
|
2009-06-26 19:33:20 +00:00
|
|
|
};
|
|
|
|
|
2010-10-18 17:27:14 +00:00
|
|
|
static void meta_window_actor_dispose (GObject *object);
|
|
|
|
static void meta_window_actor_constructed (GObject *object);
|
|
|
|
static void meta_window_actor_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void meta_window_actor_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2010-10-18 19:34:08 +00:00
|
|
|
static void meta_window_actor_paint (ClutterActor *actor);
|
2011-07-16 11:32:12 +00:00
|
|
|
|
2010-11-11 22:18:02 +00:00
|
|
|
static gboolean meta_window_actor_get_paint_volume (ClutterActor *actor,
|
|
|
|
ClutterPaintVolume *volume);
|
2018-12-21 20:51:02 +00:00
|
|
|
static void set_surface (MetaWindowActor *actor,
|
|
|
|
MetaSurfaceActor *surface);
|
2010-10-18 19:34:08 +00:00
|
|
|
|
2010-10-18 17:27:14 +00:00
|
|
|
static gboolean meta_window_actor_has_shadow (MetaWindowActor *self);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2012-11-12 19:11:08 +00:00
|
|
|
static void meta_window_actor_handle_updates (MetaWindowActor *self);
|
|
|
|
|
2014-02-27 01:52:44 +00:00
|
|
|
static void check_needs_reshape (MetaWindowActor *self);
|
|
|
|
|
2013-11-21 20:25:08 +00:00
|
|
|
static void cullable_iface_init (MetaCullableInterface *iface);
|
|
|
|
|
2018-12-04 15:29:47 +00:00
|
|
|
static void screen_cast_window_iface_init (MetaScreenCastWindowInterface *iface);
|
|
|
|
|
2013-11-21 20:25:08 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR,
|
2018-12-21 20:12:49 +00:00
|
|
|
G_ADD_PRIVATE (MetaWindowActor)
|
2018-12-04 15:29:47 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init)
|
|
|
|
G_IMPLEMENT_INTERFACE (META_TYPE_SCREEN_CAST_WINDOW, screen_cast_window_iface_init));
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2012-11-12 19:11:08 +00:00
|
|
|
static void
|
2018-12-21 20:51:02 +00:00
|
|
|
meta_window_actor_real_set_surface_actor (MetaWindowActor *actor,
|
|
|
|
MetaSurfaceActor *surface)
|
2012-11-12 19:11:08 +00:00
|
|
|
{
|
2018-12-21 20:51:02 +00:00
|
|
|
set_surface (actor, surface);
|
2012-11-12 19:11:08 +00:00
|
|
|
}
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
static void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_class_init (MetaWindowActorClass *klass)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2010-10-18 19:34:08 +00:00
|
|
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
2009-06-26 19:33:20 +00:00
|
|
|
GParamSpec *pspec;
|
|
|
|
|
2010-10-18 17:27:14 +00:00
|
|
|
object_class->dispose = meta_window_actor_dispose;
|
|
|
|
object_class->set_property = meta_window_actor_set_property;
|
|
|
|
object_class->get_property = meta_window_actor_get_property;
|
|
|
|
object_class->constructed = meta_window_actor_constructed;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2010-10-18 19:34:08 +00:00
|
|
|
actor_class->paint = meta_window_actor_paint;
|
2010-11-11 22:18:02 +00:00
|
|
|
actor_class->get_paint_volume = meta_window_actor_get_paint_volume;
|
2010-10-18 19:34:08 +00:00
|
|
|
|
2018-12-21 20:51:02 +00:00
|
|
|
klass->set_surface_actor = meta_window_actor_real_set_surface_actor;
|
|
|
|
|
2014-05-21 13:57:15 +00:00
|
|
|
/**
|
|
|
|
* MetaWindowActor::first-frame:
|
|
|
|
* @actor: the #MetaWindowActor instance
|
|
|
|
*
|
|
|
|
* The ::first-frame signal will be emitted the first time a frame
|
|
|
|
* of window contents has been drawn by the application and Mutter
|
|
|
|
* has had the chance to drawn that frame to the screen. If the
|
|
|
|
* window starts off initially hidden, obscured, or on on a
|
|
|
|
* different workspace, the ::first-frame signal will be emitted
|
|
|
|
* even though the user doesn't see the contents.
|
|
|
|
*
|
|
|
|
* MetaDisplay::window-created is a good place to connect to this
|
|
|
|
* signal - at that point, the MetaWindowActor for the window
|
|
|
|
* exists, but the window has reliably not yet been drawn.
|
|
|
|
* Connecting to an existing window that has already been drawn to
|
|
|
|
* the screen is not useful.
|
|
|
|
*/
|
|
|
|
signals[FIRST_FRAME] =
|
|
|
|
g_signal_new ("first-frame",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2018-04-04 08:10:32 +00:00
|
|
|
/**
|
|
|
|
* MetaWindowActor::effects-completed:
|
|
|
|
* @actor: the #MetaWindowActor instance
|
|
|
|
*
|
|
|
|
* The ::effects-completed signal will be emitted once all pending compositor
|
|
|
|
* effects are completed.
|
|
|
|
*/
|
|
|
|
signals[EFFECTS_COMPLETED] =
|
|
|
|
g_signal_new ("effects-completed",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
pspec = g_param_spec_object ("meta-window",
|
|
|
|
"MetaWindow",
|
|
|
|
"The displayed MetaWindow",
|
|
|
|
META_TYPE_WINDOW,
|
2012-04-23 22:54:46 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2010-10-18 17:27:14 +00:00
|
|
|
PROP_META_WINDOW,
|
2009-06-26 19:33:20 +00:00
|
|
|
pspec);
|
|
|
|
|
2015-07-06 06:27:49 +00:00
|
|
|
pspec = g_param_spec_enum ("shadow-mode",
|
|
|
|
"Shadow mode",
|
|
|
|
"Decides when to paint shadows",
|
|
|
|
META_TYPE_SHADOW_MODE,
|
|
|
|
META_SHADOW_MODE_AUTO,
|
|
|
|
G_PARAM_READWRITE);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2015-07-06 06:27:49 +00:00
|
|
|
PROP_SHADOW_MODE,
|
2009-06-26 19:33:20 +00:00
|
|
|
pspec);
|
2010-10-18 19:34:08 +00:00
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
pspec = g_param_spec_string ("shadow-class",
|
|
|
|
"Name of the shadow class for this window.",
|
|
|
|
"NULL means to use the default shadow class for this window type",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE);
|
2010-10-18 19:34:08 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2010-11-11 21:24:43 +00:00
|
|
|
PROP_SHADOW_CLASS,
|
2010-10-18 19:34:08 +00:00
|
|
|
pspec);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_init (MetaWindowActor *self)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-03-25 01:36:47 +00:00
|
|
|
static void
|
|
|
|
window_appears_focused_notify (MetaWindow *mw,
|
|
|
|
GParamSpec *arg1,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (data));
|
|
|
|
}
|
|
|
|
|
2013-10-13 16:59:30 +00:00
|
|
|
static void
|
2014-07-31 09:05:34 +00:00
|
|
|
surface_size_changed (MetaSurfaceActor *actor,
|
|
|
|
gpointer user_data)
|
2013-10-13 16:59:30 +00:00
|
|
|
{
|
2014-07-31 09:05:34 +00:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (user_data);
|
2014-06-26 15:47:52 +00:00
|
|
|
|
2014-02-27 01:52:44 +00:00
|
|
|
meta_window_actor_update_shape (self);
|
2013-12-09 21:01:07 +00: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 22:21:11 +00:00
|
|
|
static gboolean
|
|
|
|
is_argb32 (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
2014-02-25 00:22:56 +00:00
|
|
|
/* assume we're argb until we get the window (because
|
|
|
|
in practice we're drawing nothing, so we're fully
|
|
|
|
transparent)
|
|
|
|
*/
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->surface)
|
|
|
|
return meta_surface_actor_is_argb32 (priv->surface);
|
2014-02-25 00:22:56 +00:00
|
|
|
else
|
|
|
|
return TRUE;
|
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 22:21:11 +00:00
|
|
|
}
|
|
|
|
|
2013-12-06 18:44:31 +00:00
|
|
|
static gboolean
|
|
|
|
is_non_opaque (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaWindow *window = priv->window;
|
2013-12-06 18:44:31 +00: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 22:21:11 +00:00
|
|
|
return is_argb32 (self) || (window->opacity != 0xFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
is_frozen (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return priv->surface == NULL || priv->freeze_count > 0;
|
2013-12-06 18:44:31 +00:00
|
|
|
}
|
|
|
|
|
2009-06-26 19:33:20 +00: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 22:21:11 +00:00
|
|
|
meta_window_actor_freeze (MetaWindowActor *self)
|
2013-12-09 21:01:07 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->freeze_count == 0 && priv->surface)
|
|
|
|
meta_surface_actor_set_frozen (priv->surface, TRUE);
|
2014-02-24 21:00:12 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->freeze_count ++;
|
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 22:21:11 +00:00
|
|
|
}
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2016-09-07 08:20:15 +00:00
|
|
|
static void
|
|
|
|
meta_window_actor_sync_thawed_state (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2016-09-07 08:20:15 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->first_frame_state == INITIALLY_FROZEN)
|
|
|
|
priv->first_frame_state = DRAWING_FIRST_FRAME;
|
|
|
|
|
|
|
|
if (priv->surface)
|
|
|
|
meta_surface_actor_set_frozen (priv->surface, FALSE);
|
2016-09-07 08:20:15 +00:00
|
|
|
|
|
|
|
/* We sometimes ignore moves and resizes on frozen windows */
|
|
|
|
meta_window_actor_sync_actor_geometry (self, FALSE);
|
|
|
|
}
|
|
|
|
|
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 22:21:11 +00:00
|
|
|
static void
|
|
|
|
meta_window_actor_thaw (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->freeze_count <= 0)
|
2014-02-24 21:00:12 +00:00
|
|
|
g_error ("Error in freeze/thaw accounting");
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->freeze_count--;
|
|
|
|
if (priv->freeze_count > 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 22:21:11 +00:00
|
|
|
return;
|
2013-12-09 21:01:07 +00:00
|
|
|
|
2016-09-07 08:20:15 +00:00
|
|
|
/* We still might be frozen due to lack of a MetaSurfaceActor */
|
|
|
|
if (is_frozen (self))
|
|
|
|
return;
|
2014-02-24 21:00:12 +00:00
|
|
|
|
2016-09-07 08:20:15 +00:00
|
|
|
meta_window_actor_sync_thawed_state (self);
|
2013-12-09 21:01:07 +00: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 22:21:11 +00:00
|
|
|
/* We do this now since we might be going right back into the
|
|
|
|
* frozen state */
|
|
|
|
meta_window_actor_handle_updates (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-24 18:32:17 +00:00
|
|
|
set_surface (MetaWindowActor *self,
|
|
|
|
MetaSurfaceActor *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 22:21:11 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->surface)
|
2014-02-24 18:32:17 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
g_signal_handler_disconnect (priv->surface, priv->size_changed_id);
|
|
|
|
clutter_actor_remove_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
|
|
|
|
g_object_unref (priv->surface);
|
2014-02-24 18:32:17 +00:00
|
|
|
}
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->surface = surface;
|
2014-02-24 18:32:17 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->surface)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
g_object_ref_sink (priv->surface);
|
|
|
|
priv->size_changed_id = g_signal_connect (priv->surface, "size-changed",
|
2014-07-31 09:05:34 +00:00
|
|
|
G_CALLBACK (surface_size_changed), self);
|
2018-12-21 20:12:49 +00:00
|
|
|
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
|
2013-05-03 17:51:22 +00:00
|
|
|
|
2014-02-27 01:52:44 +00:00
|
|
|
meta_window_actor_update_shape (self);
|
2016-09-07 08:20:15 +00:00
|
|
|
|
|
|
|
if (is_frozen (self))
|
2018-12-21 20:12:49 +00:00
|
|
|
meta_surface_actor_set_frozen (priv->surface, TRUE);
|
2016-09-07 08:20:15 +00:00
|
|
|
else
|
|
|
|
meta_window_actor_sync_thawed_state (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
2014-02-24 18:32:17 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 00:22:56 +00:00
|
|
|
void
|
2014-02-24 18:32:17 +00:00
|
|
|
meta_window_actor_update_surface (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaWindow *window = priv->window;
|
2014-02-24 18:32:17 +00:00
|
|
|
MetaSurfaceActor *surface_actor;
|
|
|
|
|
2014-08-27 16:56:05 +00:00
|
|
|
#ifdef HAVE_WAYLAND
|
2014-02-24 18:32:17 +00:00
|
|
|
if (window->surface)
|
2018-04-06 10:29:37 +00:00
|
|
|
surface_actor = meta_wayland_surface_get_actor (window->surface);
|
2014-08-27 16:56:05 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (!meta_is_wayland_compositor ())
|
2014-02-24 18:32:17 +00:00
|
|
|
surface_actor = meta_surface_actor_x11_new (window);
|
2014-02-25 00:22:56 +00:00
|
|
|
else
|
|
|
|
surface_actor = NULL;
|
2014-02-24 18:32:17 +00:00
|
|
|
|
|
|
|
set_surface (self, surface_actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_constructed (GObject *object)
|
|
|
|
{
|
2014-03-18 21:31:22 +00:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaWindow *window = priv->window;
|
2014-02-24 18:32:17 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->compositor = window->display->compositor;
|
2014-02-24 18:32:17 +00:00
|
|
|
|
|
|
|
meta_window_actor_update_surface (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2011-04-26 16:08:15 +00:00
|
|
|
meta_window_actor_update_opacity (self);
|
2013-01-15 02:47:46 +00:00
|
|
|
|
2013-11-21 21:25:20 +00:00
|
|
|
/* Start off with an empty shape region to maintain the invariant
|
|
|
|
* that it's always set */
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->shape_region = cairo_region_create ();
|
2018-12-22 14:21:34 +00:00
|
|
|
|
|
|
|
meta_window_actor_sync_updates_frozen (self);
|
|
|
|
|
|
|
|
if (is_frozen (self))
|
|
|
|
priv->first_frame_state = INITIALLY_FROZEN;
|
|
|
|
else
|
|
|
|
priv->first_frame_state = DRAWING_FIRST_FRAME;
|
|
|
|
|
|
|
|
meta_window_actor_sync_actor_geometry (self, priv->window->placed);
|
|
|
|
|
|
|
|
/* Hang our compositor window state off the MetaWindow for fast retrieval */
|
|
|
|
meta_window_set_compositor_private (window, object);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_dispose (GObject *object)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2014-03-18 21:31:22 +00:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaCompositor *compositor = priv->compositor;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->disposed)
|
2009-06-26 19:33:20 +00:00
|
|
|
return;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->disposed = TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_clear_pointer (&priv->shape_region, cairo_region_destroy);
|
|
|
|
g_clear_pointer (&priv->shadow_clip, cairo_region_destroy);
|
2009-06-29 18:30:26 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_clear_pointer (&priv->shadow_class, g_free);
|
|
|
|
g_clear_pointer (&priv->focused_shadow, meta_shadow_unref);
|
|
|
|
g_clear_pointer (&priv->unfocused_shadow, meta_shadow_unref);
|
|
|
|
g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
|
2010-10-18 19:34:08 +00:00
|
|
|
|
2014-03-18 21:31:22 +00:00
|
|
|
compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_clear_object (&priv->window);
|
2011-03-08 03:22:19 +00:00
|
|
|
|
2014-02-24 18:32:17 +00:00
|
|
|
set_surface (self, NULL);
|
2009-08-07 16:14:48 +00:00
|
|
|
|
2010-10-18 17:27:14 +00:00
|
|
|
G_OBJECT_CLASS (meta_window_actor_parent_class)->dispose (object);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-10-31 10:47:17 +00:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2010-10-18 17:27:14 +00:00
|
|
|
case PROP_META_WINDOW:
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->window = g_value_dup_object (value);
|
|
|
|
g_signal_connect_object (priv->window, "notify::appears-focused",
|
2013-12-09 18:45:12 +00:00
|
|
|
G_CALLBACK (window_appears_focused_notify), self, 0);
|
2009-06-26 19:33:20 +00:00
|
|
|
break;
|
2015-07-06 06:27:49 +00:00
|
|
|
case PROP_SHADOW_MODE:
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2015-07-06 06:27:49 +00:00
|
|
|
MetaShadowMode newv = g_value_get_enum (value);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (newv == priv->shadow_mode)
|
2009-06-26 19:33:20 +00:00
|
|
|
return;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->shadow_mode = newv;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
meta_window_actor_invalidate_shadow (self);
|
2010-11-04 21:02:23 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-11-11 21:24:43 +00:00
|
|
|
case PROP_SHADOW_CLASS:
|
2010-10-18 19:34:08 +00:00
|
|
|
{
|
2010-11-11 21:24:43 +00:00
|
|
|
const char *newv = g_value_get_string (value);
|
2010-10-18 19:34:08 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (g_strcmp0 (newv, priv->shadow_class) == 0)
|
2010-10-18 19:34:08 +00:00
|
|
|
return;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_free (priv->shadow_class);
|
|
|
|
priv->shadow_class = g_strdup (newv);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
meta_window_actor_invalidate_shadow (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-10-31 10:47:17 +00:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2010-10-18 17:27:14 +00:00
|
|
|
case PROP_META_WINDOW:
|
2018-12-21 20:12:49 +00:00
|
|
|
g_value_set_object (value, priv->window);
|
2009-06-26 19:33:20 +00:00
|
|
|
break;
|
2015-07-06 06:27:49 +00:00
|
|
|
case PROP_SHADOW_MODE:
|
2018-12-21 20:12:49 +00:00
|
|
|
g_value_set_enum (value, priv->shadow_mode);
|
2009-06-26 19:33:20 +00:00
|
|
|
break;
|
2010-11-11 21:24:43 +00:00
|
|
|
case PROP_SHADOW_CLASS:
|
2018-12-21 20:12:49 +00:00
|
|
|
g_value_set_string (value, priv->shadow_class);
|
2010-10-18 19:34:08 +00:00
|
|
|
break;
|
2009-06-26 19:33:20 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
static const char *
|
|
|
|
meta_window_actor_get_shadow_class (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->shadow_class != NULL)
|
|
|
|
return priv->shadow_class;
|
2010-11-11 21:24:43 +00:00
|
|
|
else
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowType window_type = meta_window_get_window_type (priv->window);
|
2010-11-11 21:24:43 +00:00
|
|
|
|
|
|
|
switch (window_type)
|
|
|
|
{
|
|
|
|
case META_WINDOW_DROPDOWN_MENU:
|
2017-02-01 17:21:16 +00:00
|
|
|
case META_WINDOW_COMBO:
|
2010-11-11 21:24:43 +00:00
|
|
|
return "dropdown-menu";
|
|
|
|
case META_WINDOW_POPUP_MENU:
|
|
|
|
return "popup-menu";
|
|
|
|
default:
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaFrameType frame_type = meta_window_get_frame_type (priv->window);
|
2010-11-11 21:24:43 +00:00
|
|
|
return meta_frame_type_to_string (frame_type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_get_shadow_params (MetaWindowActor *self,
|
|
|
|
gboolean appears_focused,
|
|
|
|
MetaShadowParams *params)
|
|
|
|
{
|
|
|
|
const char *shadow_class = meta_window_actor_get_shadow_class (self);
|
|
|
|
|
|
|
|
meta_shadow_factory_get_params (meta_shadow_factory_get_default (),
|
|
|
|
shadow_class, appears_focused,
|
|
|
|
params);
|
|
|
|
}
|
|
|
|
|
2011-08-27 09:43:09 +00:00
|
|
|
void
|
2010-10-18 19:34:08 +00:00
|
|
|
meta_window_actor_get_shape_bounds (MetaWindowActor *self,
|
|
|
|
cairo_rectangle_int_t *bounds)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
cairo_region_get_extents (priv->shape_region, bounds);
|
2010-11-11 22:18:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_get_shadow_bounds (MetaWindowActor *self,
|
|
|
|
gboolean appears_focused,
|
|
|
|
cairo_rectangle_int_t *bounds)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2018-10-31 10:47:17 +00:00
|
|
|
MetaShadow *shadow;
|
2010-11-11 22:18:02 +00:00
|
|
|
cairo_rectangle_int_t shape_bounds;
|
|
|
|
MetaShadowParams params;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
shadow = appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
|
2018-10-31 10:47:17 +00:00
|
|
|
|
2010-11-11 22:18:02 +00:00
|
|
|
meta_window_actor_get_shape_bounds (self, &shape_bounds);
|
|
|
|
meta_window_actor_get_shadow_params (self, appears_focused, ¶ms);
|
|
|
|
|
|
|
|
meta_shadow_get_bounds (shadow,
|
|
|
|
params.x_offset + shape_bounds.x,
|
|
|
|
params.y_offset + shape_bounds.y,
|
|
|
|
shape_bounds.width,
|
|
|
|
shape_bounds.height,
|
|
|
|
bounds);
|
2010-10-18 19:34:08 +00:00
|
|
|
}
|
|
|
|
|
2011-03-22 19:36:12 +00:00
|
|
|
/* If we have an ARGB32 window that we decorate with a frame, it's
|
|
|
|
* probably something like a translucent terminal - something where
|
|
|
|
* the alpha channel represents transparency rather than a shape. We
|
|
|
|
* don't want to show the shadow through the translucent areas since
|
|
|
|
* the shadow is wrong for translucent windows (it should be
|
|
|
|
* translucent itself and colored), and not only that, will /look/
|
|
|
|
* horribly wrong - a misplaced big black blob. As a hack, what we
|
|
|
|
* want to do is just draw the shadow as normal outside the frame, and
|
|
|
|
* inside the frame draw no shadow. This is also not even close to
|
|
|
|
* the right result, but looks OK. We also apply this approach to
|
|
|
|
* windows set to be partially translucent with _NET_WM_WINDOW_OPACITY.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
clip_shadow_under_window (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return is_non_opaque (self) && priv->window->frame;
|
2011-03-22 19:36:12 +00:00
|
|
|
}
|
|
|
|
|
2010-10-18 19:34:08 +00:00
|
|
|
static void
|
|
|
|
meta_window_actor_paint (ClutterActor *actor)
|
|
|
|
{
|
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (actor);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
gboolean appears_focused = meta_window_appears_focused (priv->window);
|
2018-10-31 10:47:17 +00:00
|
|
|
MetaShadow *shadow;
|
2018-11-08 21:32:13 +00:00
|
|
|
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
2010-10-18 19:34:08 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
shadow = appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
|
2018-10-31 10:47:17 +00:00
|
|
|
|
2010-11-11 23:23:25 +00:00
|
|
|
if (shadow != NULL)
|
2010-10-18 19:34:08 +00:00
|
|
|
{
|
2010-11-11 23:23:25 +00:00
|
|
|
MetaShadowParams params;
|
|
|
|
cairo_rectangle_int_t shape_bounds;
|
2018-12-21 20:12:49 +00:00
|
|
|
cairo_region_t *clip = priv->shadow_clip;
|
|
|
|
MetaWindow *window = priv->window;
|
2010-11-11 23:23:25 +00:00
|
|
|
|
|
|
|
meta_window_actor_get_shape_bounds (self, &shape_bounds);
|
|
|
|
meta_window_actor_get_shadow_params (self, appears_focused, ¶ms);
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
/* The frame bounds are already subtracted from priv->shadow_clip
|
2011-03-22 19:36:12 +00:00
|
|
|
* if that exists.
|
|
|
|
*/
|
|
|
|
if (!clip && clip_shadow_under_window (self))
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (priv->window);
|
2011-03-22 19:36:12 +00:00
|
|
|
cairo_rectangle_int_t bounds;
|
|
|
|
|
|
|
|
meta_window_actor_get_shadow_bounds (self, appears_focused, &bounds);
|
|
|
|
clip = cairo_region_create_rectangle (&bounds);
|
|
|
|
|
|
|
|
cairo_region_subtract (clip, frame_bounds);
|
|
|
|
}
|
|
|
|
|
2010-11-11 23:23:25 +00:00
|
|
|
meta_shadow_paint (shadow,
|
2018-11-08 21:32:13 +00:00
|
|
|
framebuffer,
|
2010-11-11 23:23:25 +00:00
|
|
|
params.x_offset + shape_bounds.x,
|
|
|
|
params.y_offset + shape_bounds.y,
|
|
|
|
shape_bounds.width,
|
|
|
|
shape_bounds.height,
|
2013-12-06 18:44:31 +00:00
|
|
|
(clutter_actor_get_paint_opacity (actor) * params.opacity * window->opacity) / (255 * 255),
|
2011-03-22 19:36:12 +00:00
|
|
|
clip,
|
|
|
|
clip_shadow_under_window (self)); /* clip_strictly - not just as an optimization */
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (clip && clip != priv->shadow_clip)
|
2011-03-22 19:36:12 +00:00
|
|
|
cairo_region_destroy (clip);
|
2010-10-18 19:34:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CLUTTER_ACTOR_CLASS (meta_window_actor_parent_class)->paint (actor);
|
|
|
|
}
|
|
|
|
|
2010-11-11 22:18:02 +00:00
|
|
|
static gboolean
|
|
|
|
meta_window_actor_get_paint_volume (ClutterActor *actor,
|
|
|
|
ClutterPaintVolume *volume)
|
|
|
|
{
|
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (actor);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
gboolean appears_focused = meta_window_appears_focused (priv->window);
|
2010-11-11 22:18:02 +00:00
|
|
|
|
|
|
|
/* The paint volume is computed before paint functions are called
|
|
|
|
* so our bounds might not be updated yet. Force an update. */
|
2012-11-12 19:11:08 +00:00
|
|
|
meta_window_actor_handle_updates (self);
|
2010-11-11 22:18:02 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (appears_focused ? priv->focused_shadow : priv->unfocused_shadow)
|
2010-11-11 22:18:02 +00:00
|
|
|
{
|
|
|
|
cairo_rectangle_int_t shadow_bounds;
|
2014-07-30 15:09:02 +00:00
|
|
|
ClutterActorBox shadow_box;
|
2010-11-11 22:18:02 +00:00
|
|
|
|
|
|
|
/* We could compute an full clip region as we do for the window
|
|
|
|
* texture, but the shadow is relatively cheap to draw, and
|
|
|
|
* a little more complex to clip, so we just catch the case where
|
|
|
|
* the shadow is completely obscured and doesn't need to be drawn
|
|
|
|
* at all.
|
|
|
|
*/
|
|
|
|
|
|
|
|
meta_window_actor_get_shadow_bounds (self, appears_focused, &shadow_bounds);
|
2014-07-30 15:09:02 +00:00
|
|
|
shadow_box.x1 = shadow_bounds.x;
|
|
|
|
shadow_box.x2 = shadow_bounds.x + shadow_bounds.width;
|
|
|
|
shadow_box.y1 = shadow_bounds.y;
|
|
|
|
shadow_box.y2 = shadow_bounds.y + shadow_bounds.height;
|
|
|
|
|
|
|
|
clutter_paint_volume_union_box (volume, &shadow_box);
|
2010-11-11 22:18:02 +00:00
|
|
|
}
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->surface)
|
2014-07-30 15:09:02 +00:00
|
|
|
{
|
|
|
|
const ClutterPaintVolume *child_volume;
|
2010-11-11 22:18:02 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
child_volume = clutter_actor_get_transformed_paint_volume (CLUTTER_ACTOR (priv->surface), actor);
|
2014-07-30 15:09:02 +00:00
|
|
|
if (!child_volume)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
clutter_paint_volume_union (volume, child_volume);
|
|
|
|
}
|
2010-11-11 22:18:02 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
static gboolean
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_has_shadow (MetaWindowActor *self)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->shadow_mode == META_SHADOW_MODE_FORCED_OFF)
|
2009-06-26 19:33:20 +00:00
|
|
|
return FALSE;
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->shadow_mode == META_SHADOW_MODE_FORCED_ON)
|
2015-07-06 06:27:49 +00:00
|
|
|
return TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2010-11-11 23:43:35 +00:00
|
|
|
/* Leaving out shadows for maximized and fullscreen windows is an effeciency
|
|
|
|
* win and also prevents the unsightly effect of the shadow of maximized
|
|
|
|
* window appearing on an adjacent window */
|
2018-12-21 20:12:49 +00:00
|
|
|
if ((meta_window_get_maximized (priv->window) == META_MAXIMIZE_BOTH) ||
|
|
|
|
meta_window_is_fullscreen (priv->window))
|
2010-11-11 23:43:35 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2016-01-10 14:16:09 +00:00
|
|
|
/*
|
|
|
|
* If we have two snap-tiled windows, we don't want the shadow to obstruct
|
|
|
|
* the other window.
|
|
|
|
*/
|
2018-12-21 20:12:49 +00:00
|
|
|
if (meta_window_get_tile_match (priv->window))
|
2016-01-10 14:16:09 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
/*
|
|
|
|
* Always put a shadow around windows with a frame - This should override
|
2010-10-18 19:34:08 +00:00
|
|
|
* the restriction about not putting a shadow around ARGB windows.
|
2009-06-26 19:33:20 +00:00
|
|
|
*/
|
2018-12-21 20:12:49 +00:00
|
|
|
if (meta_window_get_frame (priv->window))
|
2012-04-27 04:17:41 +00:00
|
|
|
return TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
/*
|
2015-10-07 19:06:31 +00:00
|
|
|
* Do not add shadows to non-opaque (ARGB32) windows, as we can't easily
|
|
|
|
* generate shadows for them.
|
2009-06-26 19:33:20 +00:00
|
|
|
*/
|
2013-12-06 18:44:31 +00:00
|
|
|
if (is_non_opaque (self))
|
2012-05-01 15:35:25 +00:00
|
|
|
return FALSE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
/*
|
2015-10-07 19:06:31 +00:00
|
|
|
* If a window specifies that it has custom frame extents, that likely
|
|
|
|
* means that it is drawing a shadow itself. Don't draw our own.
|
2009-06-26 19:33:20 +00:00
|
|
|
*/
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->window->has_custom_frame_extents)
|
2015-10-07 19:06:31 +00:00
|
|
|
return FALSE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2015-10-07 19:06:31 +00:00
|
|
|
/*
|
|
|
|
* Generate shadows for all other windows.
|
|
|
|
*/
|
|
|
|
return TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-10-18 17:27:14 +00:00
|
|
|
* meta_window_actor_get_meta_window:
|
2013-02-15 18:42:08 +00:00
|
|
|
* @self: a #MetaWindowActor
|
2009-06-26 19:33:20 +00:00
|
|
|
*
|
2011-10-18 02:10:00 +00:00
|
|
|
* Gets the #MetaWindow object that the the #MetaWindowActor is displaying
|
2009-06-26 19:33:20 +00:00
|
|
|
*
|
2011-10-18 02:10:00 +00:00
|
|
|
* Return value: (transfer none): the displayed #MetaWindow
|
2009-06-26 19:33:20 +00:00
|
|
|
*/
|
|
|
|
MetaWindow *
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_get_meta_window (MetaWindowActor *self)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return priv->window;
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-10-18 17:27:14 +00:00
|
|
|
* meta_window_actor_get_texture:
|
2013-02-15 18:42:08 +00:00
|
|
|
* @self: a #MetaWindowActor
|
2009-06-26 19:33:20 +00:00
|
|
|
*
|
2014-02-25 00:22:56 +00:00
|
|
|
* Gets the ClutterActor that is used to display the contents of the window,
|
|
|
|
* or NULL if no texture is shown yet, because the window is not mapped.
|
2009-06-26 19:33:20 +00:00
|
|
|
*
|
2011-10-18 02:10:00 +00:00
|
|
|
* Return value: (transfer none): the #ClutterActor for the contents
|
2009-06-26 19:33:20 +00:00
|
|
|
*/
|
|
|
|
ClutterActor *
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_get_texture (MetaWindowActor *self)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->surface)
|
|
|
|
return CLUTTER_ACTOR (meta_surface_actor_get_texture (priv->surface));
|
2014-02-25 00:22:56 +00:00
|
|
|
else
|
|
|
|
return NULL;
|
2013-10-13 11:47:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_window_actor_get_surface:
|
|
|
|
* @self: a #MetaWindowActor
|
|
|
|
*
|
2014-02-25 00:22:56 +00:00
|
|
|
* Gets the MetaSurfaceActor that draws the content of this window,
|
|
|
|
* or NULL if there is no surface yet associated with this window.
|
2013-10-13 11:47:53 +00:00
|
|
|
*
|
|
|
|
* Return value: (transfer none): the #MetaSurfaceActor for the contents
|
|
|
|
*/
|
|
|
|
MetaSurfaceActor *
|
|
|
|
meta_window_actor_get_surface (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return priv->surface;
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
2011-01-18 18:34:15 +00:00
|
|
|
/**
|
|
|
|
* meta_window_actor_is_destroyed:
|
2013-02-15 18:42:08 +00:00
|
|
|
* @self: a #MetaWindowActor
|
2011-01-18 18:34:15 +00:00
|
|
|
*
|
|
|
|
* Gets whether the X window that the actor was displaying has been destroyed
|
|
|
|
*
|
|
|
|
* Return value: %TRUE when the window is destroyed, otherwise %FALSE
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_window_actor_is_destroyed (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return priv->disposed || priv->needs_destroy;
|
2011-01-18 18:34:15 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 18:40:55 +00:00
|
|
|
void
|
|
|
|
meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
|
|
|
|
gboolean no_delay_frame)
|
|
|
|
{
|
2018-12-21 20:51:02 +00:00
|
|
|
META_WINDOW_ACTOR_GET_CLASS (self)->queue_frame_drawn (self,
|
|
|
|
no_delay_frame);
|
2010-03-02 18:02:28 +00:00
|
|
|
}
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
gboolean
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_effect_in_progress (MetaWindowActor *self)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
return (priv->minimize_in_progress ||
|
|
|
|
priv->size_change_in_progress ||
|
|
|
|
priv->map_in_progress ||
|
|
|
|
priv->destroy_in_progress);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
2010-03-02 18:02:28 +00:00
|
|
|
static gboolean
|
2015-07-06 03:58:40 +00:00
|
|
|
is_freeze_thaw_effect (MetaPluginEffect event)
|
2010-03-02 18:02:28 +00:00
|
|
|
{
|
|
|
|
switch (event)
|
|
|
|
{
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_DESTROY:
|
2015-07-06 04:08:08 +00:00
|
|
|
case META_PLUGIN_SIZE_CHANGE:
|
2010-03-02 18:02:28 +00:00
|
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
static gboolean
|
2015-07-06 03:58:40 +00:00
|
|
|
start_simple_effect (MetaWindowActor *self,
|
|
|
|
MetaPluginEffect event)
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaCompositor *compositor = priv->compositor;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
gint *counter = NULL;
|
2010-03-02 18:02:28 +00:00
|
|
|
gboolean use_freeze_thaw = FALSE;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
|
2017-10-20 07:52:04 +00:00
|
|
|
g_assert (compositor->plugin_mgr != NULL);
|
|
|
|
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
switch (event)
|
|
|
|
{
|
2015-07-06 04:08:08 +00:00
|
|
|
case META_PLUGIN_NONE:
|
|
|
|
return FALSE;
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_MINIMIZE:
|
2018-12-21 20:12:49 +00:00
|
|
|
counter = &priv->minimize_in_progress;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
2013-06-14 01:01:17 +00:00
|
|
|
case META_PLUGIN_UNMINIMIZE:
|
2018-12-21 20:12:49 +00:00
|
|
|
counter = &priv->unminimize_in_progress;
|
2013-06-14 01:01:17 +00:00
|
|
|
break;
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_MAP:
|
2018-12-21 20:12:49 +00:00
|
|
|
counter = &priv->map_in_progress;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_DESTROY:
|
2018-12-21 20:12:49 +00:00
|
|
|
counter = &priv->destroy_in_progress;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
2015-07-06 04:08:08 +00:00
|
|
|
case META_PLUGIN_SIZE_CHANGE:
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_SWITCH_WORKSPACE:
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (counter);
|
|
|
|
|
2010-03-02 18:02:28 +00:00
|
|
|
use_freeze_thaw = is_freeze_thaw_effect (event);
|
|
|
|
|
|
|
|
if (use_freeze_thaw)
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_freeze (self);
|
2010-03-02 18:02:28 +00:00
|
|
|
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
(*counter)++;
|
|
|
|
|
2014-03-18 21:31:22 +00:00
|
|
|
if (!meta_plugin_manager_event_simple (compositor->plugin_mgr, self, event))
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
{
|
|
|
|
(*counter)--;
|
2010-03-02 18:02:28 +00:00
|
|
|
if (use_freeze_thaw)
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_thaw (self);
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_after_effects (MetaWindowActor *self)
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->needs_destroy)
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
{
|
|
|
|
clutter_actor_destroy (CLUTTER_ACTOR (self));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-04-04 08:10:32 +00:00
|
|
|
g_signal_emit (self, signals[EFFECTS_COMPLETED], 0);
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_sync_visibility (self);
|
2013-02-16 02:27:00 +00:00
|
|
|
meta_window_actor_sync_actor_geometry (self, FALSE);
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
}
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
void
|
2015-07-06 03:58:40 +00:00
|
|
|
meta_window_actor_effect_completed (MetaWindowActor *self,
|
|
|
|
MetaPluginEffect event)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2017-01-24 10:03:41 +00:00
|
|
|
gboolean inconsistent = FALSE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
/* NB: Keep in mind that when effects get completed it possible
|
|
|
|
* that the corresponding MetaWindow may have be been destroyed.
|
2018-12-21 20:12:49 +00:00
|
|
|
* In this case priv->window will == NULL */
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
switch (event)
|
|
|
|
{
|
2015-07-06 04:08:08 +00:00
|
|
|
case META_PLUGIN_NONE:
|
|
|
|
break;
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_MINIMIZE:
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->minimize_in_progress--;
|
|
|
|
if (priv->minimize_in_progress < 0)
|
2018-10-31 10:47:17 +00:00
|
|
|
{
|
|
|
|
g_warning ("Error in minimize accounting.");
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->minimize_in_progress = 0;
|
2017-01-24 10:03:41 +00:00
|
|
|
inconsistent = TRUE;
|
2018-10-31 10:47:17 +00:00
|
|
|
}
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-06-14 01:01:17 +00:00
|
|
|
case META_PLUGIN_UNMINIMIZE:
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->unminimize_in_progress--;
|
|
|
|
if (priv->unminimize_in_progress < 0)
|
2013-06-14 01:01:17 +00:00
|
|
|
{
|
|
|
|
g_warning ("Error in unminimize accounting.");
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->unminimize_in_progress = 0;
|
2017-01-24 10:03:41 +00:00
|
|
|
inconsistent = TRUE;
|
2013-06-14 01:01:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_MAP:
|
2009-06-26 19:33:20 +00:00
|
|
|
/*
|
|
|
|
* Make sure that the actor is at the correct place in case
|
|
|
|
* the plugin fscked.
|
|
|
|
*/
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->map_in_progress--;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->map_in_progress < 0)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-10-31 10:47:17 +00:00
|
|
|
g_warning ("Error in map accounting.");
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->map_in_progress = 0;
|
2017-01-24 10:03:41 +00:00
|
|
|
inconsistent = TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_DESTROY:
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->destroy_in_progress--;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->destroy_in_progress < 0)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-10-31 10:47:17 +00:00
|
|
|
g_warning ("Error in destroy accounting.");
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->destroy_in_progress = 0;
|
2017-01-24 10:03:41 +00:00
|
|
|
inconsistent = TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
break;
|
2015-07-06 04:08:08 +00:00
|
|
|
case META_PLUGIN_SIZE_CHANGE:
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->size_change_in_progress--;
|
|
|
|
if (priv->size_change_in_progress < 0)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-10-31 10:47:17 +00:00
|
|
|
g_warning ("Error in size change accounting.");
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->size_change_in_progress = 0;
|
2017-01-24 10:03:41 +00:00
|
|
|
inconsistent = TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-10-18 17:27:14 +00:00
|
|
|
case META_PLUGIN_SWITCH_WORKSPACE:
|
2009-06-26 19:33:20 +00:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-01-24 10:03:41 +00:00
|
|
|
if (is_freeze_thaw_effect (event) && !inconsistent)
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_thaw (self);
|
2010-03-02 18:02:28 +00:00
|
|
|
|
2010-10-18 17:27:14 +00:00
|
|
|
if (!meta_window_actor_effect_in_progress (self))
|
|
|
|
meta_window_actor_after_effects (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
2011-08-27 09:43:09 +00:00
|
|
|
gboolean
|
|
|
|
meta_window_actor_should_unredirect (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (!meta_window_actor_is_destroyed (self) && priv->surface)
|
|
|
|
return meta_surface_actor_should_unredirect (priv->surface);
|
2014-02-25 00:22:56 +00:00
|
|
|
else
|
|
|
|
return FALSE;
|
2011-08-27 09:43:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-06 22:36:09 +00:00
|
|
|
meta_window_actor_set_unredirected (MetaWindowActor *self,
|
|
|
|
gboolean unredirected)
|
2011-08-27 09:43:09 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
g_assert (priv->surface); /* because otherwise should_unredirect() is FALSE */
|
|
|
|
meta_surface_actor_set_unredirected (priv->surface, unredirected);
|
2011-08-27 09:43:09 +00:00
|
|
|
}
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
void
|
2017-12-01 03:17:02 +00:00
|
|
|
meta_window_actor_queue_destroy (MetaWindowActor *self)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaWindow *window = priv->window;
|
2014-03-18 21:31:22 +00:00
|
|
|
MetaWindowType window_type = meta_window_get_window_type (window);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
|
|
|
meta_window_set_compositor_private (window, NULL);
|
|
|
|
|
2018-12-21 20:51:02 +00:00
|
|
|
META_WINDOW_ACTOR_GET_CLASS (self)->queue_destroy (self);
|
2014-02-02 10:37:25 +00:00
|
|
|
|
2010-09-30 16:35:12 +00:00
|
|
|
if (window_type == META_WINDOW_DROPDOWN_MENU ||
|
|
|
|
window_type == META_WINDOW_POPUP_MENU ||
|
|
|
|
window_type == META_WINDOW_TOOLTIP ||
|
|
|
|
window_type == META_WINDOW_NOTIFICATION ||
|
|
|
|
window_type == META_WINDOW_COMBO ||
|
|
|
|
window_type == META_WINDOW_DND ||
|
|
|
|
window_type == META_WINDOW_OVERRIDE_OTHER)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* No effects, just kill it.
|
|
|
|
*/
|
|
|
|
clutter_actor_destroy (CLUTTER_ACTOR (self));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->needs_destroy = TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2010-10-18 17:27:14 +00:00
|
|
|
if (!meta_window_actor_effect_in_progress (self))
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
clutter_actor_destroy (CLUTTER_ACTOR (self));
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-16 02:27:00 +00:00
|
|
|
meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
|
|
|
|
gboolean did_placement)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
MetaRectangle window_rect;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
meta_window_get_buffer_rect (priv->window, &window_rect);
|
2013-09-25 17:16:08 +00: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 22:21:11 +00:00
|
|
|
/* When running as a Wayland compositor we catch size changes when new
|
|
|
|
* buffers are attached */
|
2018-12-21 20:12:49 +00:00
|
|
|
if (META_IS_SURFACE_ACTOR_X11 (priv->surface))
|
|
|
|
meta_surface_actor_x11_set_size (META_SURFACE_ACTOR_X11 (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 22:21:11 +00:00
|
|
|
window_rect.width, window_rect.height);
|
2013-09-25 17:16:08 +00:00
|
|
|
|
2013-02-16 02:27:00 +00:00
|
|
|
/* Normally we want freezing a window to also freeze its position; this allows
|
|
|
|
* windows to atomically move and resize together, either under app control,
|
|
|
|
* or because the user is resizing from the left/top. But on initial placement
|
|
|
|
* we need to assign a position, since immediately after the window
|
|
|
|
* is shown, the map effect will go into effect and prevent further geometry
|
|
|
|
* updates.
|
|
|
|
*/
|
|
|
|
if (is_frozen (self) && !did_placement)
|
|
|
|
return;
|
|
|
|
|
2010-10-18 17:27:14 +00:00
|
|
|
if (meta_window_actor_effect_in_progress (self))
|
2009-06-26 19:33:20 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
clutter_actor_set_position (CLUTTER_ACTOR (self),
|
2009-06-28 16:26:23 +00:00
|
|
|
window_rect.x, window_rect.y);
|
|
|
|
clutter_actor_set_size (CLUTTER_ACTOR (self),
|
|
|
|
window_rect.width, window_rect.height);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_show (MetaWindowActor *self,
|
|
|
|
MetaCompEffect effect)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaCompositor *compositor = priv->compositor;
|
2015-07-06 03:58:40 +00:00
|
|
|
MetaPluginEffect event;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_return_if_fail (!priv->visible);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->visible = TRUE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
switch (effect)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
case META_COMP_EFFECT_CREATE:
|
2010-10-18 17:27:14 +00:00
|
|
|
event = META_PLUGIN_MAP;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_UNMINIMIZE:
|
2013-06-14 01:01:17 +00:00
|
|
|
event = META_PLUGIN_UNMINIMIZE;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_NONE:
|
2015-07-06 04:08:08 +00:00
|
|
|
event = META_PLUGIN_NONE;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
2015-07-06 04:08:08 +00:00
|
|
|
default:
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
g_assert_not_reached();
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
2014-03-18 21:31:22 +00:00
|
|
|
if (compositor->switch_workspace_in_progress ||
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
!start_simple_effect (self, event))
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2012-01-17 14:16:46 +00:00
|
|
|
clutter_actor_show (CLUTTER_ACTOR (self));
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_hide (MetaWindowActor *self,
|
|
|
|
MetaCompEffect effect)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaCompositor *compositor = priv->compositor;
|
2015-07-06 04:08:08 +00:00
|
|
|
MetaPluginEffect event;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_return_if_fail (priv->visible);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->visible = FALSE;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
/* If a plugin is animating a workspace transition, we have to
|
|
|
|
* hold off on hiding the window, and do it after the workspace
|
|
|
|
* switch completes
|
2009-06-26 19:33:20 +00:00
|
|
|
*/
|
2014-03-18 21:31:22 +00:00
|
|
|
if (compositor->switch_workspace_in_progress)
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
return;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
switch (effect)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
case META_COMP_EFFECT_DESTROY:
|
2010-10-18 17:27:14 +00:00
|
|
|
event = META_PLUGIN_DESTROY;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_MINIMIZE:
|
2010-10-18 17:27:14 +00:00
|
|
|
event = META_PLUGIN_MINIMIZE;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_NONE:
|
2015-07-06 04:08:08 +00:00
|
|
|
event = META_PLUGIN_NONE;
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
break;
|
2015-07-06 04:08:08 +00:00
|
|
|
default:
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
g_assert_not_reached();
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
|
2015-07-06 04:08:08 +00:00
|
|
|
if (!start_simple_effect (self, event))
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
clutter_actor_hide (CLUTTER_ACTOR (self));
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-07-06 04:08:08 +00:00
|
|
|
meta_window_actor_size_change (MetaWindowActor *self,
|
|
|
|
MetaSizeChange which_change,
|
|
|
|
MetaRectangle *old_frame_rect,
|
|
|
|
MetaRectangle *old_buffer_rect)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaCompositor *compositor = priv->compositor;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->size_change_in_progress++;
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_freeze (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2015-07-06 04:08:08 +00:00
|
|
|
if (!meta_plugin_manager_event_size_change (compositor->plugin_mgr, self,
|
|
|
|
which_change, old_frame_rect, old_buffer_rect))
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->size_change_in_progress--;
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_thaw (self);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-29 18:30:26 +00:00
|
|
|
#if 0
|
|
|
|
/* Print out a region; useful for debugging */
|
|
|
|
static void
|
2012-04-29 08:44:53 +00:00
|
|
|
print_region (cairo_region_t *region)
|
2009-06-29 18:30:26 +00:00
|
|
|
{
|
|
|
|
int n_rects;
|
|
|
|
int i;
|
|
|
|
|
2010-10-18 15:32:50 +00:00
|
|
|
n_rects = cairo_region_num_rectangles (region);
|
2009-06-29 18:30:26 +00:00
|
|
|
g_print ("[");
|
|
|
|
for (i = 0; i < n_rects; i++)
|
|
|
|
{
|
2010-10-18 15:32:50 +00:00
|
|
|
cairo_rectangle_int_t rect;
|
2011-07-18 20:41:31 +00:00
|
|
|
cairo_region_get_rectangle (region, i, &rect);
|
2009-06-29 18:30:26 +00:00
|
|
|
g_print ("+%d+%dx%dx%d ",
|
2010-10-18 15:32:50 +00:00
|
|
|
rect.x, rect.y, rect.width, rect.height);
|
2009-06-29 18:30:26 +00:00
|
|
|
}
|
|
|
|
g_print ("]\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-04-29 08:44:53 +00:00
|
|
|
#if 0
|
|
|
|
/* Dump a region to a PNG file; useful for debugging */
|
|
|
|
static void
|
|
|
|
see_region (cairo_region_t *region,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
char *filename)
|
|
|
|
{
|
|
|
|
cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
|
|
|
|
cairo_t *cr = cairo_create (surface);
|
|
|
|
|
|
|
|
gdk_cairo_region (cr, region);
|
|
|
|
cairo_fill (cr);
|
|
|
|
|
|
|
|
cairo_surface_write_to_png (surface, filename);
|
|
|
|
cairo_destroy (cr);
|
|
|
|
cairo_surface_destroy (surface);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-06-29 18:30:26 +00:00
|
|
|
/**
|
2013-08-27 14:45:15 +00:00
|
|
|
* meta_window_actor_set_clip_region_beneath:
|
2010-10-18 17:27:14 +00:00
|
|
|
* @self: a #MetaWindowActor
|
2013-08-27 14:45:15 +00:00
|
|
|
* @clip_region: the region of the screen that isn't completely
|
2009-06-29 18:30:26 +00:00
|
|
|
* obscured beneath the main window texture.
|
|
|
|
*
|
|
|
|
* Provides a hint as to what areas need to be drawn *beneath*
|
2013-08-27 14:45:15 +00:00
|
|
|
* the main window texture. This is the relevant clip region
|
2009-06-29 18:30:26 +00:00
|
|
|
* when drawing the shadow, properly accounting for areas of the
|
|
|
|
* shadow hid by the window itself. This will be set before painting
|
|
|
|
* then unset afterwards.
|
|
|
|
*/
|
2013-11-21 20:13:18 +00:00
|
|
|
static void
|
2013-08-27 14:45:15 +00:00
|
|
|
meta_window_actor_set_clip_region_beneath (MetaWindowActor *self,
|
|
|
|
cairo_region_t *beneath_region)
|
2009-06-29 18:30:26 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
gboolean appears_focused = meta_window_appears_focused (priv->window);
|
2009-06-29 18:30:26 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (appears_focused ? priv->focused_shadow : priv->unfocused_shadow)
|
2009-06-29 18:30:26 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
g_clear_pointer (&priv->shadow_clip, cairo_region_destroy);
|
2011-03-22 19:36:12 +00:00
|
|
|
|
2014-02-05 18:20:18 +00:00
|
|
|
if (beneath_region)
|
2011-03-22 19:36:12 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->shadow_clip = cairo_region_copy (beneath_region);
|
2014-02-05 18:20:18 +00:00
|
|
|
|
|
|
|
if (clip_shadow_under_window (self))
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (priv->window);
|
|
|
|
cairo_region_subtract (priv->shadow_clip, frame_bounds);
|
2014-02-05 18:20:18 +00:00
|
|
|
}
|
2011-03-22 19:36:12 +00:00
|
|
|
}
|
2014-02-05 18:20:18 +00:00
|
|
|
else
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->shadow_clip = NULL;
|
2009-06-29 18:30:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-21 20:25:08 +00:00
|
|
|
static void
|
|
|
|
meta_window_actor_cull_out (MetaCullable *cullable,
|
|
|
|
cairo_region_t *unobscured_region,
|
|
|
|
cairo_region_t *clip_region)
|
2013-11-21 20:13:18 +00:00
|
|
|
{
|
2013-11-21 20:25:08 +00:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (cullable);
|
2014-01-22 14:16:56 +00:00
|
|
|
|
2014-02-26 13:50:14 +00:00
|
|
|
meta_cullable_cull_out_children (cullable, unobscured_region, clip_region);
|
2013-11-21 20:13:18 +00:00
|
|
|
meta_window_actor_set_clip_region_beneath (self, clip_region);
|
|
|
|
}
|
|
|
|
|
2013-11-21 20:25:08 +00:00
|
|
|
static void
|
|
|
|
meta_window_actor_reset_culling (MetaCullable *cullable)
|
2009-06-29 18:30:26 +00:00
|
|
|
{
|
2013-11-21 20:25:08 +00:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (cullable);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2009-06-29 18:30:26 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_clear_pointer (&priv->shadow_clip, cairo_region_destroy);
|
2013-11-21 21:25:20 +00:00
|
|
|
|
|
|
|
meta_cullable_reset_culling_children (cullable);
|
2009-06-29 18:30:26 +00:00
|
|
|
}
|
|
|
|
|
2013-11-21 20:25:08 +00:00
|
|
|
static void
|
|
|
|
cullable_iface_init (MetaCullableInterface *iface)
|
|
|
|
{
|
|
|
|
iface->cull_out = meta_window_actor_cull_out;
|
|
|
|
iface->reset_culling = meta_window_actor_reset_culling;
|
|
|
|
}
|
|
|
|
|
2010-10-18 19:34:08 +00:00
|
|
|
static void
|
|
|
|
check_needs_shadow (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2010-10-18 19:34:08 +00:00
|
|
|
MetaShadow *old_shadow = NULL;
|
2010-11-11 21:24:43 +00:00
|
|
|
MetaShadow **shadow_location;
|
|
|
|
gboolean recompute_shadow;
|
2010-10-18 19:34:08 +00:00
|
|
|
gboolean should_have_shadow;
|
2010-11-11 21:24:43 +00:00
|
|
|
gboolean appears_focused;
|
2010-10-18 19:34:08 +00:00
|
|
|
|
|
|
|
/* Calling meta_window_actor_has_shadow() here at every pre-paint is cheap
|
|
|
|
* and avoids the need to explicitly handle window type changes, which
|
|
|
|
* we would do if tried to keep track of when we might be adding or removing
|
|
|
|
* a shadow more explicitly. We only keep track of changes to the *shape* of
|
2018-12-21 20:12:49 +00:00
|
|
|
* the shadow with priv->recompute_shadow.
|
2010-10-18 19:34:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
should_have_shadow = meta_window_actor_has_shadow (self);
|
2018-12-21 20:12:49 +00:00
|
|
|
appears_focused = meta_window_appears_focused (priv->window);
|
2010-11-11 21:24:43 +00:00
|
|
|
|
|
|
|
if (appears_focused)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
recompute_shadow = priv->recompute_focused_shadow;
|
|
|
|
priv->recompute_focused_shadow = FALSE;
|
|
|
|
shadow_location = &priv->focused_shadow;
|
2010-11-11 21:24:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
recompute_shadow = priv->recompute_unfocused_shadow;
|
|
|
|
priv->recompute_unfocused_shadow = FALSE;
|
|
|
|
shadow_location = &priv->unfocused_shadow;
|
2010-11-11 21:24:43 +00:00
|
|
|
}
|
2010-10-18 19:34:08 +00:00
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
if (!should_have_shadow || recompute_shadow)
|
2010-10-18 19:34:08 +00:00
|
|
|
{
|
2010-11-11 21:24:43 +00:00
|
|
|
if (*shadow_location != NULL)
|
|
|
|
{
|
|
|
|
old_shadow = *shadow_location;
|
|
|
|
*shadow_location = NULL;
|
|
|
|
}
|
2010-10-18 19:34:08 +00:00
|
|
|
}
|
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
if (*shadow_location == NULL && should_have_shadow)
|
2010-10-18 19:34:08 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->shadow_shape == NULL)
|
|
|
|
priv->shadow_shape = meta_window_shape_new (priv->shape_region);
|
2013-01-15 02:47:46 +00:00
|
|
|
|
2013-01-15 02:47:46 +00:00
|
|
|
MetaShadowFactory *factory = meta_shadow_factory_get_default ();
|
|
|
|
const char *shadow_class = meta_window_actor_get_shadow_class (self);
|
|
|
|
cairo_rectangle_int_t shape_bounds;
|
|
|
|
|
|
|
|
meta_window_actor_get_shape_bounds (self, &shape_bounds);
|
|
|
|
*shadow_location = meta_shadow_factory_get_shadow (factory,
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->shadow_shape,
|
2013-01-15 02:47:46 +00:00
|
|
|
shape_bounds.width, shape_bounds.height,
|
|
|
|
shadow_class, appears_focused);
|
2010-10-18 19:34:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (old_shadow != NULL)
|
|
|
|
meta_shadow_unref (old_shadow);
|
|
|
|
}
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
void
|
2012-01-07 22:21:32 +00:00
|
|
|
meta_window_actor_process_x11_damage (MetaWindowActor *self,
|
|
|
|
XDamageNotifyEvent *event)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (priv->surface)
|
|
|
|
meta_surface_actor_process_damage (priv->surface,
|
2014-02-25 00:22:56 +00:00
|
|
|
event->area.x,
|
|
|
|
event->area.y,
|
|
|
|
event->area.width,
|
|
|
|
event->area.height);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_sync_visibility (MetaWindowActor *self)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self) != priv->visible)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->visible)
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 21:10:40 +00:00
|
|
|
clutter_actor_show (CLUTTER_ACTOR (self));
|
|
|
|
else
|
|
|
|
clutter_actor_hide (CLUTTER_ACTOR (self));
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-29 11:10:15 +00:00
|
|
|
static cairo_region_t *
|
2012-04-27 04:15:30 +00:00
|
|
|
scan_visible_region (guchar *mask_data,
|
|
|
|
int stride,
|
2012-04-29 11:10:15 +00:00
|
|
|
cairo_region_t *scan_area)
|
2012-04-27 04:15:30 +00:00
|
|
|
{
|
2012-04-29 11:10:15 +00:00
|
|
|
int i, n_rects = cairo_region_num_rectangles (scan_area);
|
|
|
|
MetaRegionBuilder builder;
|
|
|
|
|
|
|
|
meta_region_builder_init (&builder);
|
2012-04-27 04:15:30 +00:00
|
|
|
|
|
|
|
for (i = 0; i < n_rects; i++)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
cairo_rectangle_int_t rect;
|
|
|
|
|
|
|
|
cairo_region_get_rectangle (scan_area, i, &rect);
|
|
|
|
|
|
|
|
for (y = rect.y; y < (rect.y + rect.height); y++)
|
|
|
|
{
|
|
|
|
for (x = rect.x; x < (rect.x + rect.width); x++)
|
|
|
|
{
|
2013-01-16 15:14:40 +00:00
|
|
|
int x2 = x;
|
|
|
|
while (mask_data[y * stride + x2] == 255 && x2 < (rect.x + rect.width))
|
|
|
|
x2++;
|
2012-04-27 04:15:30 +00:00
|
|
|
|
2013-01-16 15:16:58 +00:00
|
|
|
if (x2 > x)
|
2012-04-27 04:15:30 +00:00
|
|
|
{
|
2013-01-16 15:14:40 +00:00
|
|
|
meta_region_builder_add_rectangle (&builder, x, y, x2 - x, 1);
|
|
|
|
x = x2;
|
2012-04-27 04:15:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-04-29 11:10:15 +00:00
|
|
|
|
|
|
|
return meta_region_builder_finish (&builder);
|
2012-04-27 04:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
build_and_scan_frame_mask (MetaWindowActor *self,
|
|
|
|
cairo_rectangle_int_t *client_area,
|
|
|
|
cairo_region_t *shape_region)
|
2012-04-27 04:14:42 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2014-08-07 17:35:35 +00:00
|
|
|
ClutterBackend *backend = clutter_get_default_backend ();
|
|
|
|
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
2012-04-27 04:14:42 +00:00
|
|
|
guchar *mask_data;
|
|
|
|
guint tex_width, tex_height;
|
2013-10-13 11:47:53 +00:00
|
|
|
MetaShapedTexture *stex;
|
2013-02-20 00:34:47 +00:00
|
|
|
CoglTexture *paint_tex, *mask_texture;
|
2012-04-27 04:14:42 +00:00
|
|
|
int stride;
|
2012-05-14 18:35:16 +00:00
|
|
|
cairo_t *cr;
|
|
|
|
cairo_surface_t *surface;
|
2012-04-27 04:14:42 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
stex = meta_surface_actor_get_texture (priv->surface);
|
2013-10-13 11:47:53 +00:00
|
|
|
g_return_if_fail (stex);
|
|
|
|
|
|
|
|
meta_shaped_texture_set_mask_texture (stex, NULL);
|
|
|
|
|
|
|
|
paint_tex = meta_shaped_texture_get_texture (stex);
|
2013-02-20 00:34:47 +00:00
|
|
|
if (paint_tex == NULL)
|
2012-04-27 04:14:42 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
tex_width = cogl_texture_get_width (paint_tex);
|
|
|
|
tex_height = cogl_texture_get_height (paint_tex);
|
|
|
|
|
|
|
|
stride = cairo_format_stride_for_width (CAIRO_FORMAT_A8, tex_width);
|
|
|
|
|
|
|
|
/* Create data for an empty image */
|
|
|
|
mask_data = g_malloc0 (stride * tex_height);
|
|
|
|
|
2012-05-14 18:35:16 +00:00
|
|
|
surface = cairo_image_surface_create_for_data (mask_data,
|
|
|
|
CAIRO_FORMAT_A8,
|
|
|
|
tex_width,
|
|
|
|
tex_height,
|
|
|
|
stride);
|
|
|
|
cr = cairo_create (surface);
|
2012-04-27 04:14:42 +00:00
|
|
|
|
2012-05-14 18:35:16 +00:00
|
|
|
gdk_cairo_region (cr, shape_region);
|
|
|
|
cairo_fill (cr);
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->window->frame != NULL)
|
2012-04-27 04:15:30 +00:00
|
|
|
{
|
2012-04-29 11:10:15 +00:00
|
|
|
cairo_region_t *frame_paint_region, *scanned_region;
|
2012-04-27 04:15:30 +00:00
|
|
|
cairo_rectangle_int_t rect = { 0, 0, tex_width, tex_height };
|
|
|
|
|
|
|
|
/* Make sure we don't paint the frame over the client window. */
|
|
|
|
frame_paint_region = cairo_region_create_rectangle (&rect);
|
|
|
|
cairo_region_subtract_rectangle (frame_paint_region, client_area);
|
|
|
|
|
|
|
|
gdk_cairo_region (cr, frame_paint_region);
|
|
|
|
cairo_clip (cr);
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
meta_frame_get_mask (priv->window->frame, cr);
|
2012-04-27 04:15:30 +00:00
|
|
|
|
|
|
|
cairo_surface_flush (surface);
|
2012-04-29 11:10:15 +00:00
|
|
|
scanned_region = scan_visible_region (mask_data, stride, frame_paint_region);
|
|
|
|
cairo_region_union (shape_region, scanned_region);
|
|
|
|
cairo_region_destroy (scanned_region);
|
2012-08-25 07:31:38 +00:00
|
|
|
cairo_region_destroy (frame_paint_region);
|
2012-04-27 04:15:30 +00:00
|
|
|
}
|
|
|
|
|
2012-05-14 18:35:16 +00:00
|
|
|
cairo_destroy (cr);
|
|
|
|
cairo_surface_destroy (surface);
|
2012-04-27 04:14:42 +00:00
|
|
|
|
|
|
|
if (meta_texture_rectangle_check (paint_tex))
|
|
|
|
{
|
2014-08-07 17:35:35 +00:00
|
|
|
mask_texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, tex_width, tex_height));
|
2014-01-13 18:24:30 +00:00
|
|
|
cogl_texture_set_components (mask_texture, COGL_TEXTURE_COMPONENTS_A);
|
|
|
|
cogl_texture_set_region (mask_texture,
|
|
|
|
0, 0, /* src_x/y */
|
|
|
|
0, 0, /* dst_x/y */
|
|
|
|
tex_width, tex_height, /* dst_width/height */
|
|
|
|
tex_width, tex_height, /* width/height */
|
|
|
|
COGL_PIXEL_FORMAT_A_8,
|
|
|
|
stride, mask_data);
|
2012-04-27 04:14:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-14 13:30:31 +00:00
|
|
|
CoglError *error = NULL;
|
|
|
|
|
2014-08-07 17:35:35 +00:00
|
|
|
mask_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
|
|
|
|
COGL_PIXEL_FORMAT_A_8,
|
2016-04-14 13:30:31 +00:00
|
|
|
stride, mask_data, &error));
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_warning ("Failed to allocate mask texture: %s", error->message);
|
|
|
|
cogl_error_free (error);
|
|
|
|
}
|
2012-04-27 04:14:42 +00:00
|
|
|
}
|
|
|
|
|
2013-10-13 11:47:53 +00:00
|
|
|
meta_shaped_texture_set_mask_texture (stex, mask_texture);
|
2014-01-10 11:26:57 +00:00
|
|
|
if (mask_texture)
|
|
|
|
cogl_object_unref (mask_texture);
|
2012-04-27 04:14:42 +00:00
|
|
|
|
|
|
|
g_free (mask_data);
|
|
|
|
}
|
|
|
|
|
2014-02-27 01:45:38 +00:00
|
|
|
static void
|
2014-02-27 00:35:41 +00:00
|
|
|
meta_window_actor_update_shape_region (MetaWindowActor *self)
|
2012-01-19 01:20:02 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2013-08-24 02:20:49 +00:00
|
|
|
cairo_region_t *region = NULL;
|
2014-02-27 00:35:41 +00:00
|
|
|
cairo_rectangle_int_t client_area;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
meta_window_get_client_area_rect (priv->window, &client_area);
|
2012-01-19 01:20:02 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->window->frame != NULL && priv->window->shape_region != NULL)
|
2013-08-24 02:20:49 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
region = cairo_region_copy (priv->window->shape_region);
|
2014-02-27 00:35:41 +00:00
|
|
|
cairo_region_translate (region, client_area.x, client_area.y);
|
2013-08-24 02:20:49 +00:00
|
|
|
}
|
2018-12-21 20:12:49 +00:00
|
|
|
else if (priv->window->shape_region != NULL)
|
2012-01-19 01:20:02 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
region = cairo_region_reference (priv->window->shape_region);
|
2013-08-24 02:20:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If we don't have a shape on the server, that means that
|
|
|
|
* we have an implicit shape of one rectangle covering the
|
|
|
|
* entire window. */
|
2014-02-27 00:35:41 +00:00
|
|
|
region = cairo_region_create_rectangle (&client_area);
|
2012-01-19 01:20:02 +00:00
|
|
|
}
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if ((priv->window->shape_region != NULL) || (priv->window->frame != NULL))
|
2014-02-27 00:35:41 +00:00
|
|
|
build_and_scan_frame_mask (self, &client_area, region);
|
2012-01-19 01:20:02 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_clear_pointer (&priv->shape_region, cairo_region_destroy);
|
|
|
|
priv->shape_region = region;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
|
2013-02-15 20:53:04 +00:00
|
|
|
|
2013-08-24 02:20:49 +00:00
|
|
|
meta_window_actor_invalidate_shadow (self);
|
|
|
|
}
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2014-02-27 01:45:38 +00:00
|
|
|
static void
|
2014-02-27 00:35:41 +00:00
|
|
|
meta_window_actor_update_input_region (MetaWindowActor *self)
|
2013-08-24 02:20:49 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaWindow *window = priv->window;
|
2014-03-31 00:11:47 +00:00
|
|
|
cairo_region_t *region;
|
2014-02-27 00:35:41 +00:00
|
|
|
|
2014-03-31 00:11:47 +00:00
|
|
|
if (window->shape_region && window->input_region)
|
2013-01-15 02:52:20 +00:00
|
|
|
{
|
2014-03-31 00:11:47 +00:00
|
|
|
region = cairo_region_copy (window->shape_region);
|
|
|
|
cairo_region_intersect (region, window->input_region);
|
2013-01-15 02:52:20 +00:00
|
|
|
}
|
2014-03-31 00:11:47 +00:00
|
|
|
else if (window->shape_region)
|
|
|
|
region = cairo_region_reference (window->shape_region);
|
|
|
|
else if (window->input_region)
|
|
|
|
region = cairo_region_reference (window->input_region);
|
2013-01-15 02:52:20 +00:00
|
|
|
else
|
2014-03-31 00:11:47 +00:00
|
|
|
region = NULL;
|
2009-06-28 16:26:23 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
meta_surface_actor_set_input_region (priv->surface, region);
|
2013-08-24 02:20:49 +00:00
|
|
|
cairo_region_destroy (region);
|
|
|
|
}
|
|
|
|
|
2014-02-27 01:45:38 +00:00
|
|
|
static void
|
2013-08-24 02:20:49 +00:00
|
|
|
meta_window_actor_update_opaque_region (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
2013-11-21 21:25:20 +00:00
|
|
|
cairo_region_t *opaque_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 22:21:11 +00:00
|
|
|
gboolean argb32 = is_argb32 (self);
|
2013-10-13 11:47:53 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (argb32 && priv->window->opaque_region != NULL)
|
2013-01-15 01:45:31 +00:00
|
|
|
{
|
2014-02-27 00:38:11 +00:00
|
|
|
cairo_rectangle_int_t client_area;
|
2013-08-24 02:20:49 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
meta_window_get_client_area_rect (priv->window, &client_area);
|
2013-08-24 02:20:49 +00:00
|
|
|
|
2013-01-15 01:45:31 +00:00
|
|
|
/* The opaque region is defined to be a part of the
|
|
|
|
* window which ARGB32 will always paint with opaque
|
|
|
|
* pixels. For these regions, we want to avoid painting
|
|
|
|
* windows and shadows beneath them.
|
|
|
|
*
|
|
|
|
* If the client gives bad coordinates where it does not
|
|
|
|
* fully paint, the behavior is defined by the specification
|
|
|
|
* to be undefined, and considered a client bug. In mutter's
|
|
|
|
* case, graphical glitches will occur.
|
|
|
|
*/
|
2018-12-21 20:12:49 +00:00
|
|
|
opaque_region = cairo_region_copy (priv->window->opaque_region);
|
2014-02-27 00:38:11 +00:00
|
|
|
cairo_region_translate (opaque_region, client_area.x, client_area.y);
|
2018-12-21 20:12:49 +00:00
|
|
|
cairo_region_intersect (opaque_region, priv->shape_region);
|
2013-01-15 01:45:31 +00: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 22:21:11 +00:00
|
|
|
else if (argb32)
|
2013-11-21 21:25:20 +00:00
|
|
|
opaque_region = NULL;
|
2013-01-15 01:45:31 +00:00
|
|
|
else
|
2018-12-21 20:12:49 +00:00
|
|
|
opaque_region = cairo_region_reference (priv->shape_region);
|
2013-08-27 20:17:34 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
meta_surface_actor_set_opaque_region (priv->surface, opaque_region);
|
2013-11-21 21:25:20 +00:00
|
|
|
cairo_region_destroy (opaque_region);
|
2012-01-19 01:20:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 01:52:44 +00:00
|
|
|
static void
|
|
|
|
check_needs_reshape (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
if (!priv->needs_reshape)
|
2014-02-27 01:52:44 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
meta_window_actor_update_shape_region (self);
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
2014-02-27 01:52:44 +00:00
|
|
|
{
|
|
|
|
meta_window_actor_update_input_region (self);
|
|
|
|
meta_window_actor_update_opaque_region (self);
|
|
|
|
}
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->needs_reshape = FALSE;
|
2014-02-27 01:52:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_actor_update_shape (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
priv->needs_reshape = TRUE;
|
2014-02-27 01:52:44 +00:00
|
|
|
|
|
|
|
if (is_frozen (self))
|
|
|
|
return;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (priv->surface));
|
2014-02-27 01:52:44 +00:00
|
|
|
}
|
|
|
|
|
2012-11-12 19:11:08 +00:00
|
|
|
static void
|
|
|
|
meta_window_actor_handle_updates (MetaWindowActor *self)
|
2009-06-28 16:26:23 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
2010-03-02 18:02:28 +00:00
|
|
|
if (is_frozen (self))
|
|
|
|
{
|
|
|
|
/* The window is frozen due to a pending animation: we'll wait until
|
|
|
|
* the animation finishes to reshape and repair the window */
|
|
|
|
return;
|
|
|
|
}
|
2009-06-28 16:26:23 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (meta_surface_actor_is_unredirected (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 22:21:11 +00:00
|
|
|
return;
|
2011-09-14 15:27:54 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
meta_surface_actor_pre_paint (priv->surface);
|
2014-01-22 14:16:56 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (!meta_surface_actor_is_visible (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 22:21:11 +00:00
|
|
|
return;
|
2010-05-13 20:43:30 +00:00
|
|
|
|
2014-02-27 01:52:44 +00:00
|
|
|
check_needs_reshape (self);
|
2010-10-18 19:34:08 +00:00
|
|
|
check_needs_shadow (self);
|
2011-06-13 22:09:59 +00:00
|
|
|
}
|
|
|
|
|
2012-11-12 19:11:08 +00:00
|
|
|
void
|
|
|
|
meta_window_actor_pre_paint (MetaWindowActor *self)
|
|
|
|
{
|
2014-09-10 21:55:22 +00:00
|
|
|
if (meta_window_actor_is_destroyed (self))
|
|
|
|
return;
|
|
|
|
|
2012-11-12 19:11:08 +00:00
|
|
|
meta_window_actor_handle_updates (self);
|
|
|
|
|
2018-12-21 20:51:02 +00:00
|
|
|
META_WINDOW_ACTOR_GET_CLASS (self)->pre_paint (self);
|
2013-08-17 17:11:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_actor_post_paint (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
2018-12-21 20:51:02 +00:00
|
|
|
META_WINDOW_ACTOR_GET_CLASS (self)->post_paint (self);
|
2011-06-13 22:09:59 +00:00
|
|
|
|
2014-09-10 21:55:22 +00:00
|
|
|
if (meta_window_actor_is_destroyed (self))
|
|
|
|
return;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->first_frame_state == DRAWING_FIRST_FRAME)
|
2014-05-21 13:57:15 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->first_frame_state = EMITTED_FIRST_FRAME;
|
2014-05-21 13:57:15 +00:00
|
|
|
g_signal_emit (self, signals[FIRST_FRAME], 0);
|
|
|
|
}
|
2012-11-12 19:11:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-06-08 05:07:09 +00:00
|
|
|
meta_window_actor_frame_complete (MetaWindowActor *self,
|
|
|
|
ClutterFrameInfo *frame_info,
|
|
|
|
gint64 presentation_time)
|
2012-11-12 19:11:08 +00:00
|
|
|
{
|
2018-12-21 20:51:02 +00:00
|
|
|
META_WINDOW_ACTOR_GET_CLASS (self)->frame_complete (self,
|
|
|
|
frame_info,
|
|
|
|
presentation_time);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
void
|
|
|
|
meta_window_actor_invalidate_shadow (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
|
|
|
|
priv->recompute_focused_shadow = TRUE;
|
|
|
|
priv->recompute_unfocused_shadow = TRUE;
|
2013-02-15 20:53:04 +00:00
|
|
|
|
|
|
|
if (is_frozen (self))
|
|
|
|
return;
|
|
|
|
|
2010-11-11 21:24:43 +00:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
|
|
|
|
}
|
|
|
|
|
2009-06-26 19:33:20 +00:00
|
|
|
void
|
2010-10-18 17:27:14 +00:00
|
|
|
meta_window_actor_update_opacity (MetaWindowActor *self)
|
2009-06-26 19:33:20 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaWindow *window = priv->window;
|
2009-06-26 19:33:20 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->surface)
|
|
|
|
clutter_actor_set_opacity (CLUTTER_ACTOR (priv->surface), window->opacity);
|
2009-06-26 19:33:20 +00:00
|
|
|
}
|
2011-06-13 21:53:23 +00:00
|
|
|
|
2014-06-17 17:06:10 +00:00
|
|
|
static void
|
2011-06-13 21:53:23 +00:00
|
|
|
meta_window_actor_set_updates_frozen (MetaWindowActor *self,
|
|
|
|
gboolean updates_frozen)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_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 22:21:11 +00:00
|
|
|
updates_frozen = updates_frozen != FALSE;
|
2011-06-13 21:53:23 +00:00
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
if (priv->updates_frozen != updates_frozen)
|
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 22:21:11 +00:00
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
priv->updates_frozen = updates_frozen;
|
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 22:21:11 +00:00
|
|
|
if (updates_frozen)
|
|
|
|
meta_window_actor_freeze (self);
|
|
|
|
else
|
|
|
|
meta_window_actor_thaw (self);
|
2011-06-13 21:53:23 +00:00
|
|
|
}
|
|
|
|
}
|
2014-06-17 17:06:10 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_actor_sync_updates_frozen (MetaWindowActor *self)
|
|
|
|
{
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (self);
|
|
|
|
MetaWindow *window = priv->window;
|
2014-06-17 17:06:10 +00:00
|
|
|
|
|
|
|
meta_window_actor_set_updates_frozen (self, meta_window_updates_are_frozen (window));
|
|
|
|
}
|
2018-04-04 08:10:32 +00:00
|
|
|
|
|
|
|
MetaWindowActor *
|
|
|
|
meta_window_actor_from_window (MetaWindow *window)
|
|
|
|
{
|
|
|
|
return META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
|
}
|
2018-12-04 15:29:47 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_get_buffer_bounds (MetaScreenCastWindow *screen_cast_window,
|
|
|
|
MetaRectangle *bounds)
|
|
|
|
{
|
|
|
|
MetaWindowActor *window_actor = META_WINDOW_ACTOR (screen_cast_window);
|
|
|
|
ClutterActor *clutter_actor;
|
|
|
|
|
|
|
|
clutter_actor = CLUTTER_ACTOR (meta_window_actor_get_texture (window_actor));
|
|
|
|
bounds->x = 0;
|
|
|
|
bounds->y = 0;
|
|
|
|
bounds->width = (int) clutter_actor_get_width (clutter_actor);
|
|
|
|
bounds->height = (int) clutter_actor_get_height (clutter_actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_get_frame_bounds (MetaScreenCastWindow *screen_cast_window,
|
|
|
|
MetaRectangle *bounds)
|
|
|
|
{
|
|
|
|
MetaWindowActor *window_actor = META_WINDOW_ACTOR (screen_cast_window);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (window_actor);
|
2018-12-04 15:29:47 +00:00
|
|
|
MetaWindow *window;
|
|
|
|
MetaShapedTexture *stex;
|
|
|
|
MetaRectangle buffer_rect;
|
|
|
|
MetaRectangle frame_rect;
|
|
|
|
double scale_x, scale_y;
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
stex = meta_surface_actor_get_texture (priv->surface);
|
2018-12-04 15:29:47 +00:00
|
|
|
clutter_actor_get_scale (CLUTTER_ACTOR (stex), &scale_x, &scale_y);
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
window = priv->window;
|
2018-12-04 15:29:47 +00:00
|
|
|
meta_window_get_buffer_rect (window, &buffer_rect);
|
|
|
|
meta_window_get_frame_rect (window, &frame_rect);
|
|
|
|
|
|
|
|
bounds->x = (int) floor ((frame_rect.x - buffer_rect.x) / scale_x);
|
|
|
|
bounds->y = (int) floor ((frame_rect.y - buffer_rect.y) / scale_y);
|
|
|
|
bounds->width = (int) ceil (frame_rect.width / scale_x);
|
|
|
|
bounds->height = (int) ceil (frame_rect.height / scale_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_transform_relative_position (MetaScreenCastWindow *screen_cast_window,
|
|
|
|
double x,
|
|
|
|
double y,
|
|
|
|
double *x_out,
|
|
|
|
double *y_out)
|
|
|
|
|
|
|
|
{
|
|
|
|
MetaWindowActor *window_actor = META_WINDOW_ACTOR (screen_cast_window);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (window_actor);
|
2018-12-04 15:29:47 +00:00
|
|
|
MetaShapedTexture *stex;
|
|
|
|
MetaRectangle bounds;
|
|
|
|
ClutterVertex v1 = { 0.f, }, v2 = { 0.f, };
|
|
|
|
|
|
|
|
meta_window_actor_get_frame_bounds (screen_cast_window, &bounds);
|
|
|
|
|
|
|
|
v1.x = CLAMP ((float) x,
|
|
|
|
bounds.x,
|
|
|
|
bounds.x + bounds.width);
|
|
|
|
v1.y = CLAMP ((float) y,
|
|
|
|
bounds.y,
|
|
|
|
bounds.y + bounds.height);
|
|
|
|
|
2018-12-21 20:12:49 +00:00
|
|
|
stex = meta_surface_actor_get_texture (priv->surface);
|
2018-12-04 15:29:47 +00:00
|
|
|
clutter_actor_apply_transform_to_point (CLUTTER_ACTOR (stex), &v1, &v2);
|
|
|
|
|
|
|
|
*x_out = (double) v2.x;
|
|
|
|
*y_out = (double) v2.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_capture_into (MetaScreenCastWindow *screen_cast_window,
|
|
|
|
MetaRectangle *bounds,
|
|
|
|
uint8_t *data)
|
|
|
|
{
|
|
|
|
MetaWindowActor *window_actor = META_WINDOW_ACTOR (screen_cast_window);
|
2018-12-21 20:12:49 +00:00
|
|
|
MetaWindowActorPrivate *priv =
|
|
|
|
meta_window_actor_get_instance_private (window_actor);
|
2018-12-04 15:29:47 +00:00
|
|
|
cairo_surface_t *image;
|
|
|
|
MetaRectangle clip_rect;
|
|
|
|
uint8_t *cr_data;
|
|
|
|
int cr_stride;
|
|
|
|
int bpp = 4;
|
|
|
|
|
|
|
|
if (meta_window_actor_is_destroyed (window_actor))
|
|
|
|
return;
|
|
|
|
|
|
|
|
clip_rect = *bounds;
|
2018-12-21 20:12:49 +00:00
|
|
|
image = meta_surface_actor_get_image (priv->surface, &clip_rect);
|
2018-12-04 15:29:47 +00:00
|
|
|
cr_data = cairo_image_surface_get_data (image);
|
|
|
|
cr_stride = cairo_image_surface_get_stride (image);
|
|
|
|
|
|
|
|
if (clip_rect.width < bounds->width || clip_rect.height < bounds->height)
|
|
|
|
{
|
|
|
|
uint8_t *src, *dst;
|
|
|
|
src = cr_data;
|
|
|
|
dst = data;
|
|
|
|
|
|
|
|
for (int i = 0; i < clip_rect.height; i++)
|
|
|
|
{
|
|
|
|
memcpy (dst, src, cr_stride);
|
|
|
|
if (clip_rect.width < bounds->width)
|
|
|
|
memset (dst + cr_stride, 0, (bounds->width * bpp) - cr_stride);
|
|
|
|
|
|
|
|
src += cr_stride;
|
|
|
|
dst += bounds->width * bpp;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = clip_rect.height; i < bounds->height; i++)
|
|
|
|
{
|
|
|
|
memset (dst, 0, bounds->width * bpp);
|
|
|
|
dst += bounds->width * bpp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy (data, cr_data, clip_rect.height * cr_stride);
|
|
|
|
}
|
|
|
|
|
|
|
|
cairo_surface_destroy (image);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
screen_cast_window_iface_init (MetaScreenCastWindowInterface *iface)
|
|
|
|
{
|
|
|
|
iface->get_buffer_bounds = meta_window_actor_get_buffer_bounds;
|
|
|
|
iface->get_frame_bounds = meta_window_actor_get_frame_bounds;
|
|
|
|
iface->transform_relative_position = meta_window_actor_transform_relative_position;
|
|
|
|
iface->capture_into = meta_window_actor_capture_into;
|
|
|
|
}
|