gnome-panel r11452 - trunk/gnome-panel
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11452 - trunk/gnome-panel
- Date: Tue, 20 Jan 2009 11:52:40 +0000 (UTC)
Author: vuntz
Date: Tue Jan 20 11:52:40 2009
New Revision: 11452
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11452&view=rev
Log:
2009-01-20 Vincent Untz <vuntz gnome org>
Correctly set the struts before and during the initial toplevel
animation, so that desktop icons don't jump.
Part of bug #554343.
Loosely based on some code by Ray Strode <rstrode redhat com>
* panel-toplevel.c: (panel_toplevel_update_struts): if we're still
doing the initial animation, then we're really only interested in the
end of animation coordinates for the struts. Also fix a typo in code
that might have weird side-effects on multiscreen.
(panel_toplevel_update_auto_hide_position): if we're looking for the
end position of animation, then get the real auto-hide size. It's
useful for the initial animation where the position is hidden (and
therefore, we don't get the real auto-hide size).
(panel_toplevel_update_animating_position): mark the initial animation
as done.
(panel_toplevel_update_position): trivial update
(panel_toplevel_update_geometry): cleanup
(panel_toplevel_initially_hide): don't set the struts here, it's
useless
(panel_toplevel_calculate_animation_end_geometry): new, split from
panel_toplevel_start_animation() so that it can be used elsewhere.
Also, a toplevel that is in its initial animation (but not a
auto-hiding toplevel) should have its end position computed as its
normal position
(panel_toplevel_start_animation): some trivial update
(panel_toplevel_auto_unhide_timeout_handler): remove
initial_animation_done = TRUE here, since it's not what we want and
makes things ugly.
Modified:
trunk/gnome-panel/ChangeLog
trunk/gnome-panel/panel-toplevel.c
Modified: trunk/gnome-panel/panel-toplevel.c
==============================================================================
--- trunk/gnome-panel/panel-toplevel.c (original)
+++ trunk/gnome-panel/panel-toplevel.c Tue Jan 20 11:52:40 2009
@@ -231,6 +231,8 @@
static guint toplevel_signals [LAST_SIGNAL] = { 0 };
static GSList *toplevel_list = NULL;
+static void panel_toplevel_calculate_animation_end_geometry (PanelToplevel *toplevel);
+
GSList *
panel_toplevel_list_toplevels (void)
{
@@ -1391,6 +1393,14 @@
return FALSE;
}
+ /* In the case of the initial animation, we really want the struts to
+ * represent what is at the end of the animation, to avoid desktop
+ * icons jumping around. */
+ if (!toplevel->priv->initial_animation_done) {
+ panel_toplevel_calculate_animation_end_geometry (toplevel);
+ end_of_animation = TRUE;
+ }
+
screen = panel_toplevel_get_monitor_geometry (toplevel,
&monitor_x,
&monitor_y,
@@ -1401,7 +1411,7 @@
x = toplevel->priv->animation_end_x;
y = toplevel->priv->animation_end_y;
x += panel_multiscreen_x (screen, toplevel->priv->monitor);
- x += panel_multiscreen_y (screen, toplevel->priv->monitor);
+ y += panel_multiscreen_y (screen, toplevel->priv->monitor);
if (toplevel->priv->animation_end_width != -1)
width = toplevel->priv->animation_end_width;
else
@@ -1446,7 +1456,6 @@
if (strut > 0) {
strut_start = MAX (y, monitor_y);
strut_end = MIN (y + height, monitor_y + monitor_height) - 1;
-
}
}
@@ -1806,7 +1815,8 @@
int *x,
int *y,
int *w,
- int *h)
+ int *h,
+ gboolean for_end_position)
{
int width, height;
int monitor_width, monitor_height;
@@ -1827,10 +1837,13 @@
height = toplevel->priv->original_height;
snap_tolerance = toplevel->priv->snap_tolerance;
- if (toplevel->priv->initial_animation_done) {
+ /* For the initial animation, we animate from outside the screen, and
+ * so we don't want the toplevel to be visible at all. But when the
+ * request is for the end position, then we give the real result (it's
+ * useful for struts) */
+ if (for_end_position || toplevel->priv->initial_animation_done) {
auto_hide_size = panel_toplevel_get_effective_auto_hide_size (toplevel);
} else {
- /* when loading, we animate from outside the screen */
auto_hide_size = 0;
}
@@ -2029,6 +2042,10 @@
if (toplevel->priv->geometry.x - monitor_offset_x == toplevel->priv->animation_end_x &&
toplevel->priv->geometry.y - monitor_offset_y == toplevel->priv->animation_end_y) {
toplevel->priv->animating = FALSE;
+ /* Note: it's important to set initial_animation_done to TRUE
+ * as soon as possible (hence, here) since we don't want to
+ * have a wrong value in a size request event */
+ toplevel->priv->initial_animation_done = TRUE;
if (toplevel->priv->attached && panel_toplevel_get_is_hidden (toplevel))
gtk_widget_unmap (GTK_WIDGET (toplevel));
@@ -2211,7 +2228,7 @@
panel_toplevel_update_normal_position (toplevel, &x, &y, &w, &h);
else if (toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN)
- panel_toplevel_update_auto_hide_position (toplevel, &x, &y, &w, &h);
+ panel_toplevel_update_auto_hide_position (toplevel, &x, &y, &w, &h, FALSE);
else
panel_toplevel_update_hidden_position (toplevel, &x, &y, &w, &h);
@@ -2500,6 +2517,7 @@
panel_toplevel_update_position (toplevel);
panel_toplevel_update_struts (toplevel, FALSE);
+
if (toplevel->priv->state == PANEL_STATE_NORMAL ||
toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN) {
panel_struts_update_toplevel_geometry (toplevel,
@@ -2911,10 +2929,6 @@
* used */
toplevel->priv->state = PANEL_STATE_AUTO_HIDDEN;
gtk_widget_queue_resize (GTK_WIDGET (toplevel));
-
- /* We still want to have the struts ready at the beginning to
- * avoid desktop icons moving around */
- panel_toplevel_update_struts (toplevel, FALSE);
} else
toplevel->priv->initial_animation_done = TRUE;
}
@@ -3349,22 +3363,19 @@
}
static void
-panel_toplevel_start_animation (PanelToplevel *toplevel)
+panel_toplevel_calculate_animation_end_geometry (PanelToplevel *toplevel)
{
GdkScreen *screen;
int monitor_width, monitor_height;
- int deltax, deltay, deltaw = 0, deltah = 0;
- int cur_x = -1, cur_y = -1;
- long t;
-
- screen = panel_toplevel_get_monitor_geometry (
- toplevel, NULL, NULL, &monitor_width, &monitor_height);
toplevel->priv->animation_end_x = toplevel->priv->x;
toplevel->priv->animation_end_y = toplevel->priv->y;
toplevel->priv->animation_end_width = -1;
toplevel->priv->animation_end_height = -1;
+ screen = panel_toplevel_get_monitor_geometry (
+ toplevel, NULL, NULL, &monitor_width, &monitor_height);
+
if (!toplevel->priv->expand) {
if (toplevel->priv->x_centered)
@@ -3375,7 +3386,11 @@
(monitor_height - toplevel->priv->geometry.height) / 2;
}
- if (toplevel->priv->state == PANEL_STATE_NORMAL)
+ /* we consider the toplevels which are in the initial animation stage
+ * as in a normal state */
+ if (toplevel->priv->state == PANEL_STATE_NORMAL ||
+ (!toplevel->priv->initial_animation_done &&
+ !toplevel->priv->auto_hide))
panel_toplevel_update_normal_position (toplevel,
&toplevel->priv->animation_end_x,
&toplevel->priv->animation_end_y,
@@ -3387,13 +3402,25 @@
&toplevel->priv->animation_end_x,
&toplevel->priv->animation_end_y,
&toplevel->priv->animation_end_width,
- &toplevel->priv->animation_end_height);
+ &toplevel->priv->animation_end_height,
+ TRUE);
else
panel_toplevel_update_hidden_position (toplevel,
&toplevel->priv->animation_end_x,
&toplevel->priv->animation_end_y,
&toplevel->priv->animation_end_width,
&toplevel->priv->animation_end_height);
+}
+
+static void
+panel_toplevel_start_animation (PanelToplevel *toplevel)
+{
+ GdkScreen *screen;
+ int deltax, deltay, deltaw = 0, deltah = 0;
+ int cur_x = -1, cur_y = -1;
+ long t;
+
+ panel_toplevel_calculate_animation_end_geometry (toplevel);
toplevel->priv->animating = TRUE;
@@ -3407,6 +3434,8 @@
gdk_window_get_origin (GTK_WIDGET (toplevel)->window, &cur_x, &cur_y);
+ screen = gtk_widget_get_screen (GTK_WIDGET (toplevel));
+
cur_x -= panel_multiscreen_x (screen, toplevel->priv->monitor);
cur_y -= panel_multiscreen_y (screen, toplevel->priv->monitor);
@@ -3580,7 +3609,6 @@
toplevel->priv->auto_hide) {
toplevel->priv->unhide_timeout = 0;
panel_toplevel_unhide (toplevel);
- toplevel->priv->initial_animation_done = TRUE;
panel_toplevel_hide (toplevel, TRUE, -1);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]