Compare commits

..

9 Commits

Author SHA1 Message Date
Jasper St. Pierre
8b2a85f636 window-actor: Don't do any special initialization in _new
https://bugzilla.gnome.org/show_bug.cgi?id=678989
2013-12-06 16:24:01 -05:00
Jasper St. Pierre
df35234841 Allow potentially supporting multiple MetaWindowActors per window
A lot of the code in mutter assumed a one to one relationship between a
MetaWindow and a MetaWindowActor, and that it owns its
MetaWindowActor. For the most part, we've gotten around this in GNOME
Shell by creating a ClutterClone of the MetaWindowActor. In some spots, we
reparent the actor owned by Mutter, and use it for our own purpose, which
just plain isn't nice. Since the Clutter maintainers have plans to kill
off ClutterClone, and since MetaWindowActor is already a very thin wrapper
around MetaShapedTexture, we should be able to create multiple
MetaWindowActors for a MetaShapedTexture.

This commit replaces the "compositor_private" property on MetaWindow with
a direct reference to a MetaWindowActor (which may go away at some point,
see below), and a list of window actors.

The direct reference is a replacement for the "compositor_private"
property that has been there previously. It doesn't make sense to run
mutter without compositing, so there's no real reason to keep the veil of
a compositor/core split.

The eventual plan I have in mind is to remove the direct reference to
MetaWindowActor, and have the compositor/plugin just create a new window
actor like anybody else.

https://bugzilla.gnome.org/show_bug.cgi?id=678989
2013-12-06 16:24:01 -05:00
Jasper St. Pierre
84b71cf297 window-actor: Make the meta-window property construct-only
We don't deal with setting this property at all, and it's unlikely
to come up in future settings, so just don't allow setting it at all.

https://bugzilla.gnome.org/show_bug.cgi?id=678989
2013-12-06 16:24:01 -05:00
Jasper St. Pierre
8cf420b128 window-actor: Remove meta-screen property
This can be inferred from the window. Don't allow anybody to set it.

https://bugzilla.gnome.org/show_bug.cgi?id=678989
2013-12-06 16:24:01 -05:00
Jasper St. Pierre
d1dda65339 window-actor: Remove (private) xwindow property
This should make it easier to construct a MetaWindowActor from bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=678989
2013-12-06 16:24:00 -05:00
Jasper St. Pierre
057d8830e9 window: Add a simple meta_window_get_toplevel_xwindow utility
To replace all the places where we do:

  window->frame ? window->frame->xwindow : window->xwindow

or similar...
2013-12-06 16:23:49 -05:00
Jasper St. Pierre
570953819d window-actor: Remove outdated code path
The shadow is added in the paint step, not as a separate actor,
so the raise is a no-op. It also gets rid of an annoying misspelling
that's driving me crazy.
2013-12-06 16:20:57 -05:00
Jasper St. Pierre
0601987651 Move position-changed / size-changed signals to the MetaWindow
They fit more appropriately over here...
2013-12-06 16:20:56 -05:00
Jasper St. Pierre
853098142f window-actor: Remove old unused APIs 2013-12-06 15:31:27 -05:00
13 changed files with 846 additions and 857 deletions

View File

