Commit c86bf9ba authored by Tim Janik's avatar Tim Janik Committed by Tim Janik
Browse files

refuse to allocate with a greater height than requested.

Sat Mar 14 08:29:56 1998  Tim Janik  <timj@gimp.org>

        * gtk/gtkhandlebox.c (gtk_handle_box_size_allocate): refuse to allocate
                with a greater height than requested.
                        (gtk_handle_box_remove): clean up if the child is detached.

                                * gtk/gtktoolbar.c (gtk_toolbar_size_allocate): don't take invisible
                                        children into account.
parent b8e7ea1f
Sat Mar 14 08:29:56 1998 Tim Janik <timj@gimp.org>
* gtk/gtkhandlebox.c (gtk_handle_box_size_allocate): refuse to allocate
with a greater height than requested.
(gtk_handle_box_remove): clean up if the child is detached.
* gtk/gtktoolbar.c (gtk_toolbar_size_allocate): don't take invisible
children into account.
Sat Mar 14 02:12:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
......
Sat Mar 14 08:29:56 1998 Tim Janik <timj@gimp.org>
* gtk/gtkhandlebox.c (gtk_handle_box_size_allocate): refuse to allocate
with a greater height than requested.
(gtk_handle_box_remove): clean up if the child is detached.
* gtk/gtktoolbar.c (gtk_toolbar_size_allocate): don't take invisible
children into account.
Sat Mar 14 02:12:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
......
Sat Mar 14 08:29:56 1998 Tim Janik <timj@gimp.org>
* gtk/gtkhandlebox.c (gtk_handle_box_size_allocate): refuse to allocate
with a greater height than requested.
(gtk_handle_box_remove): clean up if the child is detached.
* gtk/gtktoolbar.c (gtk_toolbar_size_allocate): don't take invisible
children into account.
Sat Mar 14 02:12:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
......
Sat Mar 14 08:29:56 1998 Tim Janik <timj@gimp.org>
* gtk/gtkhandlebox.c (gtk_handle_box_size_allocate): refuse to allocate
with a greater height than requested.
(gtk_handle_box_remove): clean up if the child is detached.
* gtk/gtktoolbar.c (gtk_toolbar_size_allocate): don't take invisible
children into account.
Sat Mar 14 02:12:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
......
Sat Mar 14 08:29:56 1998 Tim Janik <timj@gimp.org>
* gtk/gtkhandlebox.c (gtk_handle_box_size_allocate): refuse to allocate
with a greater height than requested.
(gtk_handle_box_remove): clean up if the child is detached.
* gtk/gtktoolbar.c (gtk_toolbar_size_allocate): don't take invisible
children into account.
Sat Mar 14 02:12:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
......
Sat Mar 14 08:29:56 1998 Tim Janik <timj@gimp.org>
* gtk/gtkhandlebox.c (gtk_handle_box_size_allocate): refuse to allocate
with a greater height than requested.
(gtk_handle_box_remove): clean up if the child is detached.
* gtk/gtktoolbar.c (gtk_toolbar_size_allocate): don't take invisible
children into account.
Sat Mar 14 02:12:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
......
Sat Mar 14 08:29:56 1998 Tim Janik <timj@gimp.org>
* gtk/gtkhandlebox.c (gtk_handle_box_size_allocate): refuse to allocate
with a greater height than requested.
(gtk_handle_box_remove): clean up if the child is detached.
* gtk/gtktoolbar.c (gtk_toolbar_size_allocate): don't take invisible
children into account.
Sat Mar 14 02:12:44 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
......
......@@ -29,7 +29,7 @@
#define DRAG_HANDLE_SIZE 10
#define BORDER_SIZE 5
#define GHOST_HEIGHT 3
#define SNAP_TOLERANCE 10
#define SNAP_TOLERANCE 16
enum
{
......@@ -52,7 +52,9 @@ static void gtk_handle_box_unrealize (GtkWidget *widget);
static void gtk_handle_box_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_handle_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
GtkAllocation *real_allocation);
static void gtk_handle_box_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_handle_box_draw_ghost (GtkWidget *widget);
static void gtk_handle_box_paint (GtkWidget *widget,
GdkEventExpose *event,
......@@ -114,11 +116,13 @@ gtk_handle_box_marshal_child_attached (GtkObject *object,
static void
gtk_handle_box_class_init (GtkHandleBoxClass *class)
{
GtkWidgetClass *widget_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
container_class = (GtkContainerClass *) class;
parent_class = gtk_type_class (gtk_bin_get_type ());
......@@ -154,6 +158,8 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
widget_class->button_release_event = gtk_handle_box_button_changed;
widget_class->motion_notify_event = gtk_handle_box_motion;
container_class->remove = gtk_handle_box_remove;
class->child_attached = NULL;
class->child_detached = NULL;
}
......@@ -349,21 +355,33 @@ gtk_handle_box_size_request (GtkWidget *widget,
static void
gtk_handle_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
GtkAllocation *real_allocation)
{
GtkBin *bin;
GtkAllocation child_allocation;
GtkAllocation *allocation;
GtkHandleBox *hb;
gint border_width;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
g_return_if_fail (allocation != NULL);
g_return_if_fail (real_allocation != NULL);
widget->allocation = *allocation;
bin = GTK_BIN (widget);
hb = GTK_HANDLE_BOX (widget);
allocation = &widget->allocation;
allocation->x = real_allocation->x;
if (real_allocation->height > widget->requisition.height)
allocation->y = real_allocation->y + (real_allocation->height - widget->requisition.height) / 2;
else
allocation->y = real_allocation->y;
allocation->height = MIN (real_allocation->height, widget->requisition.height);
allocation->width = real_allocation->width;
/* this will refuse to allocate width greater than neccessary:
* allocation->width = MIN (real_allocation->width, widget->requisition.width);
*/
border_width = GTK_CONTAINER (widget)->border_width;
if (GTK_WIDGET_REALIZED (widget))
......@@ -399,6 +417,8 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
GtkAllocation child_allocation;
child_allocation.x = DRAG_HANDLE_SIZE;
child_allocation.y = 0;
......@@ -417,6 +437,34 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
}
}
static void
gtk_handle_box_remove (GtkContainer *container,
GtkWidget *widget)
{
GtkHandleBox *hb;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_HANDLE_BOX (container));
g_return_if_fail (widget != NULL);
hb = GTK_HANDLE_BOX (container);
if (widget == GTK_BIN (container)->child &&
GTK_WIDGET_REALIZED (hb) &&
hb->is_onroot)
{
hb->is_onroot = FALSE;
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_window_reparent (widget->window, hb->steady_window, 0, 0);
gtk_widget_hide (hb->float_window);
}
GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
}
static void
gtk_handle_box_draw_ghost (GtkWidget *widget)
{
......
......@@ -101,7 +101,7 @@ gtk_object_debug_foreach (gpointer key, gpointer value, gpointer user_data)
GtkObject *object;
object = (GtkObject*) value;
g_print ("%p: %s ref_count=%d%s%s\n",
g_print ("GTK-DEBUG: %p: %s ref_count=%d%s%s\n",
object,
gtk_type_name (GTK_OBJECT_TYPE (object)),
object->ref_count,
......@@ -113,7 +113,7 @@ gtk_object_debug (void)
{
g_hash_table_foreach (living_objs_ht, gtk_object_debug_foreach, NULL);
g_print ("living objects count = %d\n", obj_count);
g_print ("GTK-DEBUG: living objects count = %d\n", obj_count);
}
static guint
gtk_object_pointer_hash (const gpointer v)
......
......@@ -416,11 +416,11 @@ static void
gtk_toolbar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkToolbar *toolbar;
GList *children;
GtkToolbarChild *child;
GtkAllocation alloc;
gint border_width;
GtkToolbar *toolbar;
GList *children;
GtkToolbarChild *child;
GtkAllocation alloc;
gint border_width;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (widget));
......@@ -453,6 +453,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
case GTK_TOOLBAR_CHILD_BUTTON:
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
if (!GTK_WIDGET_VISIBLE (child->widget))
break;
alloc.width = toolbar->button_maxw;
alloc.height = toolbar->button_maxh;
......@@ -471,6 +473,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
break;
case GTK_TOOLBAR_CHILD_WIDGET:
if (!GTK_WIDGET_VISIBLE (child->widget))
break;
alloc.width = child->widget->requisition.width;
alloc.height = child->widget->requisition.height;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment