From 3a3a0ef97bb83e7359269ea8ad7e261a83e69165 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Thu, 25 Feb 1999 08:58:23 +0000 Subject: [PATCH] don't add extra width or height if the requested size is mandatory (i.e. Thu Feb 25 09:50:38 1999 Tim Janik * gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_request): don't add extra width or height if the requested size is mandatory (i.e. set through child->usize). --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkscrolledwindow.c | 27 +++++++++++++++++---------- 8 files changed, 59 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 203836ffc..36039abf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Feb 25 09:50:38 1999 Tim Janik + + * gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_request): don't add + extra width or height if the requested size is mandatory (i.e. set + through child->usize). + Thu Feb 25 02:13:20 CST 1999 Shawn T. Amundson * gtk/gtkmenu.[ch]: New function gtk_menu_reorder_child() diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 203836ffc..36039abf6 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Thu Feb 25 09:50:38 1999 Tim Janik + + * gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_request): don't add + extra width or height if the requested size is mandatory (i.e. set + through child->usize). + Thu Feb 25 02:13:20 CST 1999 Shawn T. Amundson * gtk/gtkmenu.[ch]: New function gtk_menu_reorder_child() diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 203836ffc..36039abf6 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Thu Feb 25 09:50:38 1999 Tim Janik + + * gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_request): don't add + extra width or height if the requested size is mandatory (i.e. set + through child->usize). + Thu Feb 25 02:13:20 CST 1999 Shawn T. Amundson * gtk/gtkmenu.[ch]: New function gtk_menu_reorder_child() diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 203836ffc..36039abf6 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Thu Feb 25 09:50:38 1999 Tim Janik + + * gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_request): don't add + extra width or height if the requested size is mandatory (i.e. set + through child->usize). + Thu Feb 25 02:13:20 CST 1999 Shawn T. Amundson * gtk/gtkmenu.[ch]: New function gtk_menu_reorder_child() diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 203836ffc..36039abf6 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Thu Feb 25 09:50:38 1999 Tim Janik + + * gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_request): don't add + extra width or height if the requested size is mandatory (i.e. set + through child->usize). + Thu Feb 25 02:13:20 CST 1999 Shawn T. Amundson * gtk/gtkmenu.[ch]: New function gtk_menu_reorder_child() diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 203836ffc..36039abf6 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Thu Feb 25 09:50:38 1999 Tim Janik + + * gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_request): don't add + extra width or height if the requested size is mandatory (i.e. set + through child->usize). + Thu Feb 25 02:13:20 CST 1999 Shawn T. Amundson * gtk/gtkmenu.[ch]: New function gtk_menu_reorder_child() diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 203836ffc..36039abf6 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Thu Feb 25 09:50:38 1999 Tim Janik + + * gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_request): don't add + extra width or height if the requested size is mandatory (i.e. set + through child->usize). + Thu Feb 25 02:13:20 CST 1999 Shawn T. Amundson * gtk/gtkmenu.[ch]: New function gtk_menu_reorder_child() diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index dc4b4ff35..f230be53f 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -587,8 +587,8 @@ gtk_scrolled_window_size_request (GtkWidget *widget, { GtkScrolledWindow *scrolled_window; GtkBin *bin; - gint extra_height; gint extra_width; + gint extra_height; GtkRequisition hscrollbar_requisition; GtkRequisition vscrollbar_requisition; GtkRequisition child_requisition; @@ -600,6 +600,8 @@ gtk_scrolled_window_size_request (GtkWidget *widget, scrolled_window = GTK_SCROLLED_WINDOW (widget); bin = GTK_BIN (scrolled_window); + extra_width = 0; + extra_height = 0; requisition->width = 0; requisition->height = 0; @@ -625,7 +627,10 @@ gtk_scrolled_window_size_request (GtkWidget *widget, aux_info = gtk_object_get_data_by_id (GTK_OBJECT (bin->child), quark_aux_info); if (aux_info && aux_info->width > 0) - requisition->width += aux_info->width; + { + requisition->width += aux_info->width; + extra_width = -1; + } else requisition->width += vscrollbar_requisition.width; } @@ -638,31 +643,33 @@ gtk_scrolled_window_size_request (GtkWidget *widget, aux_info = gtk_object_get_data_by_id (GTK_OBJECT (bin->child), quark_aux_info); if (aux_info && aux_info->height > 0) - requisition->height += aux_info->height; + { + requisition->height += aux_info->height; + extra_height = -1; + } else requisition->height += hscrollbar_requisition.height; } } - extra_width = 0; - extra_height = 0; - if ((scrolled_window->hscrollbar_policy == GTK_POLICY_AUTOMATIC) || GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar)) { requisition->width = MAX (requisition->width, hscrollbar_requisition.width); - extra_height = SCROLLBAR_SPACING (scrolled_window) + hscrollbar_requisition.height; + if (!extra_height) + extra_height = SCROLLBAR_SPACING (scrolled_window) + hscrollbar_requisition.height; } if ((scrolled_window->vscrollbar_policy == GTK_POLICY_AUTOMATIC) || GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar)) { requisition->height = MAX (requisition->height, vscrollbar_requisition.height); - extra_width = SCROLLBAR_SPACING (scrolled_window) + vscrollbar_requisition.width; + if (!extra_width) + extra_width = SCROLLBAR_SPACING (scrolled_window) + vscrollbar_requisition.width; } - requisition->width += GTK_CONTAINER (widget)->border_width * 2 + extra_width; - requisition->height += GTK_CONTAINER (widget)->border_width * 2 + extra_height; + requisition->width += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_width); + requisition->height += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_height); } static void -- 2.43.2