@@ -96,6 +96,8 @@ meta_compositor_hide_window
meta_compositor_switch_workspace
meta_compositor_maximize_window
meta_compositor_unmaximize_window
meta_compositor_window_mapped
meta_compositor_window_unmapped
meta_compositor_sync_window_geometry
meta_compositor_set_updates_frozen
meta_compositor_queue_frame_drawn

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,8 @@ struct _MetaCompositor
{
MetaDisplay *display;
Atom atom_x_root_pixmap;
Atom atom_net_wm_window_opacity;
guint repaint_func_id;
ClutterActor *shadow_src;

View File

@@ -42,6 +42,15 @@
* the call, so it may be necessary to readjust the display based on the
* old_rect to start the animation.
*
* meta_compositor_window_mapped() and meta_compositor_window_unmapped() are
* notifications when the toplevel window (frame or client window) is mapped or
* unmapped. That is, when the result of meta_window_toplevel_is_mapped()
* changes. The main use of this is to drop resources when a window is unmapped.
* A window will always be mapped before meta_compositor_show_window()
* is called and will not be unmapped until after meta_compositor_hide_window()
* is called. If the live_hidden_windows preference is set, windows will never
* be unmapped.
*
* # Containers #
*
* There's two containers in the stage that are used to place window actors, here
@@ -141,10 +150,28 @@ add_win (MetaWindow *window)
{
MetaScreen *screen = meta_window_get_screen (window);
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
MetaWindowActor *actor;
ClutterActor *window_group;
g_return_if_fail (info != NULL);
meta_window_actor_new (window);
actor = meta_window_actor_new (window);
window->core_actor = actor;
if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
window_group = info->top_window_group;
else
window_group = info->window_group;
clutter_actor_add_child (window_group, CLUTTER_ACTOR (actor));
clutter_actor_set_reactive (CLUTTER_ACTOR (actor), TRUE);
clutter_actor_hide (CLUTTER_ACTOR (actor));
/* Initial position in the stack is arbitrary; stacking will be synced
* before we first paint.
*/
info->windows = g_list_append (info->windows, actor);
sync_actor_stacking (info);
}
@@ -154,16 +181,26 @@ process_damage (MetaCompositor *compositor,
XDamageNotifyEvent *event,
MetaWindow *window)
{
MetaWindowActor *window_actor;
GSList *iter;
if (window == NULL)
return;
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (window_actor == NULL)
for (iter = window->actors; iter != NULL; iter = iter->next)
meta_window_actor_process_damage (META_WINDOW_ACTOR (iter->data), event);
}
static void
process_property_notify (MetaCompositor *compositor,
XPropertyEvent *event,
MetaWindow *window)
{
if (window == NULL || window->core_actor == NULL)
return;
meta_window_actor_process_damage (window_actor, event);
/* Check for the opacity changing */
if (event->atom == compositor->atom_net_wm_window_opacity)
meta_window_actor_update_opacity (window->core_actor);
}
static Window
@@ -755,27 +792,30 @@ void
meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor = NULL;
MetaScreen *screen;
MetaCompScreen *info;
GSList *iter;
DEBUG_TRACE ("meta_compositor_remove_window\n");
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
screen = meta_window_get_screen (window);
info = meta_screen_get_compositor_data (screen);
if (window_actor == info->unredirected_window)
if (window->core_actor == info->unredirected_window)
{
meta_window_actor_set_redirected (window_actor, TRUE);
meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window (info->unredirected_window)),
NULL);
meta_window_actor_set_redirected (info->unredirected_window, TRUE);
meta_shape_cow_for_window (meta_window_get_screen (window), NULL);
info->unredirected_window = NULL;
}
meta_window_actor_destroy (window_actor);
window->core_actor = NULL;
for (iter = window->actors; iter != NULL; iter = iter->next)
{
MetaWindowActor *actor = META_WINDOW_ACTOR (iter->data);
meta_window_actor_destroy (actor);
info->windows = g_list_remove (info->windows, (gconstpointer) actor);
}
}
void
@@ -835,24 +875,10 @@ void
meta_compositor_window_shape_changed (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor;
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
GSList *iter;
meta_window_actor_update_shape (window_actor);
}
void
meta_compositor_window_opacity_changed (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor;
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
meta_window_actor_update_opacity (window_actor);
for (iter = window->actors; iter != NULL; iter = iter->next)
meta_window_actor_update_shape (META_WINDOW_ACTOR (iter->data));
}
/* Clutter makes the assumption that there is only one X window
@@ -961,19 +987,28 @@ meta_compositor_process_event (MetaCompositor *compositor,
}
}
if (event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
switch (event->type)
{
/* Core code doesn't handle damage events, so we need to extract the MetaWindow
* ourselves
*/
if (window == NULL)
{
Window xwin = ((XDamageNotifyEvent *) event)->drawable;
window = meta_display_lookup_x_window (compositor->display, xwin);
}
case PropertyNotify:
process_property_notify (compositor, (XPropertyEvent *) event, window);
break;
DEBUG_TRACE ("meta_compositor_process_event (process_damage)\n");
process_damage (compositor, (XDamageNotifyEvent *) event, window);
default:
if (event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
{
/* Core code doesn't handle damage events, so we need to extract the MetaWindow
* ourselves
*/
if (window == NULL)
{
Window xwin = ((XDamageNotifyEvent *) event)->drawable;
window = meta_display_lookup_x_window (compositor->display, xwin);
}
DEBUG_TRACE ("meta_compositor_process_event (process_damage)\n");
process_damage (compositor, (XDamageNotifyEvent *) event, window);
}
break;
}
/* Clutter needs to know about MapNotify events otherwise it will
@@ -1006,12 +1041,8 @@ meta_compositor_show_window (MetaCompositor *compositor,
MetaWindow *window,
MetaCompEffect effect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
DEBUG_TRACE ("meta_compositor_show_window\n");
if (!window_actor)
return;
meta_window_actor_show (window_actor, effect);
if (window->core_actor != NULL)
meta_window_actor_show (window->core_actor, effect);
}
void
@@ -1019,12 +1050,8 @@ meta_compositor_hide_window (MetaCompositor *compositor,
MetaWindow *window,
MetaCompEffect effect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
DEBUG_TRACE ("meta_compositor_hide_window\n");
if (!window_actor)
return;
meta_window_actor_hide (window_actor, effect);
if (window->core_actor != NULL)
meta_window_actor_hide (window->core_actor, effect);
}
void
@@ -1033,12 +1060,8 @@ meta_compositor_maximize_window (MetaCompositor *compositor,
MetaRectangle *old_rect,
MetaRectangle *new_rect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
DEBUG_TRACE ("meta_compositor_maximize_window\n");
if (!window_actor)
return;
meta_window_actor_maximize (window_actor, old_rect, new_rect);
if (window->core_actor != NULL)
meta_window_actor_maximize (window->core_actor, old_rect, new_rect);
}
void
@@ -1047,12 +1070,8 @@ meta_compositor_unmaximize_window (MetaCompositor *compositor,
MetaRectangle *old_rect,
MetaRectangle *new_rect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
DEBUG_TRACE ("meta_compositor_unmaximize_window\n");
if (!window_actor)
return;
meta_window_actor_unmaximize (window_actor, old_rect, new_rect);
if (window->core_actor != NULL)
meta_window_actor_unmaximize (window->core_actor, old_rect, new_rect);
}
void
@@ -1228,7 +1247,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
while (stack)
{
stack_window = stack->data;
stack_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (stack_window));
stack_actor = stack_window->core_actor;
if (!stack_actor)
{
meta_verbose ("Failed to find corresponding MetaWindowActor "
@@ -1273,22 +1292,29 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
sync_actor_stacking (info);
}
void
meta_compositor_window_mapped (MetaCompositor *compositor,
MetaWindow *window)
{
if (window->core_actor != NULL)
meta_window_actor_mapped (window->core_actor);
}
void
meta_compositor_window_unmapped (MetaCompositor *compositor,
MetaWindow *window)
{
if (window->core_actor != NULL)
meta_window_actor_unmapped (window->core_actor);
}
void
meta_compositor_sync_window_geometry (MetaCompositor *compositor,
MetaWindow *window,
gboolean did_placement)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (window);
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
DEBUG_TRACE ("meta_compositor_sync_window_geometry\n");
g_return_if_fail (info);
if (!window_actor)
return;
meta_window_actor_sync_actor_geometry (window_actor, did_placement);
if (window->core_actor != NULL)
meta_window_actor_sync_actor_geometry (window->core_actor, did_placement);
}
void
@@ -1453,7 +1479,13 @@ on_shadow_factory_changed (MetaShadowFactory *factory,
MetaCompositor *
meta_compositor_new (MetaDisplay *display)
{
char *atom_names[] = {
"_XROOTPMAP_ID",
"_NET_WM_WINDOW_OPACITY",
};
Atom atoms[G_N_ELEMENTS(atom_names)];
MetaCompositor *compositor;
Display *xdisplay = meta_display_get_xdisplay (display);
if (!composite_at_least_version (display, 0, 3))
return NULL;
@@ -1465,11 +1497,18 @@ meta_compositor_new (MetaDisplay *display)
if (g_getenv("META_DISABLE_MIPMAPS"))
compositor->no_mipmaps = TRUE;
meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
XInternAtoms (xdisplay, atom_names, G_N_ELEMENTS (atom_names),
False, atoms);
g_signal_connect (meta_shadow_factory_get_default (),
"changed",
G_CALLBACK (on_shadow_factory_changed),
compositor);
compositor->atom_x_root_pixmap = atoms[0];
compositor->atom_net_wm_window_opacity = atoms[1];
compositor->repaint_func_id = clutter_threads_add_repaint_func (meta_repaint_func,
compositor,
NULL);

View File

@@ -34,14 +34,7 @@
#include "monitor-private.h"
#include "meta-cullable.h"
enum {
POSITION_CHANGED,
SIZE_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = {0};
static void meta_window_actor_queue_create_pixmap (MetaWindowActor *self);
struct _MetaWindowActorPrivate
{
@@ -68,6 +61,8 @@ struct _MetaWindowActorPrivate
Damage damage;
guint8 opacity;
/* A region that matches the shape of the window, including frame bounds */
cairo_region_t *shape_region;
/* If the window has an input shape, a region that matches the shape */
@@ -109,6 +104,7 @@ struct _MetaWindowActorPrivate
GList *frames;
guint visible : 1;
guint mapped : 1;
guint argb32 : 1;
guint disposed : 1;
guint redecorating : 1;
@@ -244,19 +240,6 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
g_object_class_install_property (object_class,
PROP_SHADOW_CLASS,
pspec);
signals[POSITION_CHANGED] =
g_signal_new ("position-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[SIZE_CHANGED] =
g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
static void
@@ -267,7 +250,11 @@ meta_window_actor_init (MetaWindowActor *self)
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
META_TYPE_WINDOW_ACTOR,
MetaWindowActorPrivate);
priv->opacity = 0xff;
priv->shadow_class = NULL;
priv->last_width = -1;
priv->last_height = -1;
}
static void
@@ -301,6 +288,8 @@ window_decorated_notify (MetaWindow *mw,
priv->damage = None;
}
priv->xwindow = meta_window_get_toplevel_xwindow (priv->window);
/*
* Recreate the contents.
*/
@@ -315,15 +304,6 @@ window_appears_focused_notify (MetaWindow *mw,
clutter_actor_queue_redraw (CLUTTER_ACTOR (data));
}
static gboolean
is_non_opaque (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
MetaWindow *window = priv->window;
return priv->argb32 || (window->opacity != 0xFF);
}
static void
meta_window_actor_constructed (GObject *object)
{
@@ -361,13 +341,34 @@ meta_window_actor_constructed (GObject *object)
* We will release it in dispose().
*/
g_object_ref (priv->actor);
g_signal_connect_object (window, "notify::decorated",
G_CALLBACK (window_decorated_notify), self, 0);
g_signal_connect_object (window, "notify::appears-focused",
G_CALLBACK (window_appears_focused_notify), self, 0);
}
meta_window_actor_update_opacity (self);
meta_window_actor_sync_actor_position (self);
priv->mapped = meta_window_toplevel_is_mapped (priv->window);
if (priv->mapped)
meta_window_actor_queue_create_pixmap (self);
meta_window_actor_set_updates_frozen (self,
meta_window_updates_are_frozen (priv->window));
/* 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);
/* Start off with an empty region to maintain the invariant that
the shape region is always set */
priv->shape_region = cairo_region_create ();
G_OBJECT_CLASS (meta_window_actor_parent_class)->constructed (object);
}
static void
@@ -378,7 +379,6 @@ meta_window_actor_dispose (GObject *object)
MetaScreen *screen;
MetaDisplay *display;
Display *xdisplay;
MetaCompScreen *info;
if (priv->disposed)
return;
@@ -388,7 +388,6 @@ meta_window_actor_dispose (GObject *object)
screen = priv->screen;
display = meta_screen_get_display (screen);
xdisplay = meta_display_get_xdisplay (display);
info = meta_screen_get_compositor_data (screen);
meta_window_actor_detach (self);
@@ -418,8 +417,6 @@ meta_window_actor_dispose (GObject *object)
priv->damage = None;
}
info->windows = g_list_remove (info->windows, (gconstpointer) self);
g_clear_object (&priv->window);
/*
@@ -454,11 +451,6 @@ meta_window_actor_set_property (GObject *object,
{
case PROP_META_WINDOW:
priv->window = g_value_dup_object (value);
g_signal_connect_object (priv->window, "notify::decorated",
G_CALLBACK (window_decorated_notify), self, 0);
g_signal_connect_object (priv->window, "notify::appears-focused",
G_CALLBACK (window_appears_focused_notify), self, 0);
break;
case PROP_NO_SHADOW:
{
@@ -601,7 +593,7 @@ clip_shadow_under_window (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
return is_non_opaque (self) && priv->window->frame;
return (priv->argb32 || priv->opacity != 0xff) && priv->window->frame;
}
static void
@@ -627,7 +619,6 @@ meta_window_actor_paint (ClutterActor *actor)
MetaShadowParams params;
cairo_rectangle_int_t shape_bounds;
cairo_region_t *clip = priv->shadow_clip;
MetaWindow *window = priv->window;
meta_window_actor_get_shape_bounds (self, &shape_bounds);
meta_window_actor_get_shadow_params (self, appears_focused, &params);
@@ -651,7 +642,7 @@ meta_window_actor_paint (ClutterActor *actor)
params.y_offset + shape_bounds.y,
shape_bounds.width,
shape_bounds.height,
(clutter_actor_get_paint_opacity (actor) * params.opacity * window->opacity) / (255 * 255),
(clutter_actor_get_paint_opacity (actor) * params.opacity * priv->opacity) / (255 * 255),
clip,
clip_shadow_under_window (self)); /* clip_strictly - not just as an optimization */
@@ -738,10 +729,10 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
return TRUE;
/*
* Do not add shadows to non-opaque windows; eventually we should generate
* a shadow from the input shape for such windows.
* Do not add shadows to ARGB windows; eventually we should generate a
* shadow from the input shape for such windows.
*/
if (is_non_opaque (self))
if (priv->argb32 || priv->opacity != 0xff)
return FALSE;
/*
@@ -814,59 +805,6 @@ meta_window_actor_is_destroyed (MetaWindowActor *self)
return self->priv->disposed;
}
gboolean
meta_window_actor_is_override_redirect (MetaWindowActor *self)
{
return meta_window_is_override_redirect (self->priv->window);
}
/**
* meta_window_actor_get_workspace:
* @self: #MetaWindowActor
*
* 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.
*/
gint
meta_window_actor_get_workspace (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv;
MetaWorkspace *workspace;
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);
if (!workspace)
return -1;
return meta_workspace_index (workspace);
}
gboolean
meta_window_actor_showing_on_its_workspace (MetaWindowActor *self)
{
if (!self)
return FALSE;
/* If override redirect: */
if (!self->priv->window)
return TRUE;
return meta_window_showing_on_its_workspace (self->priv->window);
}
static void
meta_window_actor_freeze (MetaWindowActor *self)
{
@@ -939,7 +877,7 @@ meta_window_actor_damage_all (MetaWindowActor *self)
texture = meta_shaped_texture_get_texture (META_SHAPED_TEXTURE (priv->actor));
if (priv->needs_pixmap)
if (!priv->mapped || priv->needs_pixmap)
return;
redraw_queued = meta_shaped_texture_update_area (META_SHAPED_TEXTURE (priv->actor),
@@ -1028,7 +966,7 @@ meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
{
queue_send_frame_messages_timeout (self);
}
else
else if (priv->mapped && !priv->needs_pixmap)
{
const cairo_rectangle_int_t clip = { 0, 0, 1, 1 };
clutter_actor_queue_redraw_with_clip (priv->actor, &clip);
@@ -1060,6 +998,9 @@ meta_window_actor_queue_create_pixmap (MetaWindowActor *self)
priv->needs_pixmap = TRUE;
if (!priv->mapped)
return;
if (is_frozen (self))
return;
@@ -1273,7 +1214,7 @@ meta_window_actor_should_unredirect (MetaWindowActor *self)
if (meta_window_requested_dont_bypass_compositor (metaWindow))
return FALSE;
if (metaWindow->opacity != 0xFF)
if (priv->opacity != 0xff)
return FALSE;
if (metaWindow->shape_region != NULL)
@@ -1327,7 +1268,6 @@ void
meta_window_actor_destroy (MetaWindowActor *self)
{
MetaWindow *window;
MetaCompScreen *info;
MetaWindowActorPrivate *priv;
MetaWindowType window_type;
@@ -1335,14 +1275,6 @@ meta_window_actor_destroy (MetaWindowActor *self)
window = priv->window;
window_type = meta_window_get_window_type (window);
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);
if (window_type == META_WINDOW_DROPDOWN_MENU ||
window_type == META_WINDOW_POPUP_MENU ||
@@ -1405,8 +1337,6 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
window_rect.x, window_rect.y);
clutter_actor_set_size (CLUTTER_ACTOR (self),
window_rect.width, window_rect.height);
g_signal_emit (self, signals[POSITION_CHANGED], 0);
}
void
@@ -1554,52 +1484,37 @@ meta_window_actor_unmaximize (MetaWindowActor *self,
MetaWindowActor *
meta_window_actor_new (MetaWindow *window)
{
MetaScreen *screen = meta_window_get_screen (window);
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
MetaWindowActor *self;
MetaWindowActorPrivate *priv;
ClutterActor *window_group;
self = g_object_new (META_TYPE_WINDOW_ACTOR,
return g_object_new (META_TYPE_WINDOW_ACTOR,
"meta-window", window,
NULL);
}
priv = self->priv;
void
meta_window_actor_mapped (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
priv->last_width = -1;
priv->last_height = -1;
g_return_if_fail (!priv->mapped);
meta_window_actor_set_updates_frozen (self,
meta_window_updates_are_frozen (priv->window));
priv->mapped = TRUE;
/* 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);
meta_window_actor_queue_create_pixmap (self);
}
meta_window_actor_sync_actor_geometry (self, priv->window->placed);
void
meta_window_actor_unmapped (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
/* Hang our compositor window state off the MetaWindow for fast retrieval */
meta_window_set_compositor_private (window, G_OBJECT (self));
g_return_if_fail (priv->mapped);
if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
window_group = info->top_window_group;
else
window_group = info->window_group;
priv->mapped = FALSE;
clutter_actor_add_child (window_group, CLUTTER_ACTOR (self));
if (meta_window_actor_effect_in_progress (self))
return;
clutter_actor_hide (CLUTTER_ACTOR (self));
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
/* Initial position in the stack is arbitrary; stacking will be synced
* before we first paint.
*/
info->windows = g_list_append (info->windows, self);
return self;
meta_window_actor_detach (self);
priv->needs_pixmap = FALSE;
}
/**
@@ -1616,9 +1531,8 @@ static cairo_region_t *
meta_window_actor_get_obscured_region (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
MetaWindow *window = priv->window;
if (priv->back_pixmap && window->opacity != 0xFF && !priv->window->shaded)
if (priv->back_pixmap && priv->opacity == 0xff && !priv->window->shaded)
return priv->opaque_region;
else
return NULL;
@@ -1804,6 +1718,9 @@ check_needs_pixmap (MetaWindowActor *self)
if (!priv->needs_pixmap)
return;
if (!priv->mapped)
return;
if (xwindow == meta_screen_get_xroot (screen) ||
xwindow == clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage)))
return;
@@ -1860,17 +1777,6 @@ check_needs_pixmap (MetaWindowActor *self)
*/
if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
g_warning ("NOTE: Not using GLX TFP!\n");
/* ::size-changed is supposed to refer to meta_window_get_frame_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);
}
priv->needs_pixmap = FALSE;
@@ -1889,6 +1795,9 @@ check_needs_shadow (MetaWindowActor *self)
gboolean should_have_shadow;
gboolean appears_focused;
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
@@ -1992,7 +1901,7 @@ meta_window_actor_process_damage (MetaWindowActor *self,
return;
}
if (priv->needs_pixmap)
if (!priv->mapped || priv->needs_pixmap)
return;
redraw_queued = meta_shaped_texture_update_area (META_SHAPED_TEXTURE (priv->actor),
@@ -2261,6 +2170,9 @@ check_needs_reshape (MetaWindowActor *self)
MetaFrameBorders borders;
cairo_rectangle_int_t client_area;
if (!priv->mapped)
return;
if (!priv->needs_reshape)
return;
@@ -2523,9 +2435,23 @@ void
meta_window_actor_update_opacity (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
MetaWindow *window = priv->window;
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;
clutter_actor_set_opacity (self->priv->actor, window->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;
clutter_actor_set_opacity (self->priv->actor, opacity);
}
void

View File

@@ -412,7 +412,7 @@ switch_workspace (MetaPlugin *plugin,
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
gint win_workspace;
win_workspace = meta_window_actor_get_workspace (window_actor);
win_workspace = meta_window_get_workspace (meta_window_actor_get_meta_window (window_actor));
if (win_workspace == to || win_workspace == from)
{

View File

@@ -36,6 +36,7 @@
#include <config.h>
#include <meta/compositor.h>
#include <meta/meta-window-actor.h>
#include <meta/window.h>
#include "screen-private.h"
#include <meta/util.h>
@@ -355,9 +356,6 @@ struct _MetaWindow
/* the input shape region for picking */
cairo_region_t *input_region;
/* _NET_WM_WINDOW_OPACITY */
guint opacity;
/* if TRUE, the we have the new form of sync request counter which
* also handles application frames */
guint extended_sync_request_counter : 1;
@@ -441,7 +439,10 @@ struct _MetaWindow
/* maintained by group.c */
MetaGroup *group;
GObject *compositor_private;
GSList *actors;
/* The core actor is the one in the window group. */
MetaWindowActor *core_actor;
/* Focused window that is (directly or indirectly) attached to this one */
MetaWindow *attached_focus_window;
@@ -698,8 +699,6 @@ void meta_window_update_input_region_x11 (MetaWindow *window);
void meta_window_set_shape_region (MetaWindow *window,
cairo_region_t *region);
void meta_window_update_shape_region_x11 (MetaWindow *window);
void meta_window_set_opacity (MetaWindow *window,
guint opacity);
Window meta_window_get_toplevel_xwindow (MetaWindow *window);

View File

@@ -1709,20 +1709,6 @@ reload_bypass_compositor (MetaWindow *window,
window->bypass_compositor = requested_value;
}
static void
reload_window_opacity (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
int requested_value = 0xFF;
if (value->type != META_PROP_VALUE_INVALID)
requested_value = (int) value->v.cardinal;
meta_window_set_opacity (window, requested_value);
}
#define RELOAD_STRING(var_name, propname) \
static void \
reload_ ## var_name (MetaWindow *window, \
@@ -1825,7 +1811,6 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ display->atom__NET_WM_STRUT, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE },
{ display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE },
{ display->atom__NET_WM_BYPASS_COMPOSITOR, META_PROP_VALUE_CARDINAL, reload_bypass_compositor, FALSE, FALSE },
{ display->atom__NET_WM_WINDOW_OPACITY, META_PROP_VALUE_CARDINAL, reload_window_opacity, TRUE, TRUE },
{ 0 },
};

View File

@@ -194,6 +194,8 @@ enum
FOCUS,
RAISED,
UNMANAGED,
SIZE_CHANGED,
POSITION_CHANGED,
LAST_SIGNAL
};
@@ -587,6 +589,22 @@ meta_window_class_init (MetaWindowClass *klass)
G_STRUCT_OFFSET (MetaWindowClass, unmanaged),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
window_signals[POSITION_CHANGED] =
g_signal_new ("position-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
window_signals[SIZE_CHANGED] =
g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
static void
@@ -1175,7 +1193,8 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->initial_workspace = 0; /* not used */
window->initial_timestamp = 0; /* not used */
window->compositor_private = NULL;
window->core_actor = NULL;
window->actors = NULL;
window->monitor = meta_screen_get_monitor_for_window (window->screen, window);
@@ -1201,8 +1220,6 @@ meta_window_new_with_attrs (MetaDisplay *display,
*/
window->stable_sequence = ++display->window_sequence_counter;
window->opacity = 0xFF;
/* assign the window to its group, or create a new group if needed
*/
window->group = NULL;
@@ -1447,6 +1464,9 @@ meta_window_new_with_attrs (MetaDisplay *display,
set_net_wm_state (window);
}
if (screen->display->compositor)
meta_compositor_add_window (screen->display->compositor, window);
/* Sync stack changes */
meta_stack_thaw (window->screen->stack);
@@ -1669,6 +1689,8 @@ meta_window_unmanage (MetaWindow *window,
if (window->visible_to_compositor)
meta_compositor_hide_window (window->display->compositor, window,
META_COMP_EFFECT_DESTROY);
meta_compositor_remove_window (window->display->compositor, window);
}
if (window->display->window_with_menu == window)
@@ -3138,7 +3160,7 @@ meta_window_show (MetaWindow *window)
if (toplevel_now_mapped != toplevel_was_mapped)
{
if (window->display->compositor)
meta_compositor_add_window (window->display->compositor, window);
meta_compositor_window_mapped (window->display->compositor, window);
}
if (!window->visible_to_compositor)
@@ -3287,7 +3309,13 @@ meta_window_hide (MetaWindow *window)
if (toplevel_now_mapped != toplevel_was_mapped)
{
if (window->display->compositor)
meta_compositor_remove_window (window->display->compositor, window);
{
/* As above, we may be *mapping* live hidden windows */
if (toplevel_now_mapped)
meta_compositor_window_mapped (window->display->compositor, window);
else
meta_compositor_window_unmapped (window->display->compositor, window);
}
}
set_net_wm_state (window);
@@ -5274,6 +5302,12 @@ meta_window_move_resize_internal (MetaWindow *window,
else if (is_user_action)
save_user_window_placement (window);
if (need_move_frame)
g_signal_emit (window, window_signals[POSITION_CHANGED], 0);
if (need_resize_client)
g_signal_emit (window, window_signals[SIZE_CHANGED], 0);
if (need_move_frame || need_resize_frame ||
need_move_client || need_resize_client ||
did_placement)
@@ -11031,24 +11065,15 @@ meta_window_get_gtk_menubar_object_path (MetaWindow *window)
* meta_window_get_compositor_private:
* @window: a #MetaWindow
*
* Gets the compositor's wrapper object for @window.
*
* Return value: (transfer none): the wrapper object.
**/
* Return value: (transfer none):
*/
GObject *
meta_window_get_compositor_private (MetaWindow *window)
{
if (!window)
return NULL;
return window->compositor_private;
}
void
meta_window_set_compositor_private (MetaWindow *window, GObject *priv)
{
if (!window)
return;
window->compositor_private = priv;
return G_OBJECT (window->core_actor);
}
const char *
@@ -11435,13 +11460,3 @@ meta_window_get_toplevel_xwindow (MetaWindow *window)
{
return window->frame ? window->frame->xwindow : window->xwindow;
}
void
meta_window_set_opacity (MetaWindow *window,
guint opacity)
{
window->opacity = opacity;
if (window->display->compositor)
meta_compositor_window_opacity_changed (window->display->compositor, window);
}

View File

@@ -179,7 +179,6 @@ item(_NET_WM_BYPASS_COMPOSITOR)
item(_NET_WM_OPAQUE_REGION)
item(_NET_WM_FRAME_DRAWN)
item(_NET_WM_FRAME_TIMINGS)
item(_NET_WM_WINDOW_OPACITY)
#if 0
/* We apparently never use: */

View File

@@ -66,8 +66,6 @@ void meta_compositor_unmanage_screen (MetaCompositor *compositor,
void meta_compositor_window_shape_changed (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_window_opacity_changed (MetaCompositor *compositor,
MetaWindow *window);
gboolean meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event,
@@ -77,10 +75,11 @@ gboolean meta_compositor_filter_keybinding (MetaCompositor *compositor,
MetaScreen *screen,
MetaKeyBinding *binding);
void meta_compositor_add_window (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_add_window (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_show_window (MetaCompositor *compositor,
MetaWindow *window,
MetaCompEffect effect);
@@ -102,6 +101,10 @@ void meta_compositor_unmaximize_window (MetaCompositor *compositor,
MetaRectangle *old_rect,
MetaRectangle *new_rect);
void meta_compositor_window_mapped (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_window_unmapped (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_sync_window_geometry (MetaCompositor *compositor,
MetaWindow *window,
gboolean did_placement);

View File

@@ -60,11 +60,8 @@ struct _MetaWindowActor
GType meta_window_actor_get_type (void);
Window meta_window_actor_get_x_window (MetaWindowActor *self);
gint meta_window_actor_get_workspace (MetaWindowActor *self);
MetaWindow * meta_window_actor_get_meta_window (MetaWindowActor *self);
ClutterActor * meta_window_actor_get_texture (MetaWindowActor *self);
gboolean meta_window_actor_is_override_redirect (MetaWindowActor *self);
gboolean meta_window_actor_showing_on_its_workspace (MetaWindowActor *self);
gboolean meta_window_actor_is_destroyed (MetaWindowActor *self);
#endif /* META_WINDOW_ACTOR_H */

View File

@@ -154,7 +154,6 @@ void meta_window_change_workspace_by_index (MetaWindow *window,
void meta_window_change_workspace (MetaWindow *window,
MetaWorkspace *workspace);
GObject *meta_window_get_compositor_private (MetaWindow *window);
void meta_window_set_compositor_private (MetaWindow *window, GObject *priv);
void meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event);
const char *meta_window_get_role (MetaWindow *window);
MetaStackLayer meta_window_get_layer (MetaWindow *window);