Index: panel-profile.c
===================================================================
--- panel-profile.c	(révision 10470)
+++ panel-profile.c	(copie de travail)
@@ -44,8 +44,10 @@ typedef struct {
 	int              monitor;
 	int              size;
 	int              x;
+	int              x_right;
 	gboolean         x_centered;
 	int              y;
+	int              y_bottom;
 	gboolean         y_centered;
 	PanelOrientation orientation;
 
@@ -53,8 +55,10 @@ typedef struct {
 	guint monitor_changed : 1;
 	guint size_changed : 1;
 	guint x_changed : 1;
+	guint x_right_changed : 1;
 	guint x_centered_changed : 1;
 	guint y_changed : 1;
+	guint y_bottom_changed : 1;
 	guint y_centered_changed : 1;
 	guint orientation_changed : 1;
 } ToplevelLocationChange;
@@ -934,6 +938,12 @@ panel_profile_queue_toplevel_location_ch
 				panel_profile_get_toplevel_key (toplevel, "x"),
 				change->x);
 
+		if (change->x_right_changed)
+			gconf_change_set_set_int (
+				queued_changes,
+				panel_profile_get_toplevel_key (toplevel, "x_right"),
+				change->x_right);
+
 		if (change->x_centered_changed)
 			gconf_change_set_set_bool (
 				queued_changes,
@@ -946,6 +956,12 @@ panel_profile_queue_toplevel_location_ch
 				panel_profile_get_toplevel_key (toplevel, "y"),
 				change->y);
 
+		if (change->y_bottom_changed)
+			gconf_change_set_set_int (
+				queued_changes,
+				panel_profile_get_toplevel_key (toplevel, "y_bottom"),
+				change->y_bottom);
+
 		if (change->y_centered_changed)
 			gconf_change_set_set_bool (
 				queued_changes,
@@ -984,15 +1000,19 @@ TOPLEVEL_LOCATION_CHANGED_HANDLER(y_cent
 	panel_profile_toplevel_##c##_changed (PanelToplevel *toplevel)            \
 	{                                                                         \
 		ToplevelLocationChange change = { NULL };                           \
-		int                    x, y;                                      \
+		int                    x, y, x_right, y_bottom;                   \
 		change.c##_changed = TRUE;                                        \
-		panel_toplevel_get_position (toplevel, &x, &y);                   \
+		panel_toplevel_get_position (toplevel,                            \
+					     &x, &x_right,                        \
+					     &y, &y_bottom);                      \
 		change.c = c;                                                     \
 		panel_profile_queue_toplevel_location_change (toplevel, &change); \
 	}
 
 TOPLEVEL_POSITION_CHANGED_HANDLER(x)
+TOPLEVEL_POSITION_CHANGED_HANDLER(x_right)
 TOPLEVEL_POSITION_CHANGED_HANDLER(y)
+TOPLEVEL_POSITION_CHANGED_HANDLER(y_bottom)
 
 static void
 panel_profile_toplevel_screen_changed (PanelToplevel *toplevel)
@@ -1016,10 +1036,14 @@ panel_profile_connect_to_toplevel (Panel
 			  G_CALLBACK (panel_profile_toplevel_size_changed), NULL);
 	g_signal_connect (toplevel, "notify::x",
 			  G_CALLBACK (panel_profile_toplevel_x_changed), NULL);
+	g_signal_connect (toplevel, "notify::x-right",
+			  G_CALLBACK (panel_profile_toplevel_x_right_changed), NULL);
 	g_signal_connect (toplevel, "notify::x-centered",
 			  G_CALLBACK (panel_profile_toplevel_x_centered_changed), NULL);
 	g_signal_connect (toplevel, "notify::y",
 			  G_CALLBACK (panel_profile_toplevel_y_changed), NULL);
+	g_signal_connect (toplevel, "notify::y-bottom",
+			  G_CALLBACK (panel_profile_toplevel_y_bottom_changed), NULL);
 	g_signal_connect (toplevel, "notify::y-centered",
 			  G_CALLBACK (panel_profile_toplevel_y_centered_changed), NULL);
 	g_signal_connect (toplevel, "notify::orientation",
@@ -1095,22 +1119,42 @@ panel_profile_toplevel_change_notify (GC
 							gconf_value_get_bool (value));  \
 		}
 
-#define UPDATE_POS(k, n)                                                                \
+#define UPDATE_POS(k, n, n2)                                                            \
 		if (!strcmp (key, k)) {                                                 \
-			if (value->type == GCONF_VALUE_INT)                             \
+			if (value->type == GCONF_VALUE_INT) {                           \
+				int x, x_right, y, y_bottom;                            \
+				panel_toplevel_get_position (toplevel, &x, &x_right,    \
+							     &y, &y_bottom);            \
 				panel_toplevel_set_##n (                                \
 					toplevel,                                       \
 					gconf_value_get_int (value),                    \
+					n2,                                             \
 					panel_toplevel_get_##n##_centered (toplevel));  \
+			}                                                               \
 		}
 
-#define UPDATE_CENTERED(k, n)                                                           \
+#define UPDATE_POS2(k, n, n2)                                                           \
+		if (!strcmp (key, k)) {                                                 \
+			if (value->type == GCONF_VALUE_INT) {                           \
+				int x, x_right, y, y_bottom;                            \
+				panel_toplevel_get_position (toplevel, &x, &x_right,    \
+							     &y, &y_bottom);            \
+				panel_toplevel_set_##n (                                \
+					toplevel,                                       \
+					n,                                              \
+					gconf_value_get_int (value),                    \
+					panel_toplevel_get_##n##_centered (toplevel));  \
+			}                                                               \
+		}
+
+#define UPDATE_CENTERED(k, n, n2)                                                       \
 		if (!strcmp (key, k)) {                                                 \
 			if (value->type == GCONF_VALUE_BOOL) {                          \
-				int x, y;                                               \
-				panel_toplevel_get_position (toplevel, &x, &y);         \
+				int x, x_right, y, y_bottom;                            \
+				panel_toplevel_get_position (toplevel, &x, &x_right,    \
+							     &y, &y_bottom);            \
 				panel_toplevel_set_##n (                                \
-					toplevel, n, gconf_value_get_bool (value));     \
+					toplevel, n, n2, gconf_value_get_bool (value)); \
 			}                                                               \
 		}
 
