[gtk+/gtk-3-2] Fix gtk_grid_attach_next_to
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-2] Fix gtk_grid_attach_next_to
- Date: Sat, 12 Nov 2011 04:08:56 +0000 (UTC)
commit 9a16a83c95b95f5ee2fef16a12e135d4e8ce6c48
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 25 23:18:21 2011 -0400
Fix gtk_grid_attach_next_to
The function did not behave as intended when @sibling is NULL.
Also add an example to the docs to clarify the intended behaviour.
gtk/gtkgrid.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index f6ec2f1..a122ad4 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -1465,6 +1465,9 @@ gtk_grid_attach (GtkGrid *grid,
* @side. When @sibling is %NULL, the widget is placed in row (for
* left or right placement) or column 0 (for top or bottom placement),
* at the end indicated by @side.
+ *
+ * Attaching widgets labeled [1], [2], [3] with @sibling == %NULL and
+ * @side == %GTK_POS_LEFT yields a layout of [3][2][1].
*/
void
gtk_grid_attach_next_to (GtkGrid *grid,
@@ -1515,20 +1518,22 @@ gtk_grid_attach_next_to (GtkGrid *grid,
switch (side)
{
case GTK_POS_LEFT:
- left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, TRUE);
+ left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, FALSE);
+ left -= width;
top = 0;
break;
case GTK_POS_RIGHT:
- left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, FALSE);
+ left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, TRUE);
top = 0;
break;
case GTK_POS_TOP:
left = 0;
- top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, TRUE);
+ top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, FALSE);
+ top -= height;
break;
case GTK_POS_BOTTOM:
left = 0;
- top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, FALSE);
+ top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, TRUE);
break;
default:
g_assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]