2009-06-26 15:33:20 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2013-03-11 11:52:36 -04:00
|
|
|
/**
|
|
|
|
* SECTION:meta-window-actor
|
|
|
|
* @title: MetaWindowActor
|
|
|
|
* @short_description: An actor representing a top-level window in the scene graph
|
|
|
|
*/
|
|
|
|
|
2010-09-10 10:06:37 -04:00
|
|
|
#include <config.h>
|
|
|
|
|
2009-06-29 14:30:26 -04:00
|
|
|
#include <math.h>
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
#include <X11/extensions/shape.h>
|
|
|
|
#include <X11/extensions/Xcomposite.h>
|
|
|
|
#include <X11/extensions/Xdamage.h>
|
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
|
|
|
|
#include <clutter/x11/clutter-x11.h>
|
2011-07-21 12:44:06 -04:00
|
|
|
#include <cogl/cogl-texture-pixmap-x11.h>
|
2010-11-11 17:18:02 -05:00
|
|
|
#include <gdk/gdk.h> /* for gdk_rectangle_union() */
|
2012-04-27 00:14:42 -04:00
|
|
|
#include <string.h>
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/display.h>
|
|
|
|
#include <meta/errors.h>
|
2009-06-26 15:33:20 -04:00
|
|
|
#include "frame.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/window.h>
|
2011-10-04 17:35:11 -04:00
|
|
|
#include <meta/meta-shaped-texture.h>
|
2009-06-26 15:33:20 -04:00
|
|
|
#include "xprops.h"
|
|
|
|
|
|
|
|
#include "compositor-private.h"
|
2010-11-11 10:21:36 -05:00
|
|
|
#include "meta-shadow-factory-private.h"
|
2010-10-18 13:27:14 -04:00
|
|
|
#include "meta-window-actor-private.h"
|
2012-04-27 00:14:42 -04:00
|
|
|
#include "meta-texture-rectangle.h"
|
2012-04-29 07:10:15 -04:00
|
|
|
#include "region-utils.h"
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2011-01-25 15:08:43 -05:00
|
|
|
enum {
|
2011-02-01 11:24:39 -05:00
|
|
|
POSITION_CHANGED,
|
2011-01-25 15:08:43 -05:00
|
|
|
SIZE_CHANGED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL] = {0};
|
|
|
|
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
struct _MetaWindowActorPrivate
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
Window xwindow;
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
ClutterActor *actor;
|
2010-11-11 16:24:43 -05: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;
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
Pixmap back_pixmap;
|
|
|
|
|
|
|
|
Damage damage;
|
|
|
|
|
|
|
|
guint8 opacity;
|
|
|
|
|
2013-01-14 21:47:46 -05:00
|
|
|
/* A region that matches the shape of the window, including frame bounds */
|
2010-10-18 11:32:50 -04:00
|
|
|
cairo_region_t *shape_region;
|
2013-01-14 20:45:31 -05:00
|
|
|
/* The opaque region, from _NET_WM_OPAQUE_REGION, intersected with
|
|
|
|
* the shape region. */
|
|
|
|
cairo_region_t *opaque_region;
|
2010-11-11 18:23:25 -05:00
|
|
|
/* The region we should clip to when painting the shadow */
|
|
|
|
cairo_region_t *shadow_clip;
|
2009-06-29 14:30:26 -04:00
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
/* Extracted size-invariant shape used for shadows */
|
|
|
|
MetaWindowShape *shadow_shape;
|
|
|
|
|
2011-07-19 18:05:30 -04:00
|
|
|
gint last_width;
|
|
|
|
gint last_height;
|
|
|
|
|
2010-04-23 19:08:59 -04:00
|
|
|
gint freeze_count;
|
2010-03-02 13:02:28 -05:00
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
char * shadow_class;
|
2010-10-18 15:34:08 -04:00
|
|
|
|
2009-06-26 15:33:20 -04: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;
|
|
|
|
gint maximize_in_progress;
|
|
|
|
gint unmaximize_in_progress;
|
|
|
|
gint map_in_progress;
|
|
|
|
gint destroy_in_progress;
|
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
/* List of FrameData for recent frames */
|
|
|
|
GList *frames;
|
2011-06-13 18:09:59 -04: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 17:10:40 -04:00
|
|
|
guint visible : 1;
|
|
|
|
guint mapped : 1;
|
2009-06-26 15:33:20 -04:00
|
|
|
guint argb32 : 1;
|
|
|
|
guint disposed : 1;
|
|
|
|
guint redecorating : 1;
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
guint needs_damage_all : 1;
|
2010-05-13 16:43:30 -04:00
|
|
|
guint received_damage : 1;
|
2013-02-14 13:40:55 -05:00
|
|
|
guint repaint_scheduled : 1;
|
2010-03-02 13:02:28 -05:00
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
/* If set, the client needs to be sent a _NET_WM_FRAME_DRAWN
|
|
|
|
* client message using the most recent frame in ->frames */
|
|
|
|
guint needs_frame_drawn : 1;
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
guint needs_pixmap : 1;
|
2010-10-18 15:34:08 -04:00
|
|
|
guint needs_reshape : 1;
|
2010-11-11 16:24:43 -05:00
|
|
|
guint recompute_focused_shadow : 1;
|
|
|
|
guint recompute_unfocused_shadow : 1;
|
2009-06-28 12:26:23 -04:00
|
|
|
guint size_changed : 1;
|
2011-06-13 17:53:23 -04:00
|
|
|
guint updates_frozen : 1;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
guint needs_destroy : 1;
|
|
|
|
|
|
|
|
guint no_shadow : 1;
|
|
|
|
|
2011-08-27 05:43:09 -04:00
|
|
|
guint unredirected : 1;
|
2013-02-02 13:50:01 -05:00
|
|
|
|
|
|
|
/* This is used to detect fullscreen windows that need to be unredirected */
|
|
|
|
guint full_damage_frames_count;
|
|
|
|
guint does_full_damage : 1;
|
2009-06-26 15:33:20 -04:00
|
|
|
};
|
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
typedef struct _FrameData FrameData;
|
|
|
|
|
|
|
|
struct _FrameData
|
|
|
|
{
|
|
|
|
int64_t frame_counter;
|
|
|
|
guint64 sync_request_serial;
|
|
|
|
gint64 frame_drawn_time;
|
|
|
|
};
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
enum
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
PROP_META_WINDOW = 1,
|
|
|
|
PROP_META_SCREEN,
|
|
|
|
PROP_X_WINDOW,
|
|
|
|
PROP_NO_SHADOW,
|
2010-11-11 16:24:43 -05:00
|
|
|
PROP_SHADOW_CLASS
|
2009-06-26 15:33:20 -04:00
|
|
|
};
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
static void meta_window_actor_dispose (GObject *object);
|
|
|
|
static void meta_window_actor_finalize (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 15:33:20 -04:00
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
static void meta_window_actor_paint (ClutterActor *actor);
|
2011-07-16 07:32:12 -04:00
|
|
|
|
2010-11-11 17:18:02 -05:00
|
|
|
static gboolean meta_window_actor_get_paint_volume (ClutterActor *actor,
|
|
|
|
ClutterPaintVolume *volume);
|
2011-07-16 07:32:12 -04:00
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
static void meta_window_actor_detach (MetaWindowActor *self);
|
|
|
|
static gboolean meta_window_actor_has_shadow (MetaWindowActor *self);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
static void meta_window_actor_handle_updates (MetaWindowActor *self);
|
|
|
|
|
2013-01-14 21:47:46 -05:00
|
|
|
static void check_needs_reshape (MetaWindowActor *self);
|
|
|
|
|
2012-01-17 09:16:46 -05:00
|
|
|
G_DEFINE_TYPE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
static void
|
|
|
|
frame_data_free (FrameData *frame)
|
|
|
|
{
|
|
|
|
g_slice_free (FrameData, frame);
|
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_class_init (MetaWindowActorClass *klass)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2010-10-18 15:34:08 -04:00
|
|
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
2009-06-26 15:33:20 -04:00
|
|
|
GParamSpec *pspec;
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
g_type_class_add_private (klass, sizeof (MetaWindowActorPrivate));
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
object_class->dispose = meta_window_actor_dispose;
|
|
|
|
object_class->finalize = meta_window_actor_finalize;
|
|
|
|
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 15:33:20 -04:00
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
actor_class->paint = meta_window_actor_paint;
|
2010-11-11 17:18:02 -05:00
|
|
|
actor_class->get_paint_volume = meta_window_actor_get_paint_volume;
|
2010-10-18 15:34:08 -04:00
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
pspec = g_param_spec_object ("meta-window",
|
|
|
|
"MetaWindow",
|
|
|
|
"The displayed MetaWindow",
|
|
|
|
META_TYPE_WINDOW,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2010-10-18 13:27:14 -04:00
|
|
|
PROP_META_WINDOW,
|
2009-06-26 15:33:20 -04:00
|
|
|
pspec);
|
|
|
|
|
|
|
|
pspec = g_param_spec_pointer ("meta-screen",
|
|
|
|
"MetaScreen",
|
|
|
|
"MetaScreen",
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2010-10-18 13:27:14 -04:00
|
|
|
PROP_META_SCREEN,
|
2009-06-26 15:33:20 -04:00
|
|
|
pspec);
|
|
|
|
|
|
|
|
pspec = g_param_spec_ulong ("x-window",
|
|
|
|
"Window",
|
|
|
|
"Window",
|
|
|
|
0,
|
|
|
|
G_MAXULONG,
|
|
|
|
0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2010-10-18 13:27:14 -04:00
|
|
|
PROP_X_WINDOW,
|
2009-06-26 15:33:20 -04:00
|
|
|
pspec);
|
|
|
|
|
|
|
|
pspec = g_param_spec_boolean ("no-shadow",
|
|
|
|
"No shadow",
|
|
|
|
"Do not add shaddow to this window",
|
|
|
|
FALSE,
|
2010-10-18 15:34:08 -04:00
|
|
|
G_PARAM_READWRITE);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2010-10-18 13:27:14 -04:00
|
|
|
PROP_NO_SHADOW,
|
2009-06-26 15:33:20 -04:00
|
|
|
pspec);
|
2010-10-18 15:34:08 -04:00
|
|
|
|
2010-11-11 16:24:43 -05: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 15:34:08 -04:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2010-11-11 16:24:43 -05:00
|
|
|
PROP_SHADOW_CLASS,
|
2010-10-18 15:34:08 -04:00
|
|
|
pspec);
|
2011-01-25 15:08:43 -05:00
|
|
|
|
2011-02-01 11:24:39 -05:00
|
|
|
signals[POSITION_CHANGED] =
|
|
|
|
g_signal_new ("position-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2011-10-18 18:06:14 -04:00
|
|
|
0, NULL, NULL, NULL,
|
2011-02-01 11:24:39 -05:00
|
|
|
G_TYPE_NONE, 0);
|
2011-01-25 15:08:43 -05:00
|
|
|
signals[SIZE_CHANGED] =
|
|
|
|
g_signal_new ("size-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2011-10-18 18:06:14 -04:00
|
|
|
0, NULL, NULL, NULL,
|
2011-01-25 15:08:43 -05:00
|
|
|
G_TYPE_NONE, 0);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_init (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
2010-10-18 13:27:14 -04:00
|
|
|
META_TYPE_WINDOW_ACTOR,
|
|
|
|
MetaWindowActorPrivate);
|
2009-06-26 15:33:20 -04:00
|
|
|
priv->opacity = 0xff;
|
2010-11-11 16:24:43 -05:00
|
|
|
priv->shadow_class = NULL;
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
window_decorated_notify (MetaWindow *mw,
|
|
|
|
GParamSpec *arg1,
|
|
|
|
gpointer data)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (data);
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
MetaFrame *frame = meta_window_get_frame (mw);
|
|
|
|
MetaScreen *screen = priv->screen;
|
|
|
|
MetaDisplay *display = meta_screen_get_display (screen);
|
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
|
|
Window new_xwindow;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Basically, we have to reconstruct the the internals of this object
|
|
|
|
* from scratch, as everything has changed.
|
|
|
|
*/
|
|
|
|
priv->redecorating = TRUE;
|
|
|
|
|
|
|
|
if (frame)
|
|
|
|
new_xwindow = meta_frame_get_xwindow (frame);
|
|
|
|
else
|
|
|
|
new_xwindow = meta_window_get_xwindow (mw);
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_detach (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* First of all, clean up any resources we are currently using and will
|
|
|
|
* be replacing.
|
|
|
|
*/
|
|
|
|
if (priv->damage != None)
|
|
|
|
{
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
XDamageDestroy (xdisplay, priv->damage);
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2009-06-26 15:33:20 -04:00
|
|
|
priv->damage = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->xwindow = new_xwindow;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Recreate the contents.
|
|
|
|
*/
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_constructed (G_OBJECT (self));
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2011-03-24 21:36:47 -04:00
|
|
|
static void
|
|
|
|
window_appears_focused_notify (MetaWindow *mw,
|
|
|
|
GParamSpec *arg1,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (data));
|
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_constructed (GObject *object)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
MetaScreen *screen = priv->screen;
|
|
|
|
MetaDisplay *display = meta_screen_get_display (screen);
|
|
|
|
Window xwindow = priv->xwindow;
|
2011-07-19 18:05:30 -04:00
|
|
|
MetaWindow *window = priv->window;
|
2010-10-18 13:27:14 -04:00
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
|
|
XRenderPictFormat *format;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2011-07-19 18:05:30 -04:00
|
|
|
priv->damage = XDamageCreate (xdisplay, xwindow,
|
|
|
|
XDamageReportBoundingBox);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2011-07-19 18:05:30 -04:00
|
|
|
format = XRenderFindVisualFormat (xdisplay, window->xvisual);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
if (format && format->type == PictTypeDirect && format->direct.alphaMask)
|
|
|
|
priv->argb32 = TRUE;
|
|
|
|
|
|
|
|
if (!priv->actor)
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
priv->actor = meta_shaped_texture_new ();
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2012-01-17 09:16:46 -05:00
|
|
|
clutter_actor_add_child (CLUTTER_ACTOR (self), priv->actor);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2009-08-07 12:14:48 -04:00
|
|
|
/*
|
|
|
|
* Since we are holding a pointer to this actor independently of the
|
|
|
|
* ClutterContainer internals, and provide a public API to access it,
|
|
|
|
* add a reference here, so that if someone is messing about with us
|
|
|
|
* via the container interface, we do not end up with a dangling pointer.
|
|
|
|
* We will release it in dispose().
|
|
|
|
*/
|
|
|
|
g_object_ref (priv->actor);
|
|
|
|
|
2011-07-19 18:05:30 -04:00
|
|
|
g_signal_connect (window, "notify::decorated",
|
2010-10-18 13:27:14 -04:00
|
|
|
G_CALLBACK (window_decorated_notify), self);
|
2011-07-19 18:05:30 -04:00
|
|
|
g_signal_connect (window, "notify::appears-focused",
|
2011-03-24 21:36:47 -04:00
|
|
|
G_CALLBACK (window_appears_focused_notify), self);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* This is the case where existing window is gaining/loosing frame.
|
|
|
|
* Just ensure the actor is top most (i.e., above shadow).
|
|
|
|
*/
|
2012-01-17 09:16:46 -05:00
|
|
|
clutter_actor_set_child_above_sibling (CLUTTER_ACTOR (self), priv->actor, NULL);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2011-04-26 12:08:15 -04:00
|
|
|
meta_window_actor_update_opacity (self);
|
2013-01-14 21:47:46 -05:00
|
|
|
|
2013-02-09 14:50:56 -05:00
|
|
|
/* Start off with an empty region to maintain the invariant that
|
|
|
|
the shape region is always set */
|
|
|
|
priv->shape_region = cairo_region_create();
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_dispose (GObject *object)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
MetaScreen *screen;
|
|
|
|
MetaDisplay *display;
|
|
|
|
Display *xdisplay;
|
|
|
|
MetaCompScreen *info;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
if (priv->disposed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
priv->disposed = TRUE;
|
|
|
|
|
|
|
|
screen = priv->screen;
|
|
|
|
display = meta_screen_get_display (screen);
|
|
|
|
xdisplay = meta_display_get_xdisplay (display);
|
|
|
|
info = meta_screen_get_compositor_data (screen);
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_detach (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2013-01-14 21:40:46 -05:00
|
|
|
g_clear_pointer (&priv->shape_region, cairo_region_destroy);
|
2013-01-14 20:45:31 -05:00
|
|
|
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
|
2013-01-14 21:40:46 -05:00
|
|
|
g_clear_pointer (&priv->shadow_clip, cairo_region_destroy);
|
2009-06-29 14:30:26 -04:00
|
|
|
|
2013-01-14 21:37:11 -05: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 15:34:08 -04:00
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
if (priv->damage != None)
|
|
|
|
{
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
XDamageDestroy (xdisplay, priv->damage);
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
priv->damage = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
info->windows = g_list_remove (info->windows, (gconstpointer) self);
|
|
|
|
|
2013-01-14 21:37:11 -05:00
|
|
|
g_clear_object (&priv->window);
|
2011-03-07 22:22:19 -05:00
|
|
|
|
2009-08-07 12:14:48 -04:00
|
|
|
/*
|
|
|
|
* Release the extra reference we took on the actor.
|
|
|
|
*/
|
2013-01-14 21:37:11 -05:00
|
|
|
g_clear_object (&priv->actor);
|
2009-08-07 12:14:48 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
G_OBJECT_CLASS (meta_window_actor_parent_class)->dispose (object);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_finalize (GObject *object)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-08-07 11:47:43 -04:00
|
|
|
|
2013-03-04 10:00:42 -05:00
|
|
|
g_list_free_full (priv->frames, (GDestroyNotify) frame_data_free);
|
2009-08-07 11:47:43 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
G_OBJECT_CLASS (meta_window_actor_parent_class)->finalize (object);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
case PROP_META_WINDOW:
|
2011-03-07 22:22:19 -05:00
|
|
|
{
|
|
|
|
if (priv->window)
|
|
|
|
g_object_unref (priv->window);
|
|
|
|
priv->window = g_value_dup_object (value);
|
|
|
|
}
|
2009-06-26 15:33:20 -04:00
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case PROP_META_SCREEN:
|
2009-06-26 15:33:20 -04:00
|
|
|
priv->screen = g_value_get_pointer (value);
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case PROP_X_WINDOW:
|
2009-06-26 15:33:20 -04:00
|
|
|
priv->xwindow = g_value_get_ulong (value);
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case PROP_NO_SHADOW:
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
gboolean newv = g_value_get_boolean (value);
|
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
if (newv == priv->no_shadow)
|
2009-06-26 15:33:20 -04:00
|
|
|
return;
|
|
|
|
|
|
|
|
priv->no_shadow = newv;
|
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
meta_window_actor_invalidate_shadow (self);
|
2010-11-04 17:02:23 -04:00
|
|
|
}
|
|
|
|
break;
|
2010-11-11 16:24:43 -05:00
|
|
|
case PROP_SHADOW_CLASS:
|
2010-10-18 15:34:08 -04:00
|
|
|
{
|
2010-11-11 16:24:43 -05:00
|
|
|
const char *newv = g_value_get_string (value);
|
2010-10-18 15:34:08 -04:00
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
if (g_strcmp0 (newv, priv->shadow_class) == 0)
|
2010-10-18 15:34:08 -04:00
|
|
|
return;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
g_free (priv->shadow_class);
|
|
|
|
priv->shadow_class = g_strdup (newv);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
meta_window_actor_invalidate_shadow (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = META_WINDOW_ACTOR (object)->priv;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
case PROP_META_WINDOW:
|
2009-06-26 15:33:20 -04:00
|
|
|
g_value_set_object (value, priv->window);
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case PROP_META_SCREEN:
|
2009-06-26 15:33:20 -04:00
|
|
|
g_value_set_pointer (value, priv->screen);
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case PROP_X_WINDOW:
|
2009-06-26 15:33:20 -04:00
|
|
|
g_value_set_ulong (value, priv->xwindow);
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case PROP_NO_SHADOW:
|
2009-06-26 15:33:20 -04:00
|
|
|
g_value_set_boolean (value, priv->no_shadow);
|
|
|
|
break;
|
2010-11-11 16:24:43 -05:00
|
|
|
case PROP_SHADOW_CLASS:
|
|
|
|
g_value_set_string (value, priv->shadow_class);
|
2010-10-18 15:34:08 -04:00
|
|
|
break;
|
2009-06-26 15:33:20 -04:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
static const char *
|
|
|
|
meta_window_actor_get_shadow_class (MetaWindowActor *self)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
|
|
|
|
if (priv->shadow_class != NULL)
|
|
|
|
return priv->shadow_class;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MetaWindowType window_type = meta_window_get_window_type (priv->window);
|
|
|
|
|
|
|
|
switch (window_type)
|
|
|
|
{
|
|
|
|
case META_WINDOW_DROPDOWN_MENU:
|
|
|
|
return "dropdown-menu";
|
|
|
|
case META_WINDOW_POPUP_MENU:
|
|
|
|
return "popup-menu";
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
MetaFrameType frame_type = meta_window_get_frame_type (priv->window);
|
|
|
|
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 05:43:09 -04:00
|
|
|
void
|
2010-10-18 15:34:08 -04:00
|
|
|
meta_window_actor_get_shape_bounds (MetaWindowActor *self,
|
|
|
|
cairo_rectangle_int_t *bounds)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
|
2013-01-14 21:47:46 -05:00
|
|
|
cairo_region_get_extents (priv->shape_region, bounds);
|
2010-11-11 17:18:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_get_shadow_bounds (MetaWindowActor *self,
|
|
|
|
gboolean appears_focused,
|
|
|
|
cairo_rectangle_int_t *bounds)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
MetaShadow *shadow = appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
|
|
|
|
cairo_rectangle_int_t shape_bounds;
|
|
|
|
MetaShadowParams params;
|
|
|
|
|
|
|
|
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 15:34:08 -04:00
|
|
|
}
|
|
|
|
|
2011-03-22 15:36:12 -04: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)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
|
|
|
|
return (priv->argb32 || priv->opacity != 0xff) && priv->window->frame;
|
|
|
|
}
|
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
static void
|
|
|
|
meta_window_actor_paint (ClutterActor *actor)
|
|
|
|
{
|
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (actor);
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2010-11-11 18:23:25 -05:00
|
|
|
gboolean appears_focused = meta_window_appears_focused (priv->window);
|
|
|
|
MetaShadow *shadow = appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
|
2010-10-18 15:34:08 -04:00
|
|
|
|
2010-11-11 18:23:25 -05:00
|
|
|
if (shadow != NULL)
|
2010-10-18 15:34:08 -04:00
|
|
|
{
|
2010-11-11 18:23:25 -05:00
|
|
|
MetaShadowParams params;
|
|
|
|
cairo_rectangle_int_t shape_bounds;
|
2011-03-22 15:36:12 -04:00
|
|
|
cairo_region_t *clip = priv->shadow_clip;
|
2010-11-11 18:23:25 -05:00
|
|
|
|
|
|
|
meta_window_actor_get_shape_bounds (self, &shape_bounds);
|
|
|
|
meta_window_actor_get_shadow_params (self, appears_focused, ¶ms);
|
|
|
|
|
2011-03-22 15:36:12 -04:00
|
|
|
/* The frame bounds are already subtracted from priv->shadow_clip
|
|
|
|
* if that exists.
|
|
|
|
*/
|
|
|
|
if (!clip && clip_shadow_under_window (self))
|
|
|
|
{
|
|
|
|
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (priv->window);
|
|
|
|
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 18:23:25 -05:00
|
|
|
meta_shadow_paint (shadow,
|
|
|
|
params.x_offset + shape_bounds.x,
|
|
|
|
params.y_offset + shape_bounds.y,
|
|
|
|
shape_bounds.width,
|
|
|
|
shape_bounds.height,
|
2011-04-26 12:08:15 -04:00
|
|
|
(clutter_actor_get_paint_opacity (actor) * params.opacity * priv->opacity) / (255 * 255),
|
2011-03-22 15:36:12 -04:00
|
|
|
clip,
|
|
|
|
clip_shadow_under_window (self)); /* clip_strictly - not just as an optimization */
|
|
|
|
|
|
|
|
if (clip && clip != priv->shadow_clip)
|
|
|
|
cairo_region_destroy (clip);
|
2010-10-18 15:34:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
CLUTTER_ACTOR_CLASS (meta_window_actor_parent_class)->paint (actor);
|
|
|
|
}
|
|
|
|
|
2010-11-11 17:18:02 -05:00
|
|
|
static gboolean
|
|
|
|
meta_window_actor_get_paint_volume (ClutterActor *actor,
|
|
|
|
ClutterPaintVolume *volume)
|
|
|
|
{
|
|
|
|
MetaWindowActor *self = META_WINDOW_ACTOR (actor);
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
cairo_rectangle_int_t bounds;
|
|
|
|
gboolean appears_focused = meta_window_appears_focused (priv->window);
|
|
|
|
ClutterVertex origin;
|
|
|
|
|
|
|
|
/* The paint volume is computed before paint functions are called
|
|
|
|
* so our bounds might not be updated yet. Force an update. */
|
2012-11-12 14:11:08 -05:00
|
|
|
meta_window_actor_handle_updates (self);
|
2010-11-11 17:18:02 -05:00
|
|
|
|
|
|
|
meta_window_actor_get_shape_bounds (self, &bounds);
|
|
|
|
|
|
|
|
if (appears_focused ? priv->focused_shadow : priv->unfocused_shadow)
|
|
|
|
{
|
|
|
|
cairo_rectangle_int_t shadow_bounds;
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
gdk_rectangle_union (&bounds, &shadow_bounds, &bounds);
|
|
|
|
}
|
|
|
|
|
|
|
|
origin.x = bounds.x;
|
|
|
|
origin.y = bounds.y;
|
|
|
|
origin.z = 0.0f;
|
|
|
|
clutter_paint_volume_set_origin (volume, &origin);
|
|
|
|
|
|
|
|
clutter_paint_volume_set_width (volume, bounds.width);
|
|
|
|
clutter_paint_volume_set_height (volume, bounds.height);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
static gboolean
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_has_shadow (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2010-09-30 12:35:12 -04:00
|
|
|
MetaWindowType window_type = meta_window_get_window_type (priv->window);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
if (priv->no_shadow)
|
|
|
|
return FALSE;
|
|
|
|
|
2010-11-11 18:43:35 -05: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 */
|
|
|
|
if ((meta_window_get_maximized (priv->window) == (META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL)) ||
|
|
|
|
meta_window_is_fullscreen (priv->window))
|
|
|
|
return FALSE;
|
|
|
|
|
2011-09-04 20:49:40 -04:00
|
|
|
/*
|
|
|
|
* If we have two snap-tiled windows, we don't want the shadow to obstruct
|
|
|
|
* the other window.
|
|
|
|
*/
|
|
|
|
if (meta_window_get_tile_match (priv->window))
|
|
|
|
return FALSE;
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
/*
|
|
|
|
* Always put a shadow around windows with a frame - This should override
|
2010-10-18 15:34:08 -04:00
|
|
|
* the restriction about not putting a shadow around ARGB windows.
|
2009-06-26 15:33:20 -04:00
|
|
|
*/
|
2012-04-27 00:17:41 -04:00
|
|
|
if (meta_window_get_frame (priv->window))
|
|
|
|
return TRUE;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
/*
|
2010-10-18 15:34:08 -04:00
|
|
|
* Do not add shadows to ARGB windows; eventually we should generate a
|
|
|
|
* shadow from the input shape for such windows.
|
2009-06-26 15:33:20 -04:00
|
|
|
*/
|
|
|
|
if (priv->argb32 || priv->opacity != 0xff)
|
2012-05-01 11:35:25 -04:00
|
|
|
return FALSE;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add shadows to override redirect windows (e.g., Gtk menus).
|
|
|
|
*/
|
2011-07-19 18:05:30 -04:00
|
|
|
if (priv->window->override_redirect)
|
2012-05-01 11:35:25 -04:00
|
|
|
return TRUE;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't put shadow around DND icon windows
|
|
|
|
*/
|
2010-09-30 12:35:12 -04:00
|
|
|
if (window_type == META_WINDOW_DND ||
|
|
|
|
window_type == META_WINDOW_DESKTOP)
|
2012-05-01 11:35:25 -04:00
|
|
|
return FALSE;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2010-09-30 12:35:12 -04:00
|
|
|
if (window_type == META_WINDOW_MENU
|
2009-06-26 15:33:20 -04:00
|
|
|
#if 0
|
2010-09-30 12:35:12 -04:00
|
|
|
|| window_type == META_WINDOW_DROPDOWN_MENU
|
2009-06-26 15:33:20 -04:00
|
|
|
#endif
|
|
|
|
)
|
2012-05-01 11:35:25 -04:00
|
|
|
return TRUE;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
#if 0
|
2010-09-30 12:35:12 -04:00
|
|
|
if (window_type == META_WINDOW_TOOLTIP)
|
2012-05-01 11:35:25 -04:00
|
|
|
return TRUE;
|
2009-06-26 15:33:20 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-09-01 15:39:53 -04:00
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* meta_window_actor_get_x_window: (skip)
|
2013-02-15 13:42:08 -05:00
|
|
|
* @self: a #MetaWindowActor
|
2010-09-01 15:39:53 -04:00
|
|
|
*
|
|
|
|
*/
|
2009-06-26 15:33:20 -04:00
|
|
|
Window
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_get_x_window (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
if (!self)
|
|
|
|
return None;
|
|
|
|
|
|
|
|
return self->priv->xwindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* meta_window_actor_get_meta_window:
|
2013-02-15 13:42:08 -05:00
|
|
|
* @self: a #MetaWindowActor
|
2009-06-26 15:33:20 -04:00
|
|
|
*
|
2011-10-17 22:10:00 -04:00
|
|
|
* Gets the #MetaWindow object that the the #MetaWindowActor is displaying
|
2009-06-26 15:33:20 -04:00
|
|
|
*
|
2011-10-17 22:10:00 -04:00
|
|
|
* Return value: (transfer none): the displayed #MetaWindow
|
2009-06-26 15:33:20 -04:00
|
|
|
*/
|
|
|
|
MetaWindow *
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_get_meta_window (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
return self->priv->window;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* meta_window_actor_get_texture:
|
2013-02-15 13:42:08 -05:00
|
|
|
* @self: a #MetaWindowActor
|
2009-06-26 15:33:20 -04:00
|
|
|
*
|
|
|
|
* Gets the ClutterActor that is used to display the contents of the window
|
|
|
|
*
|
2011-10-17 22:10:00 -04:00
|
|
|
* Return value: (transfer none): the #ClutterActor for the contents
|
2009-06-26 15:33:20 -04:00
|
|
|
*/
|
|
|
|
ClutterActor *
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_get_texture (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
return self->priv->actor;
|
|
|
|
}
|
|
|
|
|
2011-01-18 13:34:15 -05:00
|
|
|
/**
|
|
|
|
* meta_window_actor_is_destroyed:
|
2013-02-15 13:42:08 -05:00
|
|
|
* @self: a #MetaWindowActor
|
2011-01-18 13:34:15 -05: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)
|
|
|
|
{
|
|
|
|
return self->priv->disposed;
|
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
gboolean
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_is_override_redirect (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2009-08-14 05:42:56 -04:00
|
|
|
return meta_window_is_override_redirect (self->priv->window);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2009-10-09 11:50:38 -04:00
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* meta_window_actor_get_workspace:
|
|
|
|
* @self: #MetaWindowActor
|
2009-10-09 11:50:38 -04:00
|
|
|
*
|
|
|
|
* Returns the index of workspace on which this window is located; if the
|
|
|
|
* window is sticky, or is not currently located on any workspace, returns -1.
|
|
|
|
* This function is deprecated and should not be used in newly written code;
|
|
|
|
* meta_window_get_workspace() instead.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): index of workspace on which this window is
|
|
|
|
* located.
|
|
|
|
*/
|
2009-06-26 15:33:20 -04:00
|
|
|
gint
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_get_workspace (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv;
|
|
|
|
MetaWorkspace *workspace;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
if (!self)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (!priv->window || meta_window_is_on_all_workspaces (priv->window))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
workspace = meta_window_get_workspace (priv->window);
|
|
|
|
|
2009-10-09 11:50:38 -04:00
|
|
|
if (!workspace)
|
|
|
|
return -1;
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
return meta_workspace_index (workspace);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_showing_on_its_workspace (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
if (!self)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* If override redirect: */
|
|
|
|
if (!self->priv->window)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return meta_window_showing_on_its_workspace (self->priv->window);
|
|
|
|
}
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_freeze (MetaWindowActor *self)
|
2010-03-02 13:02:28 -05:00
|
|
|
{
|
|
|
|
self->priv->freeze_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_damage_all (MetaWindowActor *self)
|
2010-03-02 13:02:28 -05:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2013-02-19 19:34:47 -05:00
|
|
|
CoglTexture *texture;
|
2010-03-02 13:02:28 -05:00
|
|
|
|
|
|
|
if (!priv->needs_damage_all)
|
|
|
|
return;
|
|
|
|
|
2011-10-04 17:35:11 -04:00
|
|
|
texture = meta_shaped_texture_get_texture (META_SHAPED_TEXTURE (priv->actor));
|
2010-03-02 13:02:28 -05:00
|
|
|
|
2011-11-09 15:12:06 -05:00
|
|
|
if (!priv->mapped || priv->needs_pixmap)
|
|
|
|
return;
|
|
|
|
|
2011-10-04 17:35:11 -04:00
|
|
|
meta_shaped_texture_update_area (META_SHAPED_TEXTURE (priv->actor),
|
|
|
|
0, 0,
|
|
|
|
cogl_texture_get_width (texture),
|
|
|
|
cogl_texture_get_height (texture));
|
2010-03-02 13:02:28 -05:00
|
|
|
|
|
|
|
priv->needs_damage_all = FALSE;
|
2013-02-14 13:40:55 -05:00
|
|
|
priv->repaint_scheduled = TRUE;
|
2010-03-02 13:02:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_thaw (MetaWindowActor *self)
|
2010-03-02 13:02:28 -05:00
|
|
|
{
|
|
|
|
self->priv->freeze_count--;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (self->priv->freeze_count < 0))
|
|
|
|
{
|
|
|
|
g_warning ("Error in freeze/thaw accounting.");
|
|
|
|
self->priv->freeze_count = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self->priv->freeze_count)
|
|
|
|
return;
|
|
|
|
|
2013-02-15 21:27:00 -05:00
|
|
|
/* We sometimes ignore moves and resizes on frozen windows */
|
|
|
|
meta_window_actor_sync_actor_geometry (self, FALSE);
|
2011-06-13 17:53:23 -04:00
|
|
|
|
|
|
|
/* We do this now since we might be going right back into the
|
|
|
|
* frozen state */
|
2012-11-12 14:11:08 -05:00
|
|
|
meta_window_actor_handle_updates (self);
|
2011-06-13 17:53:23 -04:00
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
/* Since we ignore damage events while a window is frozen for certain effects
|
|
|
|
* we may need to issue an update_area() covering the whole pixmap if we
|
|
|
|
* don't know what real damage has happened. */
|
|
|
|
if (self->priv->needs_damage_all)
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_damage_all (self);
|
2013-02-14 13:40:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
|
|
|
|
gboolean no_delay_frame)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
FrameData *frame = g_slice_new0 (FrameData);
|
|
|
|
|
|
|
|
priv->needs_frame_drawn = TRUE;
|
|
|
|
|
|
|
|
frame->sync_request_serial = priv->window->sync_request_serial;
|
|
|
|
|
|
|
|
priv->frames = g_list_prepend (priv->frames, frame);
|
|
|
|
|
|
|
|
if (no_delay_frame)
|
|
|
|
{
|
|
|
|
ClutterActor *stage = clutter_actor_get_stage (CLUTTER_ACTOR (self));
|
|
|
|
clutter_stage_skip_sync_delay (CLUTTER_STAGE (stage));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!priv->repaint_scheduled)
|
2012-10-03 22:48:16 -04:00
|
|
|
{
|
2013-02-14 13:40:55 -05:00
|
|
|
/* A frame was marked by the client without actually doing any
|
|
|
|
* damage, or while we had the window frozen (e.g. during an
|
|
|
|
* interactive resize.) We need to make sure that the
|
|
|
|
* pre_paint/post_paint functions get called, enabling us to
|
|
|
|
* send a _NET_WM_FRAME_DRAWN. We do a 1-pixel redraw to get
|
|
|
|
* consistent timing with non-empty frames.
|
2012-10-03 22:48:16 -04:00
|
|
|
*/
|
2013-02-14 13:40:55 -05:00
|
|
|
if (priv->mapped && !priv->needs_pixmap)
|
2012-10-03 22:48:16 -04:00
|
|
|
{
|
|
|
|
const cairo_rectangle_int_t clip = { 0, 0, 1, 1 };
|
2013-02-14 13:40:55 -05:00
|
|
|
clutter_actor_queue_redraw_with_clip (priv->actor, &clip);
|
|
|
|
priv->repaint_scheduled = TRUE;
|
2012-10-03 22:48:16 -04:00
|
|
|
}
|
|
|
|
}
|
2010-03-02 13:02:28 -05:00
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
gboolean
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_effect_in_progress (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
return (self->priv->minimize_in_progress ||
|
|
|
|
self->priv->maximize_in_progress ||
|
|
|
|
self->priv->unmaximize_in_progress ||
|
|
|
|
self->priv->map_in_progress ||
|
2009-06-28 15:06:58 -04:00
|
|
|
self->priv->destroy_in_progress);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2013-02-15 15:53:04 -05:00
|
|
|
static gboolean
|
|
|
|
is_frozen (MetaWindowActor *self)
|
|
|
|
{
|
|
|
|
return self->priv->freeze_count ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_queue_create_pixmap (MetaWindowActor *self)
|
2009-06-28 12:26:23 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-28 12:26:23 -04:00
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
priv->needs_pixmap = TRUE;
|
2009-06-28 12:26:23 -04: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 17:10:40 -04:00
|
|
|
if (!priv->mapped)
|
2009-06-28 12:26:23 -04:00
|
|
|
return;
|
|
|
|
|
2013-02-15 15:53:04 -05:00
|
|
|
if (is_frozen (self))
|
|
|
|
return;
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
/* This will cause the compositor paint function to be run
|
|
|
|
* if the actor is visible or a clone of the actor is visible.
|
|
|
|
* if the actor isn't visible in any way, then we don't
|
|
|
|
* need to repair the window anyways, and can wait until
|
|
|
|
* the stage is redrawn for some other reason
|
|
|
|
*
|
|
|
|
* The compositor paint function repairs all windows.
|
|
|
|
*/
|
2009-07-22 16:11:56 -04:00
|
|
|
clutter_actor_queue_redraw (priv->actor);
|
2009-06-28 12:26:23 -04:00
|
|
|
}
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
static gboolean
|
|
|
|
is_freeze_thaw_effect (gulong event)
|
|
|
|
{
|
|
|
|
switch (event)
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
case META_PLUGIN_DESTROY:
|
|
|
|
case META_PLUGIN_MAXIMIZE:
|
|
|
|
case META_PLUGIN_UNMAXIMIZE:
|
2010-03-02 13:02:28 -05: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 17:10:40 -04:00
|
|
|
static gboolean
|
2010-10-18 13:27:14 -04:00
|
|
|
start_simple_effect (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 17:10:40 -04:00
|
|
|
gulong event)
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
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 17:10:40 -04:00
|
|
|
MetaCompScreen *info = meta_screen_get_compositor_data (priv->screen);
|
|
|
|
gint *counter = NULL;
|
2010-03-02 13:02:28 -05: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 17:10:40 -04:00
|
|
|
|
|
|
|
if (!info->plugin_mgr)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
switch (event)
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
case 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 17:10:40 -04:00
|
|
|
counter = &priv->minimize_in_progress;
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case 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 17:10:40 -04:00
|
|
|
counter = &priv->map_in_progress;
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case 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 17:10:40 -04:00
|
|
|
counter = &priv->destroy_in_progress;
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case META_PLUGIN_UNMAXIMIZE:
|
|
|
|
case META_PLUGIN_MAXIMIZE:
|
|
|
|
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 17:10:40 -04:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (counter);
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
use_freeze_thaw = is_freeze_thaw_effect (event);
|
|
|
|
|
|
|
|
if (use_freeze_thaw)
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_freeze (self);
|
2010-03-02 13:02:28 -05: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 17:10:40 -04:00
|
|
|
(*counter)++;
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
if (!meta_plugin_manager_event_simple (info->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 17:10:40 -04:00
|
|
|
{
|
|
|
|
(*counter)--;
|
2010-03-02 13:02:28 -05:00
|
|
|
if (use_freeze_thaw)
|
2010-10-18 13:27:14 -04: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 17:10:40 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-18 13:27:14 -04: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 17:10:40 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
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 17:10:40 -04:00
|
|
|
|
|
|
|
if (priv->needs_destroy)
|
|
|
|
{
|
|
|
|
clutter_actor_destroy (CLUTTER_ACTOR (self));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_sync_visibility (self);
|
2013-02-15 21:27:00 -05: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 17:10:40 -04:00
|
|
|
|
2009-08-14 06:18:28 -04:00
|
|
|
if (!meta_window_is_mapped (priv->window))
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_detach (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 17:10:40 -04:00
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
if (priv->needs_pixmap)
|
2009-07-22 16:11:56 -04:00
|
|
|
clutter_actor_queue_redraw (priv->actor);
|
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 17:10:40 -04:00
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_effect_completed (MetaWindowActor *self,
|
|
|
|
gulong event)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
/* NB: Keep in mind that when effects get completed it possible
|
|
|
|
* that the corresponding MetaWindow may have be been destroyed.
|
|
|
|
* In this case priv->window will == NULL */
|
|
|
|
|
|
|
|
switch (event)
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
case META_PLUGIN_MINIMIZE:
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
priv->minimize_in_progress--;
|
|
|
|
if (priv->minimize_in_progress < 0)
|
|
|
|
{
|
|
|
|
g_warning ("Error in minimize accounting.");
|
|
|
|
priv->minimize_in_progress = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case META_PLUGIN_MAP:
|
2009-06-26 15:33:20 -04:00
|
|
|
/*
|
|
|
|
* Make sure that the actor is at the correct place in case
|
|
|
|
* the plugin fscked.
|
|
|
|
*/
|
|
|
|
priv->map_in_progress--;
|
|
|
|
|
|
|
|
if (priv->map_in_progress < 0)
|
|
|
|
{
|
|
|
|
g_warning ("Error in map accounting.");
|
|
|
|
priv->map_in_progress = 0;
|
|
|
|
}
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case META_PLUGIN_DESTROY:
|
2009-06-26 15:33:20 -04:00
|
|
|
priv->destroy_in_progress--;
|
|
|
|
|
|
|
|
if (priv->destroy_in_progress < 0)
|
|
|
|
{
|
|
|
|
g_warning ("Error in destroy accounting.");
|
|
|
|
priv->destroy_in_progress = 0;
|
|
|
|
}
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case META_PLUGIN_UNMAXIMIZE:
|
2009-06-26 15:33:20 -04:00
|
|
|
priv->unmaximize_in_progress--;
|
|
|
|
if (priv->unmaximize_in_progress < 0)
|
|
|
|
{
|
|
|
|
g_warning ("Error in unmaximize accounting.");
|
|
|
|
priv->unmaximize_in_progress = 0;
|
|
|
|
}
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case META_PLUGIN_MAXIMIZE:
|
2009-06-26 15:33:20 -04:00
|
|
|
priv->maximize_in_progress--;
|
|
|
|
if (priv->maximize_in_progress < 0)
|
|
|
|
{
|
|
|
|
g_warning ("Error in maximize accounting.");
|
|
|
|
priv->maximize_in_progress = 0;
|
|
|
|
}
|
|
|
|
break;
|
2010-10-18 13:27:14 -04:00
|
|
|
case META_PLUGIN_SWITCH_WORKSPACE:
|
2009-06-26 15:33:20 -04:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
if (is_freeze_thaw_effect (event))
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_thaw (self);
|
2010-03-02 13:02:28 -05:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
if (!meta_window_actor_effect_in_progress (self))
|
|
|
|
meta_window_actor_after_effects (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
/* Called to drop our reference to a window backing pixmap that we
|
|
|
|
* previously obtained with XCompositeNameWindowPixmap. We do this
|
|
|
|
* when the window is unmapped or when we want to update to a new
|
|
|
|
* pixmap for a new size.
|
|
|
|
*/
|
2009-06-26 15:33:20 -04:00
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_detach (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-26 15:33:20 -04:00
|
|
|
MetaScreen *screen = priv->screen;
|
|
|
|
MetaDisplay *display = meta_screen_get_display (screen);
|
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
|
|
|
|
|
|
if (!priv->back_pixmap)
|
|
|
|
return;
|
|
|
|
|
2010-08-18 16:53:32 -04:00
|
|
|
/* Get rid of all references to the pixmap before freeing it; it's unclear whether
|
|
|
|
* you are supposed to be able to free a GLXPixmap after freeing the underlying
|
|
|
|
* pixmap, but it certainly doesn't work with current DRI/Mesa
|
|
|
|
*/
|
2011-10-04 17:35:11 -04:00
|
|
|
meta_shaped_texture_set_pixmap (META_SHAPED_TEXTURE (priv->actor),
|
|
|
|
None);
|
2010-08-18 16:53:32 -04:00
|
|
|
cogl_flush();
|
|
|
|
|
2010-08-17 18:38:40 -04:00
|
|
|
XFreePixmap (xdisplay, priv->back_pixmap);
|
2010-08-17 19:06:59 -04:00
|
|
|
priv->back_pixmap = 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 17:10:40 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_queue_create_pixmap (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2011-08-27 05:43:09 -04:00
|
|
|
gboolean
|
|
|
|
meta_window_actor_should_unredirect (MetaWindowActor *self)
|
|
|
|
{
|
|
|
|
MetaWindow *metaWindow = meta_window_actor_get_meta_window (self);
|
2011-10-17 19:52:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2013-02-02 13:50:01 -05:00
|
|
|
|
2012-08-30 02:40:18 -04:00
|
|
|
if (meta_window_requested_dont_bypass_compositor (metaWindow))
|
|
|
|
return FALSE;
|
|
|
|
|
2013-02-02 13:50:01 -05:00
|
|
|
if (priv->opacity != 0xff)
|
2012-06-07 23:27:08 -04:00
|
|
|
return FALSE;
|
|
|
|
|
2013-02-02 13:50:01 -05:00
|
|
|
if (metaWindow->has_shape)
|
2012-06-07 23:27:08 -04:00
|
|
|
return FALSE;
|
|
|
|
|
2012-08-30 02:40:18 -04:00
|
|
|
if (priv->argb32 && !meta_window_requested_bypass_compositor (metaWindow))
|
2012-06-07 23:27:08 -04:00
|
|
|
return FALSE;
|
|
|
|
|
2013-02-17 15:18:44 -05:00
|
|
|
if (!meta_window_is_monitor_sized (metaWindow))
|
2012-06-07 23:31:21 -04:00
|
|
|
return FALSE;
|
|
|
|
|
2013-02-02 13:50:01 -05:00
|
|
|
if (meta_window_requested_bypass_compositor (metaWindow))
|
2012-08-30 02:40:18 -04:00
|
|
|
return TRUE;
|
|
|
|
|
2013-02-02 13:50:01 -05:00
|
|
|
if (meta_window_is_override_redirect (metaWindow))
|
2012-06-07 23:27:08 -04:00
|
|
|
return TRUE;
|
|
|
|
|
2013-02-02 13:50:01 -05:00
|
|
|
if (priv->does_full_damage)
|
|
|
|
return TRUE;
|
2011-08-27 05:43:09 -04:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_actor_set_redirected (MetaWindowActor *self, gboolean state)
|
|
|
|
{
|
|
|
|
MetaWindow *metaWindow = meta_window_actor_get_meta_window (self);
|
2011-12-15 13:44:11 -05:00
|
|
|
MetaDisplay *display = meta_window_get_display (metaWindow);
|
2011-08-27 05:43:09 -04:00
|
|
|
|
2011-12-15 13:44:11 -05:00
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
2011-08-27 05:43:09 -04:00
|
|
|
Window xwin = meta_window_actor_get_x_window (self);
|
|
|
|
|
|
|
|
if (state)
|
|
|
|
{
|
2011-12-15 13:44:11 -05:00
|
|
|
meta_error_trap_push (display);
|
2011-08-27 05:43:09 -04:00
|
|
|
XCompositeRedirectWindow (xdisplay, xwin, CompositeRedirectManual);
|
2011-12-15 13:44:11 -05:00
|
|
|
meta_error_trap_pop (display);
|
2013-02-02 04:27:35 -05:00
|
|
|
meta_window_actor_detach (self);
|
2011-08-27 05:43:09 -04:00
|
|
|
self->priv->unredirected = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-15 13:44:11 -05:00
|
|
|
meta_error_trap_push (display);
|
2011-08-27 05:43:09 -04:00
|
|
|
XCompositeUnredirectWindow (xdisplay, xwin, CompositeRedirectManual);
|
2011-12-15 13:44:11 -05:00
|
|
|
meta_error_trap_pop (display);
|
2011-08-27 05:43:09 -04:00
|
|
|
self->priv->unredirected = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_destroy (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
MetaCompScreen *info;
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv;
|
2010-09-30 12:35:12 -04:00
|
|
|
MetaWindowType window_type;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
window = priv->window;
|
2010-09-30 12:35:12 -04:00
|
|
|
window_type = meta_window_get_window_type (window);
|
2009-06-26 15:33:20 -04:00
|
|
|
meta_window_set_compositor_private (window, NULL);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We remove the window from internal lookup hashes and thus any other
|
|
|
|
* unmap events etc fail
|
|
|
|
*/
|
|
|
|
info = meta_screen_get_compositor_data (priv->screen);
|
|
|
|
info->windows = g_list_remove (info->windows, (gconstpointer) self);
|
|
|
|
|
2010-09-30 12:35:12 -04: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 15:33:20 -04:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* No effects, just kill it.
|
|
|
|
*/
|
|
|
|
clutter_actor_destroy (CLUTTER_ACTOR (self));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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 17:10:40 -04:00
|
|
|
priv->needs_destroy = TRUE;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2010-10-18 13:27:14 -04: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 17:10:40 -04:00
|
|
|
clutter_actor_destroy (CLUTTER_ACTOR (self));
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-15 21:27:00 -05:00
|
|
|
meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
|
|
|
|
gboolean did_placement)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-26 15:33:20 -04:00
|
|
|
MetaRectangle window_rect;
|
|
|
|
|
2013-02-15 21:27:00 -05: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;
|
|
|
|
|
2011-07-19 18:06:18 -04:00
|
|
|
meta_window_get_input_rect (priv->window, &window_rect);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2011-07-19 18:05:30 -04:00
|
|
|
if (priv->last_width != window_rect.width ||
|
|
|
|
priv->last_height != window_rect.height)
|
2009-06-28 12:26:23 -04:00
|
|
|
{
|
|
|
|
priv->size_changed = TRUE;
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_queue_create_pixmap (self);
|
2013-01-14 21:52:20 -05:00
|
|
|
meta_window_actor_update_shape (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2011-07-19 18:05:30 -04:00
|
|
|
priv->last_width = window_rect.width;
|
|
|
|
priv->last_height = window_rect.height;
|
|
|
|
}
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
if (meta_window_actor_effect_in_progress (self))
|
2009-06-26 15:33:20 -04:00
|
|
|
return;
|
|
|
|
|
|
|
|
clutter_actor_set_position (CLUTTER_ACTOR (self),
|
2009-06-28 12:26:23 -04:00
|
|
|
window_rect.x, window_rect.y);
|
|
|
|
clutter_actor_set_size (CLUTTER_ACTOR (self),
|
|
|
|
window_rect.width, window_rect.height);
|
2011-02-01 11:24:39 -05:00
|
|
|
|
|
|
|
g_signal_emit (self, signals[POSITION_CHANGED], 0);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_show (MetaWindowActor *self,
|
|
|
|
MetaCompEffect effect)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv;
|
|
|
|
MetaCompScreen *info;
|
|
|
|
gulong event;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
info = meta_screen_get_compositor_data (priv->screen);
|
|
|
|
|
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 17:10:40 -04:00
|
|
|
g_return_if_fail (!priv->visible);
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
self->priv->visible = TRUE;
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
event = 0;
|
|
|
|
switch (effect)
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
case META_COMP_EFFECT_CREATE:
|
2010-10-18 13:27:14 -04: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 17:10:40 -04:00
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_UNMINIMIZE:
|
2010-10-18 13:27:14 -04:00
|
|
|
/* FIXME: should have META_PLUGIN_UNMINIMIZE */
|
|
|
|
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 17:10:40 -04:00
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_NONE:
|
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_DESTROY:
|
|
|
|
case META_COMP_EFFECT_MINIMIZE:
|
|
|
|
g_assert_not_reached();
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->redecorating ||
|
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 17:10:40 -04:00
|
|
|
info->switch_workspace_in_progress ||
|
|
|
|
event == 0 ||
|
|
|
|
!start_simple_effect (self, event))
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2012-01-17 09:16:46 -05:00
|
|
|
clutter_actor_show (CLUTTER_ACTOR (self));
|
2009-06-26 15:33:20 -04:00
|
|
|
priv->redecorating = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_hide (MetaWindowActor *self,
|
|
|
|
MetaCompEffect effect)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv;
|
|
|
|
MetaCompScreen *info;
|
|
|
|
gulong event;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
info = meta_screen_get_compositor_data (priv->screen);
|
|
|
|
|
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 17:10:40 -04:00
|
|
|
g_return_if_fail (priv->visible);
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
priv->visible = FALSE;
|
2009-06-26 15:33:20 -04: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 17:10:40 -04: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 15:33:20 -04: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 17:10:40 -04:00
|
|
|
if (info->switch_workspace_in_progress)
|
|
|
|
return;
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
event = 0;
|
|
|
|
switch (effect)
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
case META_COMP_EFFECT_DESTROY:
|
2010-10-18 13:27:14 -04: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 17:10:40 -04:00
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_MINIMIZE:
|
2010-10-18 13:27:14 -04: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 17:10:40 -04:00
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_NONE:
|
|
|
|
break;
|
|
|
|
case META_COMP_EFFECT_UNMINIMIZE:
|
|
|
|
case META_COMP_EFFECT_CREATE:
|
|
|
|
g_assert_not_reached();
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
|
|
|
|
if (event == 0 ||
|
|
|
|
!start_simple_effect (self, event))
|
|
|
|
clutter_actor_hide (CLUTTER_ACTOR (self));
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_maximize (MetaWindowActor *self,
|
|
|
|
MetaRectangle *old_rect,
|
|
|
|
MetaRectangle *new_rect)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
MetaCompScreen *info = meta_screen_get_compositor_data (self->priv->screen);
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
/* The window has already been resized (in order to compute new_rect),
|
|
|
|
* which by side effect caused the actor to be resized. Restore it to the
|
|
|
|
* old size and position */
|
|
|
|
clutter_actor_set_position (CLUTTER_ACTOR (self), old_rect->x, old_rect->y);
|
|
|
|
clutter_actor_set_size (CLUTTER_ACTOR (self), old_rect->width, old_rect->height);
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
self->priv->maximize_in_progress++;
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_freeze (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
if (!info->plugin_mgr ||
|
2010-10-18 13:27:14 -04:00
|
|
|
!meta_plugin_manager_event_maximize (info->plugin_mgr,
|
|
|
|
self,
|
|
|
|
META_PLUGIN_MAXIMIZE,
|
|
|
|
new_rect->x, new_rect->y,
|
|
|
|
new_rect->width, new_rect->height))
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
{
|
|
|
|
self->priv->maximize_in_progress--;
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_thaw (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_unmaximize (MetaWindowActor *self,
|
|
|
|
MetaRectangle *old_rect,
|
|
|
|
MetaRectangle *new_rect)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
MetaCompScreen *info = meta_screen_get_compositor_data (self->priv->screen);
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
/* The window has already been resized (in order to compute new_rect),
|
|
|
|
* which by side effect caused the actor to be resized. Restore it to the
|
|
|
|
* old size and position */
|
|
|
|
clutter_actor_set_position (CLUTTER_ACTOR (self), old_rect->x, old_rect->y);
|
|
|
|
clutter_actor_set_size (CLUTTER_ACTOR (self), old_rect->width, old_rect->height);
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
self->priv->unmaximize_in_progress++;
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_freeze (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
if (!info->plugin_mgr ||
|
2010-10-18 13:27:14 -04:00
|
|
|
!meta_plugin_manager_event_maximize (info->plugin_mgr,
|
|
|
|
self,
|
|
|
|
META_PLUGIN_UNMAXIMIZE,
|
|
|
|
new_rect->x, new_rect->y,
|
|
|
|
new_rect->width, new_rect->height))
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
self->priv->unmaximize_in_progress--;
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_thaw (self);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActor *
|
|
|
|
meta_window_actor_new (MetaWindow *window)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaScreen *screen = meta_window_get_screen (window);
|
|
|
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
|
|
|
MetaWindowActor *self;
|
|
|
|
MetaWindowActorPrivate *priv;
|
|
|
|
MetaFrame *frame;
|
|
|
|
Window top_window;
|
2012-12-27 08:04:12 -05:00
|
|
|
ClutterActor *window_group;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
frame = meta_window_get_frame (window);
|
|
|
|
if (frame)
|
|
|
|
top_window = meta_frame_get_xwindow (frame);
|
|
|
|
else
|
|
|
|
top_window = meta_window_get_xwindow (window);
|
|
|
|
|
|
|
|
meta_verbose ("add window: Meta %p, xwin 0x%x\n", window, (guint)top_window);
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
self = g_object_new (META_TYPE_WINDOW_ACTOR,
|
|
|
|
"meta-window", window,
|
|
|
|
"x-window", top_window,
|
|
|
|
"meta-screen", screen,
|
|
|
|
NULL);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
2011-07-19 18:05:30 -04:00
|
|
|
priv->last_width = -1;
|
|
|
|
priv->last_height = -1;
|
|
|
|
|
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 17:10:40 -04:00
|
|
|
priv->mapped = meta_window_toplevel_is_mapped (priv->window);
|
2010-03-19 15:09:06 -04:00
|
|
|
if (priv->mapped)
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_queue_create_pixmap (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 17:10:40 -04:00
|
|
|
|
2011-06-13 17:53:23 -04:00
|
|
|
meta_window_actor_set_updates_frozen (self,
|
|
|
|
meta_window_updates_are_frozen (priv->window));
|
|
|
|
|
2013-02-28 16:12:50 -05:00
|
|
|
/* If a window doesn't start off with updates frozen, we should
|
|
|
|
* we should send a _NET_WM_FRAME_DRAWN immediately after the first drawn.
|
|
|
|
*/
|
|
|
|
if (priv->window->extended_sync_request_counter && !priv->updates_frozen)
|
|
|
|
meta_window_actor_queue_frame_drawn (self, FALSE);
|
|
|
|
|
2013-02-15 21:27:00 -05:00
|
|
|
meta_window_actor_sync_actor_geometry (self, priv->window->placed);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
/* Hang our compositor window state off the MetaWindow for fast retrieval */
|
|
|
|
meta_window_set_compositor_private (window, G_OBJECT (self));
|
|
|
|
|
2012-12-27 08:04:12 -05:00
|
|
|
if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
|
|
|
|
window_group = info->top_window_group;
|
|
|
|
else
|
|
|
|
window_group = info->window_group;
|
|
|
|
|
2012-01-17 09:16:46 -05:00
|
|
|
clutter_actor_add_child (window_group, CLUTTER_ACTOR (self));
|
2012-12-27 08:04:12 -05:00
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
clutter_actor_hide (CLUTTER_ACTOR (self));
|
|
|
|
|
2013-02-15 02:19:19 -05:00
|
|
|
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
|
|
|
|
|
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 17:10:40 -04:00
|
|
|
/* Initial position in the stack is arbitrary; stacking will be synced
|
|
|
|
* before we first paint.
|
2009-06-26 15:33:20 -04:00
|
|
|
*/
|
|
|
|
info->windows = g_list_append (info->windows, self);
|
|
|
|
|
|
|
|
return 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 17:10:40 -04:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_mapped (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 17:10:40 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
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 17:10:40 -04:00
|
|
|
|
|
|
|
g_return_if_fail (!priv->mapped);
|
|
|
|
|
|
|
|
priv->mapped = TRUE;
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_queue_create_pixmap (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 17:10:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_unmapped (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 17:10:40 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
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 17:10:40 -04:00
|
|
|
|
|
|
|
g_return_if_fail (priv->mapped);
|
|
|
|
|
|
|
|
priv->mapped = FALSE;
|
|
|
|
|
2010-10-18 13:27:14 -04: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 17:10:40 -04:00
|
|
|
return;
|
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_detach (self);
|
2010-03-02 13:02:28 -05:00
|
|
|
priv->needs_pixmap = 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 17:10:40 -04:00
|
|
|
}
|
|
|
|
|
2009-06-29 14:30:26 -04:00
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* meta_window_actor_get_obscured_region:
|
|
|
|
* @self: a #MetaWindowActor
|
2009-06-29 14:30:26 -04:00
|
|
|
*
|
|
|
|
* Gets the region that is completely obscured by the window. Coordinates
|
|
|
|
* are relative to the upper-left of the window.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): the area obscured by the window,
|
|
|
|
* %NULL is the same as an empty region.
|
|
|
|
*/
|
2010-10-18 11:32:50 -04:00
|
|
|
cairo_region_t *
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_get_obscured_region (MetaWindowActor *self)
|
2009-06-29 14:30:26 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-29 14:30:26 -04:00
|
|
|
|
2013-05-15 04:49:08 -04:00
|
|
|
if (priv->back_pixmap && priv->opacity == 0xff && !priv->window->shaded)
|
2013-01-14 20:45:31 -05:00
|
|
|
return priv->opaque_region;
|
2009-06-29 14:30:26 -04:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* Print out a region; useful for debugging */
|
|
|
|
static void
|
2012-04-29 04:44:53 -04:00
|
|
|
print_region (cairo_region_t *region)
|
2009-06-29 14:30:26 -04:00
|
|
|
{
|
|
|
|
int n_rects;
|
|
|
|
int i;
|
|
|
|
|
2010-10-18 11:32:50 -04:00
|
|
|
n_rects = cairo_region_num_rectangles (region);
|
2009-06-29 14:30:26 -04:00
|
|
|
g_print ("[");
|
|
|
|
for (i = 0; i < n_rects; i++)
|
|
|
|
{
|
2010-10-18 11:32:50 -04:00
|
|
|
cairo_rectangle_int_t rect;
|
2011-07-18 16:41:31 -04:00
|
|
|
cairo_region_get_rectangle (region, i, &rect);
|
2009-06-29 14:30:26 -04:00
|
|
|
g_print ("+%d+%dx%dx%d ",
|
2010-10-18 11:32:50 -04:00
|
|
|
rect.x, rect.y, rect.width, rect.height);
|
2009-06-29 14:30:26 -04:00
|
|
|
}
|
|
|
|
g_print ("]\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-04-29 04:44:53 -04: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 14:30:26 -04:00
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* meta_window_actor_set_visible_region:
|
|
|
|
* @self: a #MetaWindowActor
|
2009-06-29 14:30:26 -04:00
|
|
|
* @visible_region: the region of the screen that isn't completely
|
|
|
|
* obscured.
|
|
|
|
*
|
|
|
|
* Provides a hint as to what areas of the window need to be
|
|
|
|
* drawn. Regions not in @visible_region are completely obscured.
|
|
|
|
* This will be set before painting then unset afterwards.
|
|
|
|
*/
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_set_visible_region (MetaWindowActor *self,
|
|
|
|
cairo_region_t *visible_region)
|
2009-06-29 14:30:26 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-29 14:30:26 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_shaped_texture_set_clip_region (META_SHAPED_TEXTURE (priv->actor),
|
2011-08-29 12:38:17 -04:00
|
|
|
visible_region);
|
2009-06-29 14:30:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* meta_window_actor_set_visible_region_beneath:
|
|
|
|
* @self: a #MetaWindowActor
|
2009-06-29 14:30:26 -04:00
|
|
|
* @visible_region: the region of the screen that isn't completely
|
|
|
|
* obscured beneath the main window texture.
|
|
|
|
*
|
|
|
|
* Provides a hint as to what areas need to be drawn *beneath*
|
|
|
|
* the main window texture. This is the relevant visible region
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_set_visible_region_beneath (MetaWindowActor *self,
|
|
|
|
cairo_region_t *beneath_region)
|
2009-06-29 14:30:26 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2010-11-11 17:18:02 -05:00
|
|
|
gboolean appears_focused = meta_window_appears_focused (priv->window);
|
2009-06-29 14:30:26 -04:00
|
|
|
|
2010-11-11 17:18:02 -05:00
|
|
|
if (appears_focused ? priv->focused_shadow : priv->unfocused_shadow)
|
2009-06-29 14:30:26 -04:00
|
|
|
{
|
2013-01-14 21:40:46 -05:00
|
|
|
g_clear_pointer (&priv->shadow_clip, cairo_region_destroy);
|
2010-11-11 18:23:25 -05:00
|
|
|
priv->shadow_clip = cairo_region_copy (beneath_region);
|
2011-03-22 15:36:12 -04:00
|
|
|
|
|
|
|
if (clip_shadow_under_window (self))
|
|
|
|
{
|
|
|
|
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (priv->window);
|
|
|
|
cairo_region_subtract (priv->shadow_clip, frame_bounds);
|
|
|
|
}
|
2009-06-29 14:30:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-10-18 13:27:14 -04:00
|
|
|
* meta_window_actor_reset_visible_regions:
|
|
|
|
* @self: a #MetaWindowActor
|
2009-06-29 14:30:26 -04:00
|
|
|
*
|
2010-10-18 13:27:14 -04:00
|
|
|
* Unsets the regions set by meta_window_actor_reset_visible_region() and
|
2011-10-17 22:10:00 -04:00
|
|
|
* meta_window_actor_reset_visible_region_beneath()
|
2009-06-29 14:30:26 -04:00
|
|
|
*/
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_reset_visible_regions (MetaWindowActor *self)
|
2009-06-29 14:30:26 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-29 14:30:26 -04:00
|
|
|
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_shaped_texture_set_clip_region (META_SHAPED_TEXTURE (priv->actor),
|
|
|
|
NULL);
|
2013-01-14 21:40:46 -05:00
|
|
|
g_clear_pointer (&priv->shadow_clip, cairo_region_destroy);
|
2009-06-29 14:30:26 -04:00
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
check_needs_pixmap (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-26 15:33:20 -04:00
|
|
|
MetaScreen *screen = priv->screen;
|
|
|
|
MetaDisplay *display = meta_screen_get_display (screen);
|
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
|
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
|
|
|
MetaCompositor *compositor;
|
|
|
|
Window xwindow = priv->xwindow;
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
if (!priv->needs_pixmap)
|
2009-06-28 12:26:23 -04:00
|
|
|
return;
|
|
|
|
|
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 17:10:40 -04:00
|
|
|
if (!priv->mapped)
|
2009-06-28 12:26:23 -04:00
|
|
|
return;
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
if (xwindow == meta_screen_get_xroot (screen) ||
|
|
|
|
xwindow == clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
compositor = meta_display_get_compositor (display);
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
if (priv->size_changed)
|
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_detach (self);
|
2009-06-28 12:26:23 -04:00
|
|
|
priv->size_changed = FALSE;
|
|
|
|
}
|
|
|
|
|
2011-09-13 13:41:43 -04:00
|
|
|
meta_error_trap_push (display);
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
if (priv->back_pixmap == None)
|
|
|
|
{
|
2013-02-19 19:34:47 -05:00
|
|
|
CoglTexture *texture;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
|
|
|
|
priv->back_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
|
|
|
|
|
2010-10-25 14:44:30 -04:00
|
|
|
if (meta_error_trap_pop_with_return (display) != Success)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
|
|
|
/* Probably a BadMatch if the window isn't viewable; we could
|
|
|
|
* GrabServer/GetWindowAttributes/NameWindowPixmap/UngrabServer/Sync
|
|
|
|
* to avoid this, but there's no reason to take two round trips
|
|
|
|
* when one will do. (We need that Sync if we want to handle failures
|
|
|
|
* for any reason other than !viewable. That's unlikely, but maybe
|
|
|
|
* we'll BadAlloc or something.)
|
|
|
|
*/
|
|
|
|
priv->back_pixmap = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->back_pixmap == None)
|
|
|
|
{
|
|
|
|
meta_verbose ("Unable to get named pixmap for %p\n", self);
|
2011-09-12 22:52:26 -04:00
|
|
|
goto out;
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2010-08-17 17:33:41 -04:00
|
|
|
if (compositor->no_mipmaps)
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_shaped_texture_set_create_mipmaps (META_SHAPED_TEXTURE (priv->actor),
|
|
|
|
FALSE);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2011-10-04 17:35:11 -04:00
|
|
|
meta_shaped_texture_set_pixmap (META_SHAPED_TEXTURE (priv->actor),
|
|
|
|
priv->back_pixmap);
|
|
|
|
|
|
|
|
texture = meta_shaped_texture_get_texture (META_SHAPED_TEXTURE (priv->actor));
|
|
|
|
|
2010-07-30 10:16:55 -04:00
|
|
|
/*
|
|
|
|
* This only works *after* actually setting the pixmap, so we have to
|
|
|
|
* do it here.
|
|
|
|
* See: http://bugzilla.clutter-project.org/show_bug.cgi?id=2236
|
|
|
|
*/
|
2013-02-19 19:34:47 -05:00
|
|
|
if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
|
2010-07-30 10:16:55 -04:00
|
|
|
g_warning ("NOTE: Not using GLX TFP!\n");
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2013-01-14 21:52:20 -05:00
|
|
|
/* ::size-changed is supposed to refer to meta_window_get_outer_rect().
|
|
|
|
* Emitting it here works pretty much OK because a new value of the
|
|
|
|
* *input* rect (which is the outer rect with the addition of invisible
|
|
|
|
* borders) forces a new pixmap and we get here. In the rare case where
|
|
|
|
* a change to the window size was exactly balanced by a change to the
|
|
|
|
* invisible borders, we would miss emitting the signal. We would also
|
|
|
|
* emit spurious signals when we get a new pixmap without a new size,
|
|
|
|
* but that should be mostly harmless.
|
|
|
|
*/
|
|
|
|
g_signal_emit (self, signals[SIZE_CHANGED], 0);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
priv->needs_pixmap = FALSE;
|
2011-09-12 22:52:26 -04:00
|
|
|
|
|
|
|
out:
|
|
|
|
meta_error_trap_pop (display);
|
2010-03-02 13:02:28 -05:00
|
|
|
}
|
|
|
|
|
2010-10-18 15:34:08 -04:00
|
|
|
static void
|
|
|
|
check_needs_shadow (MetaWindowActor *self)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
MetaShadow *old_shadow = NULL;
|
2010-11-11 16:24:43 -05:00
|
|
|
MetaShadow **shadow_location;
|
|
|
|
gboolean recompute_shadow;
|
2010-10-18 15:34:08 -04:00
|
|
|
gboolean should_have_shadow;
|
2010-11-11 16:24:43 -05:00
|
|
|
gboolean appears_focused;
|
2010-10-18 15:34:08 -04:00
|
|
|
|
|
|
|
if (!priv->mapped)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
* the shadow with priv->recompute_shadow.
|
|
|
|
*/
|
|
|
|
|
|
|
|
should_have_shadow = meta_window_actor_has_shadow (self);
|
2010-11-11 16:24:43 -05:00
|
|
|
appears_focused = meta_window_appears_focused (priv->window);
|
|
|
|
|
|
|
|
if (appears_focused)
|
|
|
|
{
|
|
|
|
recompute_shadow = priv->recompute_focused_shadow;
|
|
|
|
priv->recompute_focused_shadow = FALSE;
|
|
|
|
shadow_location = &priv->focused_shadow;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
recompute_shadow = priv->recompute_unfocused_shadow;
|
|
|
|
priv->recompute_unfocused_shadow = FALSE;
|
|
|
|
shadow_location = &priv->unfocused_shadow;
|
|
|
|
}
|
2010-10-18 15:34:08 -04:00
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
if (!should_have_shadow || recompute_shadow)
|
2010-10-18 15:34:08 -04:00
|
|
|
{
|
2010-11-11 16:24:43 -05:00
|
|
|
if (*shadow_location != NULL)
|
|
|
|
{
|
|
|
|
old_shadow = *shadow_location;
|
|
|
|
*shadow_location = NULL;
|
|
|
|
}
|
2010-10-18 15:34:08 -04:00
|
|
|
}
|
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
if (*shadow_location == NULL && should_have_shadow)
|
2010-10-18 15:34:08 -04:00
|
|
|
{
|
|
|
|
if (priv->shadow_shape == NULL)
|
2013-01-14 21:47:46 -05:00
|
|
|
priv->shadow_shape = meta_window_shape_new (priv->shape_region);
|
2013-01-14 21:47:46 -05:00
|
|
|
|
2013-01-14 21:47:46 -05: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,
|
|
|
|
priv->shadow_shape,
|
|
|
|
shape_bounds.width, shape_bounds.height,
|
|
|
|
shadow_class, appears_focused);
|
2010-10-18 15:34:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (old_shadow != NULL)
|
|
|
|
meta_shadow_unref (old_shadow);
|
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_process_damage (MetaWindowActor *self,
|
|
|
|
XDamageNotifyEvent *event)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2013-02-02 13:50:01 -05:00
|
|
|
MetaCompScreen *info = meta_screen_get_compositor_data (priv->screen);
|
2010-03-02 13:02:28 -05:00
|
|
|
|
2010-05-13 16:43:30 -04:00
|
|
|
priv->received_damage = TRUE;
|
|
|
|
|
2013-02-02 13:50:01 -05:00
|
|
|
if (meta_window_is_fullscreen (priv->window) && g_list_last (info->windows)->data == self && !priv->unredirected)
|
|
|
|
{
|
|
|
|
MetaRectangle window_rect;
|
|
|
|
meta_window_get_outer_rect (priv->window, &window_rect);
|
|
|
|
|
|
|
|
if (window_rect.x == event->area.x &&
|
|
|
|
window_rect.y == event->area.y &&
|
|
|
|
window_rect.width == event->area.width &&
|
|
|
|
window_rect.height == event->area.height)
|
|
|
|
priv->full_damage_frames_count++;
|
|
|
|
else
|
|
|
|
priv->full_damage_frames_count = 0;
|
|
|
|
|
|
|
|
if (priv->full_damage_frames_count >= 100)
|
|
|
|
priv->does_full_damage = TRUE;
|
|
|
|
}
|
|
|
|
|
2011-08-27 05:43:09 -04:00
|
|
|
/* Drop damage event for unredirected windows */
|
2013-02-02 13:50:01 -05:00
|
|
|
if (priv->unredirected)
|
2011-08-27 05:43:09 -04:00
|
|
|
return;
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
if (is_frozen (self))
|
|
|
|
{
|
|
|
|
/* The window is frozen due to an effect in progress: we ignore damage
|
|
|
|
* here on the off chance that this will stop the corresponding
|
|
|
|
* texture_from_pixmap from being update.
|
|
|
|
*
|
|
|
|
* needs_damage_all tracks that some unknown damage happened while the
|
|
|
|
* window was frozen so that when the window becomes unfrozen we can
|
|
|
|
* issue a full window update to cover any lost damage.
|
|
|
|
*
|
|
|
|
* It should be noted that this is an unreliable mechanism since it's
|
|
|
|
* quite likely that drivers will aim to provide a zero-copy
|
|
|
|
* implementation of the texture_from_pixmap extension and in those cases
|
|
|
|
* any drawing done to the window is always immediately reflected in the
|
|
|
|
* texture regardless of damage event handling.
|
|
|
|
*/
|
|
|
|
priv->needs_damage_all = TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-11-09 15:12:06 -05:00
|
|
|
if (!priv->mapped || priv->needs_pixmap)
|
|
|
|
return;
|
2010-03-02 13:02:28 -05:00
|
|
|
|
2011-10-04 17:35:11 -04:00
|
|
|
meta_shaped_texture_update_area (META_SHAPED_TEXTURE (priv->actor),
|
|
|
|
event->area.x,
|
|
|
|
event->area.y,
|
|
|
|
event->area.width,
|
|
|
|
event->area.height);
|
2013-02-14 13:40:55 -05:00
|
|
|
priv->repaint_scheduled = TRUE;
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_sync_visibility (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self) != priv->visible)
|
2009-06-26 15:33:20 -04: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 17:10:40 -04:00
|
|
|
if (priv->visible)
|
|
|
|
clutter_actor_show (CLUTTER_ACTOR (self));
|
|
|
|
else
|
|
|
|
clutter_actor_hide (CLUTTER_ACTOR (self));
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-29 07:10:15 -04:00
|
|
|
static cairo_region_t *
|
2012-04-27 00:15:30 -04:00
|
|
|
scan_visible_region (guchar *mask_data,
|
|
|
|
int stride,
|
2012-04-29 07:10:15 -04:00
|
|
|
cairo_region_t *scan_area)
|
2012-04-27 00:15:30 -04:00
|
|
|
{
|
2012-04-29 07:10:15 -04:00
|
|
|
int i, n_rects = cairo_region_num_rectangles (scan_area);
|
|
|
|
MetaRegionBuilder builder;
|
|
|
|
|
|
|
|
meta_region_builder_init (&builder);
|
2012-04-27 00:15:30 -04: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 10:14:40 -05:00
|
|
|
int x2 = x;
|
|
|
|
while (mask_data[y * stride + x2] == 255 && x2 < (rect.x + rect.width))
|
|
|
|
x2++;
|
2012-04-27 00:15:30 -04:00
|
|
|
|
2013-01-16 10:16:58 -05:00
|
|
|
if (x2 > x)
|
2012-04-27 00:15:30 -04:00
|
|
|
{
|
2013-01-16 10:14:40 -05:00
|
|
|
meta_region_builder_add_rectangle (&builder, x, y, x2 - x, 1);
|
|
|
|
x = x2;
|
2012-04-27 00:15:30 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-04-29 07:10:15 -04:00
|
|
|
|
|
|
|
return meta_region_builder_finish (&builder);
|
2012-04-27 00:15:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
build_and_scan_frame_mask (MetaWindowActor *self,
|
|
|
|
cairo_rectangle_int_t *client_area,
|
|
|
|
cairo_region_t *shape_region)
|
2012-04-27 00:14:42 -04:00
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
guchar *mask_data;
|
|
|
|
guint tex_width, tex_height;
|
2013-02-19 19:34:47 -05:00
|
|
|
CoglTexture *paint_tex, *mask_texture;
|
2012-04-27 00:14:42 -04:00
|
|
|
int stride;
|
2012-05-14 14:35:16 -04:00
|
|
|
cairo_t *cr;
|
|
|
|
cairo_surface_t *surface;
|
2012-04-27 00:14:42 -04:00
|
|
|
|
|
|
|
paint_tex = meta_shaped_texture_get_texture (META_SHAPED_TEXTURE (priv->actor));
|
2013-02-19 19:34:47 -05:00
|
|
|
if (paint_tex == NULL)
|
2012-04-27 00:14:42 -04: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 14:35:16 -04: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 00:14:42 -04:00
|
|
|
|
2012-05-14 14:35:16 -04:00
|
|
|
gdk_cairo_region (cr, shape_region);
|
|
|
|
cairo_fill (cr);
|
|
|
|
|
2012-04-27 00:15:30 -04:00
|
|
|
if (priv->window->frame != NULL)
|
|
|
|
{
|
2012-04-29 07:10:15 -04:00
|
|
|
cairo_region_t *frame_paint_region, *scanned_region;
|
2012-04-27 00:15:30 -04: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);
|
|
|
|
|
2013-04-12 13:00:15 -04:00
|
|
|
meta_frame_get_mask (priv->window->frame, cr);
|
2012-04-27 00:15:30 -04:00
|
|
|
|
|
|
|
cairo_surface_flush (surface);
|
2012-04-29 07:10:15 -04: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 03:31:38 -04:00
|
|
|
cairo_region_destroy (frame_paint_region);
|
2012-04-27 00:15:30 -04:00
|
|
|
}
|
|
|
|
|
2012-05-14 14:35:16 -04:00
|
|
|
cairo_destroy (cr);
|
|
|
|
cairo_surface_destroy (surface);
|
2012-04-27 00:14:42 -04:00
|
|
|
|
|
|
|
if (meta_texture_rectangle_check (paint_tex))
|
|
|
|
{
|
|
|
|
mask_texture = meta_texture_rectangle_new (tex_width, tex_height,
|
|
|
|
COGL_PIXEL_FORMAT_A_8,
|
|
|
|
COGL_PIXEL_FORMAT_A_8,
|
|
|
|
stride,
|
|
|
|
mask_data,
|
|
|
|
NULL /* error */);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Note: we don't allow slicing for this texture because we
|
|
|
|
* need to use it with multi-texturing which doesn't support
|
|
|
|
* sliced textures */
|
|
|
|
mask_texture = cogl_texture_new_from_data (tex_width, tex_height,
|
|
|
|
COGL_TEXTURE_NO_SLICING,
|
|
|
|
COGL_PIXEL_FORMAT_A_8,
|
|
|
|
COGL_PIXEL_FORMAT_ANY,
|
|
|
|
stride,
|
|
|
|
mask_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_shaped_texture_set_mask_texture (META_SHAPED_TEXTURE (priv->actor),
|
|
|
|
mask_texture);
|
2013-02-19 19:34:47 -05:00
|
|
|
cogl_object_unref (mask_texture);
|
2012-04-27 00:14:42 -04:00
|
|
|
|
|
|
|
g_free (mask_data);
|
|
|
|
}
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
static void
|
2010-10-18 13:27:14 -04:00
|
|
|
check_needs_reshape (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2010-09-27 14:10:35 -04:00
|
|
|
MetaScreen *screen = priv->screen;
|
|
|
|
MetaDisplay *display = meta_screen_get_display (screen);
|
2011-08-10 10:32:47 -04:00
|
|
|
MetaFrameBorders borders;
|
2012-06-13 13:51:08 -04:00
|
|
|
cairo_region_t *region = NULL;
|
2012-04-27 00:15:30 -04:00
|
|
|
cairo_rectangle_int_t client_area;
|
2012-08-12 17:02:06 -04:00
|
|
|
gboolean needs_mask;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2013-02-06 12:04:09 -05:00
|
|
|
if (!priv->mapped)
|
|
|
|
return;
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
if (!priv->needs_reshape)
|
|
|
|
return;
|
2009-06-26 15:33:20 -04:00
|
|
|
|
2013-02-15 15:53:04 -05:00
|
|
|
if (priv->shadow_shape != NULL)
|
|
|
|
{
|
|
|
|
meta_window_shape_unref (priv->shadow_shape);
|
|
|
|
priv->shadow_shape = NULL;
|
|
|
|
}
|
|
|
|
|
2012-03-12 23:11:07 -04:00
|
|
|
meta_frame_calc_borders (priv->window->frame, &borders);
|
2011-08-10 10:32:47 -04:00
|
|
|
|
2012-04-27 00:15:30 -04:00
|
|
|
client_area.x = borders.total.left;
|
|
|
|
client_area.y = borders.total.top;
|
|
|
|
client_area.width = priv->window->rect.width;
|
2013-05-15 04:49:08 -04:00
|
|
|
if (priv->window->shaded)
|
|
|
|
client_area.height = 0;
|
|
|
|
else
|
|
|
|
client_area.height = priv->window->rect.height;
|
2012-04-27 00:15:30 -04:00
|
|
|
|
2013-02-19 19:34:47 -05:00
|
|
|
meta_shaped_texture_set_mask_texture (META_SHAPED_TEXTURE (priv->actor), NULL);
|
2013-01-14 21:40:46 -05:00
|
|
|
g_clear_pointer (&priv->shape_region, cairo_region_destroy);
|
2013-03-04 10:00:14 -05:00
|
|
|
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
#ifdef HAVE_SHAPE
|
2011-07-20 00:29:06 -04:00
|
|
|
if (priv->window->has_shape)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2012-04-27 00:15:30 -04:00
|
|
|
/* Translate the set of XShape rectangles that we
|
|
|
|
* get from the X server to a cairo_region. */
|
2010-09-27 14:10:35 -04:00
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
2009-06-26 15:33:20 -04:00
|
|
|
XRectangle *rects;
|
|
|
|
int n_rects, ordering;
|
|
|
|
|
2010-09-27 14:10:35 -04:00
|
|
|
meta_error_trap_push (display);
|
2009-06-26 15:33:20 -04:00
|
|
|
rects = XShapeGetRectangles (xdisplay,
|
2011-07-20 00:29:06 -04:00
|
|
|
priv->window->xwindow,
|
2009-06-26 15:33:20 -04:00
|
|
|
ShapeBounding,
|
|
|
|
&n_rects,
|
|
|
|
&ordering);
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2009-06-26 15:33:20 -04:00
|
|
|
|
|
|
|
if (rects)
|
|
|
|
{
|
2011-07-08 15:06:13 -04:00
|
|
|
int i;
|
2012-06-13 13:51:08 -04:00
|
|
|
cairo_rectangle_int_t *cairo_rects = g_new (cairo_rectangle_int_t, n_rects);
|
|
|
|
|
2011-07-08 15:06:13 -04:00
|
|
|
for (i = 0; i < n_rects; i ++)
|
|
|
|
{
|
2012-04-27 00:15:30 -04:00
|
|
|
cairo_rects[i].x = rects[i].x + client_area.x;
|
|
|
|
cairo_rects[i].y = rects[i].y + client_area.y;
|
|
|
|
cairo_rects[i].width = rects[i].width;
|
|
|
|
cairo_rects[i].height = rects[i].height;
|
2011-07-08 15:06:13 -04:00
|
|
|
}
|
2012-06-13 13:51:08 -04:00
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
XFree (rects);
|
2012-06-13 13:51:08 -04:00
|
|
|
region = cairo_region_create_rectangles (cairo_rects, n_rects);
|
|
|
|
g_free (cairo_rects);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2012-06-13 13:51:08 -04:00
|
|
|
|
2012-08-12 17:02:06 -04:00
|
|
|
needs_mask = (region != NULL) || (priv->window->frame != NULL);
|
|
|
|
|
2013-01-14 21:52:20 -05:00
|
|
|
if (region != NULL)
|
|
|
|
{
|
|
|
|
/* The shape we get back from the client may have coordinates
|
|
|
|
* outside of the frame. The X SHAPE Extension requires that
|
|
|
|
* the overall shape the client provides never exceeds the
|
|
|
|
* "bounding rectangle" of the window -- the shape that the
|
|
|
|
* window would have gotten if it was unshaped. In our case,
|
|
|
|
* this is simply the client area.
|
|
|
|
*/
|
|
|
|
cairo_region_intersect_rectangle (region, &client_area);
|
|
|
|
}
|
|
|
|
else
|
2012-04-27 00:15:30 -04:00
|
|
|
{
|
|
|
|
/* 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. */
|
|
|
|
region = cairo_region_create_rectangle (&client_area);
|
|
|
|
}
|
2009-06-28 12:26:23 -04:00
|
|
|
|
2013-01-14 21:52:20 -05:00
|
|
|
/* The region at this point should be constrained to the
|
|
|
|
* bounds of the client rectangle. */
|
|
|
|
|
2013-01-14 20:45:31 -05:00
|
|
|
if (priv->argb32 && priv->window->opaque_region != NULL)
|
|
|
|
{
|
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
priv->opaque_region = cairo_region_copy (priv->window->opaque_region);
|
|
|
|
cairo_region_translate (priv->opaque_region, client_area.x, client_area.y);
|
|
|
|
cairo_region_intersect (priv->opaque_region, region);
|
|
|
|
}
|
|
|
|
else if (priv->argb32)
|
|
|
|
priv->opaque_region = NULL;
|
|
|
|
else
|
|
|
|
priv->opaque_region = cairo_region_reference (region);
|
|
|
|
|
2012-08-12 17:02:06 -04:00
|
|
|
if (needs_mask)
|
|
|
|
{
|
|
|
|
/* This takes the region, generates a mask using GTK+
|
|
|
|
* and scans the mask looking for all opaque pixels,
|
|
|
|
* adding it to region.
|
|
|
|
*/
|
2013-04-12 13:00:15 -04:00
|
|
|
build_and_scan_frame_mask (self, &client_area, region);
|
2012-08-12 17:02:06 -04:00
|
|
|
}
|
2011-07-08 15:06:13 -04:00
|
|
|
|
2013-01-14 21:43:08 -05:00
|
|
|
priv->shape_region = region;
|
|
|
|
|
2009-06-28 12:26:23 -04:00
|
|
|
priv->needs_reshape = FALSE;
|
2010-11-11 16:24:43 -05:00
|
|
|
meta_window_actor_invalidate_shadow (self);
|
2009-06-28 12:26:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-07-20 00:29:06 -04:00
|
|
|
meta_window_actor_update_shape (MetaWindowActor *self)
|
2009-06-28 12:26:23 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-28 12:26:23 -04:00
|
|
|
|
|
|
|
priv->needs_reshape = TRUE;
|
2013-02-15 15:53:04 -05:00
|
|
|
|
|
|
|
if (is_frozen (self))
|
|
|
|
return;
|
2009-06-28 12:26:23 -04:00
|
|
|
|
2009-07-22 16:11:56 -04:00
|
|
|
clutter_actor_queue_redraw (priv->actor);
|
2009-06-28 12:26:23 -04:00
|
|
|
}
|
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
static void
|
|
|
|
meta_window_actor_handle_updates (MetaWindowActor *self)
|
2009-06-28 12:26:23 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2010-05-13 16:43:30 -04:00
|
|
|
MetaScreen *screen = priv->screen;
|
|
|
|
MetaDisplay *display = meta_screen_get_display (screen);
|
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
|
|
|
2010-03-02 13:02:28 -05: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 12:26:23 -04:00
|
|
|
|
2011-09-13 12:06:26 -04:00
|
|
|
if (priv->unredirected)
|
|
|
|
{
|
|
|
|
/* Nothing to do here until/if the window gets redirected again */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->received_damage)
|
2010-05-13 16:43:30 -04:00
|
|
|
{
|
2010-08-23 16:26:02 -04:00
|
|
|
meta_error_trap_push (display);
|
2010-05-13 16:43:30 -04:00
|
|
|
XDamageSubtract (xdisplay, priv->damage, None, None);
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2011-09-14 11:27:54 -04:00
|
|
|
|
|
|
|
/* We need to make sure that any X drawing that happens before the
|
|
|
|
* XDamageSubtract() above is visible to subsequent GL rendering;
|
|
|
|
* the only standardized way to do this is EXT_x11_sync_object,
|
|
|
|
* which isn't yet widely available. For now, we count on details
|
|
|
|
* of Xorg and the open source drivers, and hope for the best
|
|
|
|
* otherwise.
|
|
|
|
*
|
|
|
|
* Xorg and open source driver specifics:
|
|
|
|
*
|
|
|
|
* The X server makes sure to flush drawing to the kernel before
|
|
|
|
* sending out damage events, but since we use DamageReportBoundingBox
|
|
|
|
* there may be drawing between the last damage event and the
|
|
|
|
* XDamageSubtract() that needs to be flushed as well.
|
|
|
|
*
|
|
|
|
* Xorg always makes sure that drawing is flushed to the kernel
|
|
|
|
* before writing events or responses to the client, so any round trip
|
|
|
|
* request at this point is sufficient to flush the GLX buffers.
|
|
|
|
*/
|
|
|
|
XSync (xdisplay, False);
|
|
|
|
|
2010-05-13 16:43:30 -04:00
|
|
|
priv->received_damage = FALSE;
|
|
|
|
}
|
|
|
|
|
2010-03-02 13:02:28 -05:00
|
|
|
check_needs_pixmap (self);
|
2010-10-18 15:34:08 -04:00
|
|
|
check_needs_reshape (self);
|
|
|
|
check_needs_shadow (self);
|
2011-06-13 18:09:59 -04:00
|
|
|
}
|
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
void
|
|
|
|
meta_window_actor_pre_paint (MetaWindowActor *self)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
meta_window_actor_handle_updates (self);
|
|
|
|
|
|
|
|
for (l = priv->frames; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
FrameData *frame = l->data;
|
|
|
|
|
|
|
|
if (frame->frame_counter == 0)
|
|
|
|
{
|
|
|
|
CoglOnscreen *onscreen = COGL_ONSCREEN (cogl_get_draw_framebuffer());
|
|
|
|
frame->frame_counter = cogl_onscreen_get_frame_counter (onscreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-13 18:09:59 -04:00
|
|
|
void
|
|
|
|
meta_window_actor_post_paint (MetaWindowActor *self)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
|
2013-02-14 13:40:55 -05:00
|
|
|
priv->repaint_scheduled = FALSE;
|
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
if (priv->needs_frame_drawn)
|
2011-06-13 18:09:59 -04:00
|
|
|
{
|
|
|
|
MetaScreen *screen = priv->screen;
|
|
|
|
MetaDisplay *display = meta_screen_get_display (screen);
|
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
XClientMessageEvent ev = { 0, };
|
|
|
|
|
|
|
|
FrameData *frame = priv->frames->data;
|
|
|
|
|
|
|
|
frame->frame_drawn_time = meta_compositor_monotonic_time_to_server_time (display,
|
|
|
|
g_get_monotonic_time ());
|
2011-06-13 18:09:59 -04:00
|
|
|
ev.type = ClientMessage;
|
|
|
|
ev.window = meta_window_get_xwindow (priv->window);
|
2012-11-12 14:11:08 -05:00
|
|
|
ev.message_type = display->atom__NET_WM_FRAME_DRAWN;
|
2011-06-13 18:09:59 -04:00
|
|
|
ev.format = 32;
|
2012-11-12 14:11:08 -05:00
|
|
|
ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT(0xffffffff);
|
|
|
|
ev.data.l[1] = frame->sync_request_serial >> 32;
|
|
|
|
ev.data.l[2] = frame->frame_drawn_time & G_GUINT64_CONSTANT(0xffffffff);
|
|
|
|
ev.data.l[3] = frame->frame_drawn_time >> 32;
|
2011-06-13 18:09:59 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
XSendEvent (xdisplay, ev.window, False, 0, (XEvent*) &ev);
|
2012-11-12 14:11:08 -05:00
|
|
|
XFlush (xdisplay);
|
2011-06-13 18:09:59 -04:00
|
|
|
meta_error_trap_pop (display);
|
|
|
|
|
2012-11-12 14:11:08 -05:00
|
|
|
priv->needs_frame_drawn = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
send_frame_timings (MetaWindowActor *self,
|
|
|
|
FrameData *frame,
|
|
|
|
CoglFrameInfo *frame_info,
|
|
|
|
gint64 presentation_time)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
MetaDisplay *display = meta_screen_get_display (priv->screen);
|
|
|
|
Display *xdisplay = meta_display_get_xdisplay (display);
|
|
|
|
float refresh_rate;
|
|
|
|
int refresh_interval;
|
|
|
|
|
|
|
|
XClientMessageEvent ev = { 0, };
|
|
|
|
|
|
|
|
ev.type = ClientMessage;
|
|
|
|
ev.window = meta_window_get_xwindow (priv->window);
|
|
|
|
ev.message_type = display->atom__NET_WM_FRAME_TIMINGS;
|
|
|
|
ev.format = 32;
|
|
|
|
ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT(0xffffffff);
|
|
|
|
ev.data.l[1] = frame->sync_request_serial >> 32;
|
|
|
|
|
|
|
|
refresh_rate = cogl_frame_info_get_refresh_rate (frame_info);
|
|
|
|
/* 0.0 is a flag for not known, but sanity-check against other odd numbers */
|
|
|
|
if (refresh_rate >= 1.0)
|
|
|
|
refresh_interval = (int) (0.5 + 1000000 / refresh_rate);
|
|
|
|
else
|
|
|
|
refresh_interval = 0;
|
|
|
|
|
|
|
|
if (presentation_time != 0)
|
|
|
|
{
|
|
|
|
gint64 presentation_time_server = meta_compositor_monotonic_time_to_server_time (display,
|
|
|
|
presentation_time);
|
|
|
|
gint64 presentation_time_offset = presentation_time_server - frame->frame_drawn_time;
|
|
|
|
if (presentation_time_offset == 0)
|
|
|
|
presentation_time_offset = 1;
|
|
|
|
|
|
|
|
if ((gint32)presentation_time_offset == presentation_time_offset)
|
|
|
|
ev.data.l[2] = presentation_time_offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
ev.data.l[3] = refresh_interval;
|
|
|
|
ev.data.l[4] = 1000 * META_SYNC_DELAY;
|
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
XSendEvent (xdisplay, ev.window, False, 0, (XEvent*) &ev);
|
|
|
|
XFlush (xdisplay);
|
|
|
|
meta_error_trap_pop (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_actor_frame_complete (MetaWindowActor *self,
|
|
|
|
CoglFrameInfo *frame_info,
|
|
|
|
gint64 presentation_time)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
for (l = priv->frames; l;)
|
|
|
|
{
|
|
|
|
GList *l_next = l->next;
|
|
|
|
FrameData *frame = l->data;
|
|
|
|
|
|
|
|
if (frame->frame_counter == cogl_frame_info_get_frame_counter (frame_info))
|
|
|
|
{
|
|
|
|
if (frame->frame_drawn_time != 0)
|
|
|
|
{
|
|
|
|
priv->frames = g_list_delete_link (priv->frames, l);
|
|
|
|
send_frame_timings (self, frame, frame_info, presentation_time);
|
|
|
|
frame_data_free (frame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
l = l_next;
|
2011-06-13 18:09:59 -04:00
|
|
|
}
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
void
|
|
|
|
meta_window_actor_invalidate_shadow (MetaWindowActor *self)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
|
|
|
|
priv->recompute_focused_shadow = TRUE;
|
|
|
|
priv->recompute_unfocused_shadow = TRUE;
|
2013-02-15 15:53:04 -05:00
|
|
|
|
|
|
|
if (is_frozen (self))
|
|
|
|
return;
|
|
|
|
|
2010-11-11 16:24:43 -05:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
|
|
|
|
}
|
|
|
|
|
2009-06-26 15:33:20 -04:00
|
|
|
void
|
2010-10-18 13:27:14 -04:00
|
|
|
meta_window_actor_update_opacity (MetaWindowActor *self)
|
2009-06-26 15:33:20 -04:00
|
|
|
{
|
2010-10-18 13:27:14 -04:00
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
2009-06-26 15:33:20 -04:00
|
|
|
MetaDisplay *display = meta_screen_get_display (priv->screen);
|
|
|
|
MetaCompositor *compositor = meta_display_get_compositor (display);
|
|
|
|
Window xwin = meta_window_get_xwindow (priv->window);
|
|
|
|
gulong value;
|
|
|
|
guint8 opacity;
|
|
|
|
|
|
|
|
if (meta_prop_get_cardinal (display, xwin,
|
|
|
|
compositor->atom_net_wm_window_opacity,
|
|
|
|
&value))
|
|
|
|
{
|
|
|
|
opacity = (guint8)((gfloat)value * 255.0 / ((gfloat)0xffffffff));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
opacity = 255;
|
|
|
|
|
|
|
|
self->priv->opacity = opacity;
|
2011-04-26 12:08:15 -04:00
|
|
|
clutter_actor_set_opacity (self->priv->actor, opacity);
|
2009-06-26 15:33:20 -04:00
|
|
|
}
|
2011-06-13 17:53:23 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_actor_set_updates_frozen (MetaWindowActor *self,
|
|
|
|
gboolean updates_frozen)
|
|
|
|
{
|
|
|
|
MetaWindowActorPrivate *priv = self->priv;
|
|
|
|
|
|
|
|
updates_frozen = updates_frozen != FALSE;
|
|
|
|
|
|
|
|
if (priv->updates_frozen != updates_frozen)
|
|
|
|
{
|
|
|
|
priv->updates_frozen = updates_frozen;
|
|
|
|
if (updates_frozen)
|
|
|
|
meta_window_actor_freeze (self);
|
|
|
|
else
|
|
|
|
meta_window_actor_thaw (self);
|
|
|
|
}
|
|
|
|
}
|