mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 12:20:10 +00:00
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.
This commit is contained in:
parent
b8e7ea1f11
commit
c86bf9bae2
@ -1,3 +1,12 @@
|
|||||||
|
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>
|
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.
|
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
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>
|
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.
|
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
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>
|
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.
|
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
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>
|
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.
|
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
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>
|
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.
|
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
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>
|
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.
|
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
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>
|
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.
|
* gtk/gtkmain.c gdk/gdk.c: Don't leave NULL's in argv.
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#define DRAG_HANDLE_SIZE 10
|
#define DRAG_HANDLE_SIZE 10
|
||||||
#define BORDER_SIZE 5
|
#define BORDER_SIZE 5
|
||||||
#define GHOST_HEIGHT 3
|
#define GHOST_HEIGHT 3
|
||||||
#define SNAP_TOLERANCE 10
|
#define SNAP_TOLERANCE 16
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -52,7 +52,9 @@ static void gtk_handle_box_unrealize (GtkWidget *widget);
|
|||||||
static void gtk_handle_box_size_request (GtkWidget *widget,
|
static void gtk_handle_box_size_request (GtkWidget *widget,
|
||||||
GtkRequisition *requisition);
|
GtkRequisition *requisition);
|
||||||
static void gtk_handle_box_size_allocate (GtkWidget *widget,
|
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_draw_ghost (GtkWidget *widget);
|
||||||
static void gtk_handle_box_paint (GtkWidget *widget,
|
static void gtk_handle_box_paint (GtkWidget *widget,
|
||||||
GdkEventExpose *event,
|
GdkEventExpose *event,
|
||||||
@ -114,11 +116,13 @@ gtk_handle_box_marshal_child_attached (GtkObject *object,
|
|||||||
static void
|
static void
|
||||||
gtk_handle_box_class_init (GtkHandleBoxClass *class)
|
gtk_handle_box_class_init (GtkHandleBoxClass *class)
|
||||||
{
|
{
|
||||||
GtkWidgetClass *widget_class;
|
|
||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
|
GtkWidgetClass *widget_class;
|
||||||
|
GtkContainerClass *container_class;
|
||||||
|
|
||||||
object_class = (GtkObjectClass *) class;
|
object_class = (GtkObjectClass *) class;
|
||||||
widget_class = (GtkWidgetClass *) class;
|
widget_class = (GtkWidgetClass *) class;
|
||||||
|
container_class = (GtkContainerClass *) class;
|
||||||
|
|
||||||
parent_class = gtk_type_class (gtk_bin_get_type ());
|
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->button_release_event = gtk_handle_box_button_changed;
|
||||||
widget_class->motion_notify_event = gtk_handle_box_motion;
|
widget_class->motion_notify_event = gtk_handle_box_motion;
|
||||||
|
|
||||||
|
container_class->remove = gtk_handle_box_remove;
|
||||||
|
|
||||||
class->child_attached = NULL;
|
class->child_attached = NULL;
|
||||||
class->child_detached = NULL;
|
class->child_detached = NULL;
|
||||||
}
|
}
|
||||||
@ -349,21 +355,33 @@ gtk_handle_box_size_request (GtkWidget *widget,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_handle_box_size_allocate (GtkWidget *widget,
|
gtk_handle_box_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation)
|
GtkAllocation *real_allocation)
|
||||||
{
|
{
|
||||||
GtkBin *bin;
|
GtkBin *bin;
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation *allocation;
|
||||||
GtkHandleBox *hb;
|
GtkHandleBox *hb;
|
||||||
gint border_width;
|
gint border_width;
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
|
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);
|
bin = GTK_BIN (widget);
|
||||||
hb = GTK_HANDLE_BOX (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;
|
border_width = GTK_CONTAINER (widget)->border_width;
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (widget))
|
if (GTK_WIDGET_REALIZED (widget))
|
||||||
@ -399,6 +417,8 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||||
{
|
{
|
||||||
|
GtkAllocation child_allocation;
|
||||||
|
|
||||||
child_allocation.x = DRAG_HANDLE_SIZE;
|
child_allocation.x = DRAG_HANDLE_SIZE;
|
||||||
child_allocation.y = 0;
|
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
|
static void
|
||||||
gtk_handle_box_draw_ghost (GtkWidget *widget)
|
gtk_handle_box_draw_ghost (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ gtk_object_debug_foreach (gpointer key, gpointer value, gpointer user_data)
|
|||||||
GtkObject *object;
|
GtkObject *object;
|
||||||
|
|
||||||
object = (GtkObject*) value;
|
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,
|
object,
|
||||||
gtk_type_name (GTK_OBJECT_TYPE (object)),
|
gtk_type_name (GTK_OBJECT_TYPE (object)),
|
||||||
object->ref_count,
|
object->ref_count,
|
||||||
@ -113,7 +113,7 @@ gtk_object_debug (void)
|
|||||||
{
|
{
|
||||||
g_hash_table_foreach (living_objs_ht, gtk_object_debug_foreach, NULL);
|
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
|
static guint
|
||||||
gtk_object_pointer_hash (const gpointer v)
|
gtk_object_pointer_hash (const gpointer v)
|
||||||
|
@ -416,11 +416,11 @@ static void
|
|||||||
gtk_toolbar_size_allocate (GtkWidget *widget,
|
gtk_toolbar_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation)
|
||||||
{
|
{
|
||||||
GtkToolbar *toolbar;
|
GtkToolbar *toolbar;
|
||||||
GList *children;
|
GList *children;
|
||||||
GtkToolbarChild *child;
|
GtkToolbarChild *child;
|
||||||
GtkAllocation alloc;
|
GtkAllocation alloc;
|
||||||
gint border_width;
|
gint border_width;
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail (GTK_IS_TOOLBAR (widget));
|
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_BUTTON:
|
||||||
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
|
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
|
||||||
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
|
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
|
||||||
|
if (!GTK_WIDGET_VISIBLE (child->widget))
|
||||||
|
break;
|
||||||
alloc.width = toolbar->button_maxw;
|
alloc.width = toolbar->button_maxw;
|
||||||
alloc.height = toolbar->button_maxh;
|
alloc.height = toolbar->button_maxh;
|
||||||
|
|
||||||
@ -471,6 +473,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_TOOLBAR_CHILD_WIDGET:
|
case GTK_TOOLBAR_CHILD_WIDGET:
|
||||||
|
if (!GTK_WIDGET_VISIBLE (child->widget))
|
||||||
|
break;
|
||||||
alloc.width = child->widget->requisition.width;
|
alloc.width = child->widget->requisition.width;
|
||||||
alloc.height = child->widget->requisition.height;
|
alloc.height = child->widget->requisition.height;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user