[patch] GdlDock, xor rectangle position
- From: Gustavo Giraldez <gustavo giraldez gmx net>
- To: gnome-devtools gnome org
- Subject: [patch] GdlDock, xor rectangle position
- Date: Tue, 2 Oct 2001 15:11:54 -0300
Hi,
This patch fixes the bug Campd and Jeroen found in GdlDock about the position of the xored rectangle when the dock is packed with widgets to the top and left. It also modifies test-dock to verify the behavior.
HTH,
Gustavo
Index: gdl-dock.c
===================================================================
RCS file: /cvs/gnome/gdl/gdl/gdl-dock.c,v
retrieving revision 1.1
diff -u -r1.1 gdl-dock.c
--- gdl-dock.c 2001/09/30 18:06:22 1.1
+++ gdl-dock.c 2001/10/02 18:54:02
@@ -645,8 +645,8 @@
should_float = FALSE;
/* Set docking indicator rectangle to the GdlDock size. */
- dock->possible_target.rect.x = border_width;
- dock->possible_target.rect.y = border_width;
+ dock->possible_target.rect.x = alloc->x + border_width;
+ dock->possible_target.rect.y = alloc->y + border_width;
dock->possible_target.rect.width = alloc->width - 2 * border_width;
dock->possible_target.rect.height = alloc->height - 2 * border_width;
@@ -671,7 +671,7 @@
dock->possible_target.position = GDL_DOCK_TOP;
dock->possible_target.rect.height *= SPLIT_RATIO;
} else if (new_y > alloc->height - 2 * border_width) {
- dock->possible_target.position = GDL_DOCK_BOTTOM;
+ dock->possible_target.position = GDL_DOCK_BOTTOM;
dock->possible_target.rect.y +=
dock->possible_target.rect.height * (1 - SPLIT_RATIO);
dock->possible_target.rect.height *= SPLIT_RATIO;
@@ -681,8 +681,8 @@
rel_x, rel_y,
&dock->possible_target);
if (!should_float) {
- dock->possible_target.rect.x += border_width;
- dock->possible_target.rect.y += border_width;
+ dock->possible_target.rect.x += alloc->x + border_width;
+ dock->possible_target.rect.y += alloc->y + border_width;
}
}
}
Index: test-dock.c
===================================================================
RCS file: /cvs/gnome/gdl/gdl/test-dock.c,v
retrieving revision 1.1
diff -u -r1.1 test-dock.c
--- test-dock.c 2001/09/30 18:06:22 1.1
+++ test-dock.c 2001/10/02 18:54:02
@@ -84,7 +84,7 @@
int
main (int argc, char **argv)
{
- GtkWidget *win, *dock;
+ GtkWidget *win, *dock, *box;
int i;
gtk_init (&argc, &argv);
@@ -96,9 +96,14 @@
gtk_window_set_title (GTK_WINDOW (win), "Test!");
gtk_window_set_default_size (GTK_WINDOW (win), 400, 400);
+ box = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (win), box);
+
+ gtk_container_add (GTK_CONTAINER (box), gtk_button_new_with_label ("Test"));
+
/* create the dock */
dock = gdl_dock_new ();
- gtk_container_add (GTK_CONTAINER (win), dock);
+ gtk_container_add (GTK_CONTAINER (box), dock);
gtk_container_set_border_width (GTK_CONTAINER (dock), 10);
/* create the dock items */
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]