@@ -1137,10 +1181,12 @@ panel_profile_toplevel_change_notify (GC
 	else UPDATE_BOOL ("expand", expand)
 	else UPDATE_STRING ("orientation", orientation)
 	else UPDATE_INT ("size", size)
-	else UPDATE_POS ("x", x)
-	else UPDATE_POS ("y", y)
-	else UPDATE_CENTERED ("x_centered", x)
-	else UPDATE_CENTERED ("y_centered", y)
+	else UPDATE_POS ("x", x, x_right)
+	else UPDATE_POS ("y", y, y_bottom)
+	else UPDATE_POS2 ("x_right", x, x_right)
+	else UPDATE_POS2 ("y_bottom", y, y_bottom)
+	else UPDATE_CENTERED ("x_centered", x, x_right)
+	else UPDATE_CENTERED ("y_centered", y, y_bottom)
 	else UPDATE_BOOL ("auto_hide", auto_hide)
 	else UPDATE_BOOL ("enable_animations", animate)
 	else UPDATE_BOOL ("enable_buttons", enable_buttons)
@@ -1665,17 +1711,24 @@ panel_profile_load_toplevel (GConfClient
 	GET_INT ("auto_hide_size", auto_hide_size);
 	GET_STRING ("animation_speed", animation_speed);
 
-#define GET_POSITION(a, c, fn)                                                      \
+#define GET_POSITION(a, b, c, fn)                                                   \
 	{                                                                           \
 		gboolean centered;                                                  \
 		int      position;                                                  \
+		int      position2;                                                 \
 		key = panel_gconf_sprintf ("%s/" c, toplevel_dir);                  \
 		centered = gconf_client_get_bool (client, key, &error);             \
-		error = NULL;                                                       \
-		key = panel_gconf_sprintf ("%s/" a, toplevel_dir);                  \
-		position = gconf_client_get_int (client, key, &error);              \
+		if (!error) {                                                       \
+			key = panel_gconf_sprintf ("%s/" a, toplevel_dir);          \
+			position = gconf_client_get_int (client, key, &error);      \
+		}                                                                   \
+		if (!error) {                                                       \
+			key = panel_gconf_sprintf ("%s/" b, toplevel_dir);          \
+			position2 = gconf_client_get_int (client, key, &error);     \
+		}                                                                   \
 		if (!error)                                                         \
-			panel_toplevel_set_##fn (toplevel, position, centered);     \
+			panel_toplevel_set_##fn (toplevel, position, position2,     \
+						 centered);                         \
 		else {                                                              \
 			g_warning (_("Error reading GConf integer value '%s': %s"), \
 				   key, error->message);                            \
@@ -1683,8 +1736,8 @@ panel_profile_load_toplevel (GConfClient
 		}                                                                   \
 	}
 
-	GET_POSITION ("x", "x_centered", x);
-	GET_POSITION ("y", "y_centered", y);
+	GET_POSITION ("x", "x_right", "x_centered", x);
+	GET_POSITION ("y", "y_bottom", "y_centered", y);
 
 	panel_profile_load_background (toplevel, client, toplevel_dir);
 
@@ -2500,6 +2553,9 @@ panel_profile_can_be_moved_freely (Panel
 	key = panel_profile_get_toplevel_key (toplevel, "x");
 	if (!gconf_client_key_is_writable (client, key, NULL))
 		return FALSE;
+	key = panel_profile_get_toplevel_key (toplevel, "x_right");
+	if (!gconf_client_key_is_writable (client, key, NULL))
+		return FALSE;
 	key = panel_profile_get_toplevel_key (toplevel, "x_centered");
 	if (!gconf_client_key_is_writable (client, key, NULL))
 		return FALSE;
@@ -2507,6 +2563,9 @@ panel_profile_can_be_moved_freely (Panel
 	key = panel_profile_get_toplevel_key (toplevel, "y");
 	if (!gconf_client_key_is_writable (client, key, NULL))
 		return FALSE;
+	key = panel_profile_get_toplevel_key (toplevel, "y_bottom");
+	if (!gconf_client_key_is_writable (client, key, NULL))
+		return FALSE;
 	key = panel_profile_get_toplevel_key (toplevel, "y_centered");
 	if (!gconf_client_key_is_writable (client, key, NULL))
 		return FALSE;
Index: panel-toplevel.c
===================================================================
--- panel-toplevel.c	(révision 10480)
+++ panel-toplevel.c	(copie de travail)
@@ -81,6 +81,9 @@ struct _PanelToplevelPrivate {
 	/* relative to the monitor origin */
 	int                     x;
 	int                     y;
+	/* relative to the bottom right corner, -1 to ignore and use x, y*/
+	int                     x_right;
+	int                     y_bottom;
 
 	int                     monitor;
 
@@ -118,6 +121,8 @@ struct _PanelToplevelPrivate {
 	int                     orig_monitor;
 	int                     orig_x;
 	int                     orig_y;
+	int                     orig_x_right;
+	int                     orig_y_bottom;
 	int                     orig_size;
 	int                     orig_orientation;
 
@@ -200,8 +205,10 @@ enum {
 	PROP_ORIENTATION,
 	PROP_SIZE,
 	PROP_X,
+	PROP_X_RIGHT,
 	PROP_X_CENTERED,
 	PROP_Y,
+	PROP_Y_BOTTOM,
 	PROP_Y_CENTERED,
 	PROP_MONITOR,
 	PROP_AUTOHIDE,
@@ -454,8 +461,10 @@ panel_toplevel_begin_grab_op (PanelTople
 
 	toplevel->priv->orig_monitor     = toplevel->priv->monitor;
 	toplevel->priv->orig_x           = toplevel->priv->x;
+	toplevel->priv->orig_x_right     = toplevel->priv->x_right;
 	toplevel->priv->orig_x_centered  = toplevel->priv->x_centered;
 	toplevel->priv->orig_y           = toplevel->priv->y;
+	toplevel->priv->orig_y_bottom    = toplevel->priv->y_bottom;
 	toplevel->priv->orig_y_centered  = toplevel->priv->y_centered;
 	toplevel->priv->orig_size        = toplevel->priv->size;
 	toplevel->priv->orig_orientation = toplevel->priv->orientation;
@@ -506,9 +515,11 @@ panel_toplevel_cancel_grab_op (PanelTopl
 	panel_toplevel_set_size (toplevel, toplevel->priv->orig_size);
 	panel_toplevel_set_x (toplevel,
 			      toplevel->priv->orig_x,
+			      toplevel->priv->orig_x_right,
 			      toplevel->priv->orig_x_centered);
 	panel_toplevel_set_y (toplevel,
 			      toplevel->priv->orig_y,
+			      toplevel->priv->orig_y_bottom,
 			      toplevel->priv->orig_y_centered);
 }
 
@@ -519,12 +530,15 @@ panel_toplevel_resize_to_pointer (PanelT
 {
 	int new_size;
 	int new_x, new_y;
+	int new_x_right, new_y_bottom;
 	int new_x_centered, new_y_centered;
 	int monitor_width, monitor_height;
 
 	new_size       = toplevel->priv->size;
 	new_x          = toplevel->priv->x;
 	new_y          = toplevel->priv->y;
+	new_x_right    = toplevel->priv->x_right;
+	new_y_bottom   = toplevel->priv->y_bottom;
 	new_x_centered = toplevel->priv->x_centered;
 	new_y_centered = toplevel->priv->y_centered;
 
@@ -533,22 +547,45 @@ panel_toplevel_resize_to_pointer (PanelT
 	switch (toplevel->priv->grab_op) {
 	case PANEL_GRAB_OP_RESIZE_UP:
 		new_size = toplevel->priv->drag_offset_y - y;
+		if (toplevel->priv->y_centered)
+			new_size -= toplevel->priv->drag_offset_y;
 		new_size = CLAMP (new_size, 0, monitor_height / 4);
 		new_y -= (new_size - toplevel->priv->size);
+		if (!toplevel->priv->y_centered && (new_y + new_size / 2) > monitor_height / 2)
+			new_y_bottom = monitor_height - (new_y + new_size);
+		else
+			new_y_bottom = -1;
 		break;
 	case PANEL_GRAB_OP_RESIZE_DOWN:
 		new_size = y - toplevel->priv->drag_offset_y;
+		if (toplevel->priv->y_centered)
+			new_size -= toplevel->priv->drag_offset_y;
 		new_size = CLAMP (new_size, 0, monitor_height / 4);
+		if (!toplevel->priv->y_centered && (new_y + new_size / 2) > monitor_height / 2)
+			new_y_bottom = monitor_height - (new_y + new_size);
+		else
+			new_y_bottom = -1;
 		break;
 	case PANEL_GRAB_OP_RESIZE_LEFT:
 		new_size = toplevel->priv->drag_offset_x - x;
+		if (toplevel->priv->x_centered)
+			new_size -= toplevel->priv->drag_offset_x;
 		new_size = CLAMP (new_size, 0, monitor_width / 4);
 		new_x -= (new_size - toplevel->priv->size);
+		if (!toplevel->priv->x_centered && (new_x + new_size / 2) > monitor_width / 2)
+			new_x_right = monitor_width - (new_x + new_size);
+		else
+			new_x_right = -1;
 		break;
 	case PANEL_GRAB_OP_RESIZE_RIGHT:
 		new_size = x - toplevel->priv->drag_offset_x;
+		if (toplevel->priv->x_centered)
+			new_size -= toplevel->priv->drag_offset_x;
 		new_size = CLAMP (new_size, 0, monitor_width / 4);
-		break;
+		if (!toplevel->priv->x_centered && (new_x + new_size / 2) > monitor_width / 2)
+			new_x_right = monitor_width - (new_x + new_size);
+		else
+			new_x_right = -1;
 		break;
 	default:
 		g_assert_not_reached ();
@@ -558,8 +595,8 @@ panel_toplevel_resize_to_pointer (PanelT
 	if (new_size == 0)
 		return;
 
-	panel_toplevel_set_x (toplevel, new_x, new_x_centered);
-	panel_toplevel_set_y (toplevel, new_y, new_y_centered);
+	panel_toplevel_set_x (toplevel, new_x, new_x_right, new_x_centered);
+	panel_toplevel_set_y (toplevel, new_y, new_y_bottom, new_y_centered);
 	panel_toplevel_set_size (toplevel, new_size);
 }
 
@@ -657,7 +694,7 @@ panel_toplevel_move_to (PanelToplevel *t
 	int               monitor_width, monitor_height;
 	int               width, height;
 	int               new_monitor;
-	int               x, y;
+	int               x, y, x_right, y_bottom;
 	int               snap_tolerance;
 
 	screen = panel_toplevel_get_screen_geometry (
@@ -719,14 +756,24 @@ panel_toplevel_move_to (PanelToplevel *t
 	}
 
 	if (x_centered)
-		x -= (monitor_width  - width) / 2;
+		x = (monitor_width  - width) / 2;
 	if (y_centered)
-		y -= (monitor_height - height) / 2;
+		y = (monitor_height - height) / 2;
+
+	if (!x_centered && (x + width / 2) > monitor_width / 2)
+		x_right = monitor_width - (x + width);
+	else
+		x_right = -1;
+
+	if (!y_centered && (y + height / 2) > monitor_height / 2)
+		y_bottom = monitor_height - (y + height);
+	else
+		y_bottom = -1;
 
 	panel_toplevel_set_monitor (toplevel, new_monitor);
 	panel_toplevel_set_orientation (toplevel, new_orientation);
-	panel_toplevel_set_x (toplevel, x, x_centered);
-	panel_toplevel_set_y (toplevel, y, y_centered);
+	panel_toplevel_set_x (toplevel, x, x_right, x_centered);
+	panel_toplevel_set_y (toplevel, y, y_bottom, y_centered);
 }
 
 static void
@@ -1000,6 +1047,8 @@ panel_toplevel_calc_floating (PanelTople
 {
 	GdkScreen *screen;
 	int        screen_width, screen_height;
+	int        monitor_x, monitor_y;
+	int        monitor_width, monitor_height;
 	int        x, y;
 	int        snap_tolerance;
 
@@ -1011,10 +1060,22 @@ panel_toplevel_calc_floating (PanelTople
 	screen = panel_toplevel_get_screen_geometry (
 			toplevel, &screen_width, &screen_height);
 
-	x = panel_multiscreen_x (screen, toplevel->priv->monitor) + toplevel->priv->x;
-	y = panel_multiscreen_y (screen, toplevel->priv->monitor) + toplevel->priv->y;
+	panel_toplevel_get_monitor_geometry (toplevel, &monitor_x, &monitor_y,
+					     &monitor_width, &monitor_height);
+
+	if (toplevel->priv->x_right == -1)
+		x = monitor_x + toplevel->priv->x;
+	else
+		x = monitor_x + (monitor_width - (toplevel->priv->x_right + toplevel->priv->geometry.width));
+	if (toplevel->priv->y_bottom == -1)
+		y = monitor_y + toplevel->priv->y;
+	else
+		y = monitor_y + (monitor_height - (toplevel->priv->y_bottom + toplevel->priv->geometry.height));
+
 	snap_tolerance = toplevel->priv->snap_tolerance;
 
+	//FIXME? everywhere else, snap_tolerance is relative to the monitor,
+	//not the screen
 	if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK)
 		toplevel->priv->floating =
 			(y > snap_tolerance) && (y < (screen_height - toplevel->priv->geometry.height - snap_tolerance));
@@ -1710,22 +1771,22 @@ panel_toplevel_update_normal_position (P
 	if (*x <= snap_tolerance &&
 	    !toplevel->priv->x_centered) {
 		*x = 0;
-		panel_toplevel_set_x (toplevel, 0, toplevel->priv->x_centered);
+		panel_toplevel_set_x (toplevel, 0, -1, toplevel->priv->x_centered);
 	} else if ((*x + width) >= (monitor_width - snap_tolerance) &&
 		   !toplevel->priv->x_centered) {
 		*x = monitor_width - width;
-		panel_toplevel_set_x (toplevel, monitor_width - width,
+		panel_toplevel_set_x (toplevel, monitor_width - width, 0,
 				      toplevel->priv->x_centered);
 	}
 
 	if (*y <= snap_tolerance &&
 	    !toplevel->priv->y_centered) {
 		*y = 0;
-		panel_toplevel_set_y (toplevel, 0, toplevel->priv->y_centered);
+		panel_toplevel_set_y (toplevel, 0, -1, toplevel->priv->y_centered);
 	} else if ((*y + height) >= (monitor_height - snap_tolerance) &&
 		   !toplevel->priv->y_centered) {
 		*y = monitor_height - height;
-		panel_toplevel_set_y (toplevel, monitor_height - height,
+		panel_toplevel_set_y (toplevel, monitor_height - height, 0,
 				      toplevel->priv->y_centered);
 	}
 }
@@ -1789,25 +1850,25 @@ panel_toplevel_update_auto_hide_position
 		if (*x <= snap_tolerance &&
 		    !toplevel->priv->x_centered) {
 			*x = 0;
-			panel_toplevel_set_x (toplevel, 0,
+			panel_toplevel_set_x (toplevel, 0, -1,
 					      toplevel->priv->x_centered);
 		} else if ((*x + width) >= (monitor_width - snap_tolerance) &&
 			   !toplevel->priv->x_centered) {
 			*x = monitor_width - width;
-			panel_toplevel_set_x (toplevel, monitor_width - width,
+			panel_toplevel_set_x (toplevel, monitor_width - width, 0,
 					      toplevel->priv->x_centered);
 		}
 	} else /* if (toplevel->priv->orientation & PANEL_VERTICAL_MASK) */ {
 		if (*y <= snap_tolerance &&
 		    !toplevel->priv->y_centered) {
 			*y = 0;
-			panel_toplevel_set_y (toplevel, 0,
+			panel_toplevel_set_y (toplevel, 0, -1,
 					      toplevel->priv->y_centered);
 		}
 		else if ((*y + height) >= (monitor_height - snap_tolerance) &&
 			 !toplevel->priv->y_centered) {
 			*y = monitor_height - height;
-			panel_toplevel_set_y (toplevel, monitor_height - height,
+			panel_toplevel_set_y (toplevel, monitor_height - height, 0,
 					      toplevel->priv->y_centered);
 		}
 	}
@@ -1988,22 +2049,23 @@ panel_toplevel_update_expanded_position 
 	int        screen_width, screen_height;
 	int        monitor_x, monitor_y;
 	int        x, y;
+	int        x_right, y_bottom;
 	int        monitor;
 
 	if (!toplevel->priv->expand)
 		return;
 
-	screen = panel_toplevel_get_screen_geometry (
-			toplevel, &screen_width, &screen_height);
-
-	panel_toplevel_get_monitor_geometry (
-		toplevel, NULL, NULL, &monitor_width, &monitor_height);
-
-	monitor_x = panel_multiscreen_x (screen, toplevel->priv->monitor);
-	monitor_y = panel_multiscreen_y (screen, toplevel->priv->monitor);
-
-	x = monitor_x + toplevel->priv->x;
-	y = monitor_y + toplevel->priv->y;
+	screen = panel_toplevel_get_screen_geometry (toplevel,
+						     &screen_width,
+						     &screen_height);
+
+	panel_toplevel_get_monitor_geometry (toplevel, &monitor_x, &monitor_y,
+					     &monitor_width, &monitor_height);
+
+	x = -1;
+	y = -1;
+	x_right = -1;
+	y_bottom = -1;
 
 	switch (toplevel->priv->orientation) {
 	case PANEL_ORIENTATION_TOP:
@@ -2017,10 +2079,12 @@ panel_toplevel_update_expanded_position 
 	case PANEL_ORIENTATION_BOTTOM:
 		x = monitor_x;
 		y = monitor_y + monitor_height - toplevel->priv->geometry.height;
+		y_bottom = 0;
 		break;
 	case PANEL_ORIENTATION_RIGHT:
 		x = monitor_x + monitor_width - toplevel->priv->geometry.width;
 		y = monitor_y;
+		x_right = 0;
 		break;
 	default:
 		g_assert_not_reached ();
@@ -2046,6 +2110,16 @@ panel_toplevel_update_expanded_position 
 		g_object_notify (G_OBJECT (toplevel), "y");
 	}
 
+	if (toplevel->priv->x_right != x_right) {
+		toplevel->priv->x_right = x_right;
+		g_object_notify (G_OBJECT (toplevel), "x_right");
+	}
+
+	if (toplevel->priv->y_bottom != y_bottom) {
+		toplevel->priv->y_bottom = y_bottom;
+		g_object_notify (G_OBJECT (toplevel), "y_bottom");
+	}
+
 	g_object_thaw_notify (G_OBJECT (toplevel));
 }
 
@@ -2077,13 +2151,37 @@ panel_toplevel_update_position (PanelTop
 		g_object_freeze_notify (G_OBJECT (toplevel));
 
 		if (!toplevel->priv->x_centered) {
+			int x_right;
+
 			toplevel->priv->x -= toplevel->priv->geometry.width  / 2;
 			g_object_notify (G_OBJECT (toplevel), "x");
+
+			if ((toplevel->priv->x + toplevel->priv->geometry.width / 2) > monitor_width / 2)
+				x_right = monitor_width - (toplevel->priv->x + toplevel->priv->geometry.width);
+			else
+				x_right = -1;
+			if (toplevel->priv->x_right != x_right) {
+				toplevel->priv->x_right = x_right;
+				g_object_notify (G_OBJECT (toplevel),
+						 "x-right");
+			}
 		}
 
 		if (!toplevel->priv->y_centered) {
+			int y_bottom;
+
 			toplevel->priv->y -= toplevel->priv->geometry.height / 2;
 			g_object_notify (G_OBJECT (toplevel), "y");
+
+			if ((toplevel->priv->y + toplevel->priv->geometry.height / 2) > monitor_height / 2)
+				y_bottom = monitor_height - (toplevel->priv->y + toplevel->priv->geometry.height);
+			else
+				y_bottom = -1;
+			if (toplevel->priv->y_bottom != y_bottom) {
+				toplevel->priv->y_bottom = y_bottom;
+				g_object_notify (G_OBJECT (toplevel),
+						 "y-bottom");
+			}
 		}
 
 		g_object_thaw_notify (G_OBJECT (toplevel));
@@ -2092,8 +2190,14 @@ panel_toplevel_update_position (PanelTop
 	panel_toplevel_update_expanded_position (toplevel);
 	panel_toplevel_calc_floating (toplevel); //FIXME should probably be done after panel_toplevel_update_normal_position() too
 
-	x = toplevel->priv->x;
-	y = toplevel->priv->y;
+	if (toplevel->priv->x_right == -1)
+		x = toplevel->priv->x;
+	else
+		x = monitor_width - (toplevel->priv->x_right + toplevel->priv->geometry.width);
+	if (toplevel->priv->y_bottom == -1)
+		y = toplevel->priv->y;
+	else
+		y = monitor_height - (toplevel->priv->y_bottom + toplevel->priv->geometry.height);
 
 	if (!toplevel->priv->expand) {
 		if (toplevel->priv->x_centered)
@@ -3665,21 +3769,37 @@ panel_toplevel_set_property (GObject    
 	case PROP_X:
 		panel_toplevel_set_x (toplevel,
 				      g_value_get_int (value),
+				      toplevel->priv->x_right,
+				      toplevel->priv->x_centered);
+		break;
+	case PROP_X_RIGHT:
+		panel_toplevel_set_x (toplevel,
+				      toplevel->priv->x,
+				      g_value_get_int (value),
 				      toplevel->priv->x_centered);
 		break;
 	case PROP_X_CENTERED:
 		panel_toplevel_set_x (toplevel,
 				      toplevel->priv->x,
+				      toplevel->priv->x_right,
 				      g_value_get_boolean (value));
 		break;
 	case PROP_Y:
 		panel_toplevel_set_y (toplevel,
 				      g_value_get_int (value),
+				      toplevel->priv->y_bottom,
+				      toplevel->priv->y_centered);
+		break;
+	case PROP_Y_BOTTOM:
+		panel_toplevel_set_y (toplevel,
+				      toplevel->priv->y,
+				      g_value_get_int (value),
 				      toplevel->priv->y_centered);
 		break;
 	case PROP_Y_CENTERED:
 		panel_toplevel_set_y (toplevel,
 				      toplevel->priv->y,
+				      toplevel->priv->y_bottom,
 				      g_value_get_boolean (value));
 		break;
 	case PROP_MONITOR:
@@ -3743,12 +3863,18 @@ panel_toplevel_get_property (GObject    
 	case PROP_X:
 		g_value_set_int (value, toplevel->priv->x);
 		break;
+	case PROP_X_RIGHT:
+		g_value_set_int (value, toplevel->priv->x_right);
+		break;
 	case PROP_X_CENTERED:
 		g_value_set_boolean (value, toplevel->priv->x_centered);
 		break;
 	case PROP_Y:
 		g_value_set_int (value, toplevel->priv->y);
 		break;
+	case PROP_Y_BOTTOM:
+		g_value_set_int (value, toplevel->priv->y_bottom);
+		break;
 	case PROP_Y_CENTERED:
 		g_value_set_boolean (value, toplevel->priv->y_centered);
 		break;
@@ -3926,6 +4052,18 @@ panel_toplevel_class_init (PanelToplevel
 
 	g_object_class_install_property (
 		gobject_class,
+		PROP_X_RIGHT,
+		g_param_spec_int (
+			"x-right",
+			"X position, from the right",
+			"The X position of the panel, starting from the right of the screen",
+			-1,
+			G_MAXINT,
+			-1,
+			G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+	g_object_class_install_property (
+		gobject_class,
 		PROP_X_CENTERED,
 		g_param_spec_boolean (
 			"x-centered",
@@ -3948,6 +4086,18 @@ panel_toplevel_class_init (PanelToplevel
 
 	g_object_class_install_property (
 		gobject_class,
+		PROP_Y_BOTTOM,
+		g_param_spec_int (
+			"y_bottom",
+			"Y position, from the bottom",
+			"The Y position of the panel, starting from the bottom of the screen",
+			-1,
+			G_MAXINT,
+			-1,
+			G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+	g_object_class_install_property (
+		gobject_class,
 		PROP_Y_CENTERED,
 		g_param_spec_boolean (
 			"y-centered",
@@ -4238,6 +4388,8 @@ panel_toplevel_init (PanelToplevel *topl
 	toplevel->priv->size            = DEFAULT_SIZE;
 	toplevel->priv->x               = 0;
 	toplevel->priv->y               = 0;
+	toplevel->priv->x_right         = -1;
+	toplevel->priv->y_bottom        = -1;
 	toplevel->priv->monitor         = 0;
 	toplevel->priv->hide_delay      = DEFAULT_HIDE_DELAY;
 	toplevel->priv->unhide_delay    = DEFAULT_UNHIDE_DELAY;
@@ -4407,10 +4559,23 @@ panel_toplevel_set_expand (PanelToplevel
 	toplevel->priv->expand = expand;
 
 	if (!toplevel->priv->expand) {
-		if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK)
-			panel_toplevel_set_x (toplevel, 0, TRUE);
-		else
-			panel_toplevel_set_y (toplevel, 0, TRUE);
+		switch (toplevel->priv->orientation) {
+		case PANEL_ORIENTATION_TOP:
+			panel_toplevel_set_x (toplevel, 0, -1, TRUE);
+			break;
+		case PANEL_ORIENTATION_BOTTOM:
+			panel_toplevel_set_x (toplevel, 0, 0, TRUE);
+			break;
+		case PANEL_ORIENTATION_LEFT:
+			panel_toplevel_set_y (toplevel, 0, -1, TRUE);
+			break;
+		case PANEL_ORIENTATION_RIGHT:
+			panel_toplevel_set_y (toplevel, 0, 0, TRUE);
+			break;
+		default:
+			g_assert_not_reached ();
+			break;
+		}
 	}
 
 	gtk_widget_queue_resize (GTK_WIDGET (toplevel));
@@ -4458,17 +4623,27 @@ panel_toplevel_set_orientation (PanelTop
 	if (toplevel->priv->x_centered &&
 	    (orientation & PANEL_VERTICAL_MASK)) {
 		toplevel->priv->x_centered = FALSE;
-		toplevel->priv->x += (monitor_width - toplevel->priv->geometry.width) / 2;
+		toplevel->priv->x = (monitor_width - toplevel->priv->geometry.width) / 2;
 		g_object_notify (G_OBJECT (toplevel), "x");
 		g_object_notify (G_OBJECT (toplevel), "x-centered");
+
+		if (toplevel->priv->x_right != -1) {
+			toplevel->priv->x_right = -1;
+			g_object_notify (G_OBJECT (toplevel), "x-right");
+		}
 	}
 
 	if (toplevel->priv->y_centered &&
 	    (orientation & PANEL_HORIZONTAL_MASK)) {
 		toplevel->priv->y_centered = FALSE;
-		toplevel->priv->y += (monitor_height - toplevel->priv->geometry.height) / 2;
+		toplevel->priv->y = (monitor_height - toplevel->priv->geometry.height) / 2;
 		g_object_notify (G_OBJECT (toplevel), "y");
 		g_object_notify (G_OBJECT (toplevel), "y-centered");
+
+		if (toplevel->priv->y_bottom != -1) {
+			toplevel->priv->y_bottom = -1;
+			g_object_notify (G_OBJECT (toplevel), "y-bottom");
+		}
 	}
 
 	rotate = FALSE;
@@ -4484,6 +4659,9 @@ panel_toplevel_set_orientation (PanelTop
 	    toplevel->priv->updated_geometry_initial) {
 		toplevel->priv->position_centered = TRUE;
 
+		/* x, y temporary refer to the panel center, so we don't care
+		 * about x_right, y_bottom. Those will get updated in
+		 * panel_toplevel_update_position() accordingly. */
 		if (!toplevel->priv->x_centered) {
 			toplevel->priv->x += toplevel->priv->geometry.width  / 2;
 			g_object_notify (G_OBJECT (toplevel), "x");
@@ -4599,6 +4777,7 @@ panel_toplevel_get_auto_hide_size (Panel
 void
 panel_toplevel_set_x (PanelToplevel *toplevel,
 		      int            x,
+		      int            x_right,
 		      gboolean       x_centered)
 {
 	gboolean changed = FALSE;
@@ -4615,6 +4794,12 @@ panel_toplevel_set_x (PanelToplevel *top
 		g_object_notify (G_OBJECT (toplevel), "x");
 	}
 
+	if (toplevel->priv->x_right != x_right) {
+		toplevel->priv->x_right = x_right;
+		changed = TRUE;
+		g_object_notify (G_OBJECT (toplevel), "x-right");
+	}
+
 	if (toplevel->priv->x_centered != x_centered) {
 		toplevel->priv->x_centered = x_centered;
 		changed = TRUE;
@@ -4630,6 +4815,7 @@ panel_toplevel_set_x (PanelToplevel *top
 void
 panel_toplevel_set_y (PanelToplevel *toplevel,
 		      int            y,
+		      int            y_bottom,
 		      gboolean       y_centered)
 {
 	gboolean changed = FALSE;
@@ -4646,6 +4832,12 @@ panel_toplevel_set_y (PanelToplevel *top
 		g_object_notify (G_OBJECT (toplevel), "y");
 	}
 
+	if (toplevel->priv->y_bottom != y_bottom) {
+		toplevel->priv->y_bottom = y_bottom;
+		changed = TRUE;
+		g_object_notify (G_OBJECT (toplevel), "y-bottom");
+	}
+
 	if (toplevel->priv->y_centered != y_centered) {
 		toplevel->priv->y_centered = y_centered;
 		changed = TRUE;
@@ -4661,7 +4853,9 @@ panel_toplevel_set_y (PanelToplevel *top
 void
 panel_toplevel_get_position (PanelToplevel *toplevel,
 			     int           *x,
-			     int           *y)
+			     int           *x_right,
+			     int           *y,
+			     int           *y_bottom)
 {
 	g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel));
 
@@ -4670,6 +4864,12 @@ panel_toplevel_get_position (PanelToplev
 
 	if (y)
 		*y = toplevel->priv->y;
+
+	if (x_right)
+		*x_right = toplevel->priv->x_right;
+
+	if (y_bottom)
+		*y_bottom = toplevel->priv->y_bottom;
 }
 
 gboolean
Index: panel-toplevel.h
===================================================================
--- panel-toplevel.h	(révision 10470)
+++ panel-toplevel.h	(copie de travail)
@@ -97,13 +97,17 @@ void                 panel_toplevel_set_
 int                  panel_toplevel_get_auto_hide_size     (PanelToplevel       *toplevel);
 void                 panel_toplevel_set_x                  (PanelToplevel       *toplevel,
 							    int                  x,
+							    int                  x_right,
 							    gboolean             x_centered);
 void                 panel_toplevel_set_y                  (PanelToplevel       *toplevel,
 							    int                  y,
+							    int                  y_bottom,
 							    gboolean             y_centered);
 void                 panel_toplevel_get_position           (PanelToplevel       *toplevel,
 							    int                 *x,
-							    int                 *y);
+							    int                 *x_right,
+							    int                 *y,
+							    int                 *y_bottom);
 gboolean             panel_toplevel_get_x_centered         (PanelToplevel       *toplevel);
 gboolean             panel_toplevel_get_y_centered         (PanelToplevel       *toplevel);
 void                 panel_toplevel_set_monitor            (PanelToplevel       *toplevel,
Index: panel-default-setup.entries
===================================================================
--- panel-default-setup.entries	(révision 10470)
+++ panel-default-setup.entries	(copie de travail)
@@ -100,6 +100,8 @@
     <entry><key>toplevels/top_panel/monitor</key><schema_key>/schemas/apps/panel/toplevels/monitor</schema_key></entry>
     <entry><key>toplevels/top_panel/x</key><schema_key>/schemas/apps/panel/toplevels/x</schema_key></entry>
     <entry><key>toplevels/top_panel/y</key><schema_key>/schemas/apps/panel/toplevels/y</schema_key></entry>
+    <entry><key>toplevels/top_panel/x_right</key><schema_key>/schemas/apps/panel/toplevels/x_right</schema_key></entry>
+    <entry><key>toplevels/top_panel/y_bottom</key><schema_key>/schemas/apps/panel/toplevels/y_bottom</schema_key></entry>
     <entry><key>toplevels/top_panel/x_centered</key><schema_key>/schemas/apps/panel/toplevels/x_centered</schema_key></entry>
     <entry><key>toplevels/top_panel/y_centered</key><schema_key>/schemas/apps/panel/toplevels/y_centered</schema_key></entry>
     <entry><key>toplevels/top_panel/auto_hide</key><schema_key>/schemas/apps/panel/toplevels/auto_hide</schema_key></entry>
@@ -140,12 +142,20 @@
         <int>24</int>
       </value>
     </entry>
+    <entry>
+      <key>toplevels/top_panel/y_bottom</key>
+      <schema_key>/schemas/apps/panel/toplevels/y_bottom</schema_key>
+      <value>
+        <int>0</int>
+      </value>
+    </entry>
 
     <entry><key>toplevels/bottom_panel/name</key><schema_key>/schemas/apps/panel/toplevels/name</schema_key></entry>
     <entry><key>toplevels/bottom_panel/screen</key><schema_key>/schemas/apps/panel/toplevels/screen</schema_key></entry>
     <entry><key>toplevels/bottom_panel/monitor</key><schema_key>/schemas/apps/panel/toplevels/monitor</schema_key></entry>
     <entry><key>toplevels/bottom_panel/x</key><schema_key>/schemas/apps/panel/toplevels/x</schema_key></entry>
     <entry><key>toplevels/bottom_panel/y</key><schema_key>/schemas/apps/panel/toplevels/y</schema_key></entry>
+    <entry><key>toplevels/top_panel/x_right</key><schema_key>/schemas/apps/panel/toplevels/x_right</schema_key></entry>
     <entry><key>toplevels/bottom_panel/x_centered</key><schema_key>/schemas/apps/panel/toplevels/x_centered</schema_key></entry>
     <entry><key>toplevels/bottom_panel/y_centered</key><schema_key>/schemas/apps/panel/toplevels/y_centered</schema_key></entry>
     <entry><key>toplevels/bottom_panel/auto_hide</key><schema_key>/schemas/apps/panel/toplevels/auto_hide</schema_key></entry>
Index: panel-toplevel.schemas.in
===================================================================
--- panel-toplevel.schemas.in	(révision 10470)
+++ panel-toplevel.schemas.in	(copie de travail)
@@ -133,6 +133,44 @@
         </long>
       </locale>
     </schema>
+
+    <schema>
+      <key>/schemas/apps/panel/toplevels/x_right</key>
+      <owner>panel</owner>
+      <type>int</type>
+      <default>-1</default>
+      <locale name="C">
+        <short>X co-ordinate of panel, starting from the right of the screen</short>
+        <long>
+          The location of the panel along the x-axis, starting from the right of 
+	  the screen. If set to -1, the value is ignored and the value of the x
+	  key is used. If the value is greater than 0, then the value of the x
+	  key is ignored.
+	  This key is only relevant in un-expanded mode. In expanded mode this
+          key is ignored and the panel is placed at the screen edge
+          specified by the orientation key.
+        </long>
+      </locale>
+    </schema>
+ 
+    <schema>
+      <key>/schemas/apps/panel/toplevels/y_bottom</key>
+      <owner>panel</owner>
+      <type>int</type>
+      <default>-1</default>
+      <locale name="C">
+        <short>Y co-ordinate of panel, starting from the bottom of the screen</short>
+        <long>
+          The location of the panel along the y-axis, starting from the bottom of 
+	  the screen. If set to -1, the value is ignored and the value of the y
+	  key is used. If the value is greater than 0, then the value of the y
+	  key is ignored.
+	  This key is only relevant in un-expanded mode. In expanded mode this
+          key is ignored and the panel is placed at the screen edge
+          specified by the orientation key.
+        </long>
+      </locale>
+    </schema>
  
     <schema>
       <key>/schemas/apps/panel/toplevels/x_centered</key>
@@ -142,10 +180,10 @@
       <locale name="C">
         <short>Center panel on x-axis</short>
         <long>
-          If true, the x key is ignored and the panel is placed at
+          If true, the x and x_right keys are ignored and the panel is placed at
           the center of the x-axis of the screen. If the panel is
           resized it will remain at that position - i.e. the panel
-          will grow on both sides. If false, the x key specifies 
+          will grow on both sides. If false, the x and x_right keys specify
           the location of the panel.
         </long>
       </locale>
@@ -159,10 +197,10 @@
       <locale name="C">
         <short>Center panel on y-axis</short>
         <long>
-          If true, the y key is ignored and the panel is placed at
+          If true, the y and y_bottom keys are ignored and the panel is placed at
           the center of the y-axis of the screen. If the panel is
           resized it will remain at that position - i.e. the panel
-          will grow on both sides. If false, the y key specifies
+          will grow on both sides. If false, the y and y_bottom keys specify
           the location of the panel.
         </long>
       </locale>
