[gnome-shell] [ShellGtkEmbed] do a better job of tracking the actor's position
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] [ShellGtkEmbed] do a better job of tracking the actor's position
- Date: Thu, 23 Sep 2010 13:57:56 +0000 (UTC)
commit 63f206613564297867d0294a6e1cce8f5ca25448
Author: Dan Winship <danw gnome org>
Date: Fri Aug 6 12:43:54 2010 -0400
[ShellGtkEmbed] do a better job of tracking the actor's position
Previously the code to keep the X window aligned with its actor made
various assumptions that were true in the panel status tray area but
that are not true in the message tray. Fix it up by repositioning the
X window at clutter_actor_paint() time, which will definitely be
called every time the actor moves, whether it's because of its own or
its parent/ancestor's changes.
https://bugzilla.gnome.org/show_bug.cgi?id=608869
src/shell-embedded-window.c | 6 ++++++
src/shell-gtk-embed.c | 25 +++++++++++++++----------
2 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/src/shell-embedded-window.c b/src/shell-embedded-window.c
index ce084fb..8da3f14 100644
--- a/src/shell-embedded-window.c
+++ b/src/shell-embedded-window.c
@@ -223,6 +223,12 @@ _shell_embedded_window_allocate (ShellEmbeddedWindow *window,
g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window));
+ if (window->priv->position.x == x &&
+ window->priv->position.y == y &&
+ window->priv->position.width == width &&
+ window->priv->position.height == height)
+ return;
+
window->priv->position.x = x;
window->priv->position.y = y;
window->priv->position.width = width;
diff --git a/src/shell-gtk-embed.c b/src/shell-gtk-embed.c
index 2c159ae..7d47535 100644
--- a/src/shell-gtk-embed.c
+++ b/src/shell-gtk-embed.c
@@ -167,19 +167,25 @@ shell_gtk_embed_get_preferred_height (ClutterActor *actor,
}
static void
-shell_gtk_embed_allocate (ClutterActor *actor,
- const ClutterActorBox *box,
- ClutterAllocationFlags flags)
+shell_gtk_embed_paint (ClutterActor *actor)
{
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
float wx = 0.0, wy = 0.0, x, y, ax, ay;
+ float w, h;
- CLUTTER_ACTOR_CLASS (shell_gtk_embed_parent_class)->
- allocate (actor, box, flags);
+ CLUTTER_ACTOR_CLASS (shell_gtk_embed_parent_class)->paint (actor);
- /* Find the actor's new coordinates in terms of the stage (which is
- * priv->window's parent window.
+ if (!embed->priv->window)
+ return;
+
+ /* Move the X window to the same position as the actor; it's much
+ * easier to just do this from paint() than it is to tray to track
+ * the position and allocation of @embed and each of its ancestors
+ * as they change. We don't use get_transformed_position() here
+ * because we know that the icon isn't scaled or rotated, and so
+ * it's faster to avoid the floating-point transformations.
*/
+ clutter_actor_get_size (actor, &w, &h);
while (actor)
{
clutter_actor_get_position (actor, &x, &y);
@@ -193,8 +199,7 @@ shell_gtk_embed_allocate (ClutterActor *actor,
_shell_embedded_window_allocate (embed->priv->window,
(int)(0.5 + wx), (int)(0.5 + wy),
- box->x2 - box->x1,
- box->y2 - box->y1);
+ w, h);
}
static void
@@ -241,7 +246,7 @@ shell_gtk_embed_class_init (ShellGtkEmbedClass *klass)
actor_class->get_preferred_width = shell_gtk_embed_get_preferred_width;
actor_class->get_preferred_height = shell_gtk_embed_get_preferred_height;
- actor_class->allocate = shell_gtk_embed_allocate;
+ actor_class->paint = shell_gtk_embed_paint;
actor_class->realize = shell_gtk_embed_realize;
actor_class->unrealize = shell_gtk_embed_unrealize;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]