GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 4dad7105 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Privately export _gtk_scrolled_window_get_scrollbar_spacing().

Thu Oct 10 14:35:31 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkscrolledwindow.[ch]: Privately export
        _gtk_scrolled_window_get_scrollbar_spacing().

        * gtk/gtkcombo.c: Properly account from scrollbar
        spacing when computing the size of the popup window.
        (#84955, Marco Pesenti Gritti)
parent 28bc5303
Thu Oct 10 14:35:31 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkscrolledwindow.[ch]: Privately export
_gtk_scrolled_window_get_scrollbar_spacing().
* gtk/gtkcombo.c: Properly account from scrollbar
spacing when computing the size of the popup window.
(#84955, Marco Pesenti Gritti)
Wed Oct 9 17:40:13 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c
......
Thu Oct 10 14:35:31 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkscrolledwindow.[ch]: Privately export
_gtk_scrolled_window_get_scrollbar_spacing().
* gtk/gtkcombo.c: Properly account from scrollbar
spacing when computing the size of the popup window.
(#84955, Marco Pesenti Gritti)
Wed Oct 9 17:40:13 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c
......
Thu Oct 10 14:35:31 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkscrolledwindow.[ch]: Privately export
_gtk_scrolled_window_get_scrollbar_spacing().
* gtk/gtkcombo.c: Properly account from scrollbar
spacing when computing the size of the popup window.
(#84955, Marco Pesenti Gritti)
Wed Oct 9 17:40:13 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c
......
Thu Oct 10 14:35:31 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkscrolledwindow.[ch]: Privately export
_gtk_scrolled_window_get_scrollbar_spacing().
* gtk/gtkcombo.c: Properly account from scrollbar
spacing when computing the size of the popup window.
(#84955, Marco Pesenti Gritti)
Wed Oct 9 17:40:13 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c
......
Thu Oct 10 14:35:31 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkscrolledwindow.[ch]: Privately export
_gtk_scrolled_window_get_scrollbar_spacing().
* gtk/gtkcombo.c: Properly account from scrollbar
spacing when computing the size of the popup window.
(#84955, Marco Pesenti Gritti)
Wed Oct 9 17:40:13 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c
......
Thu Oct 10 14:35:31 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkscrolledwindow.[ch]: Privately export
_gtk_scrolled_window_get_scrollbar_spacing().
* gtk/gtkcombo.c: Properly account from scrollbar
spacing when computing the size of the popup window.
(#84955, Marco Pesenti Gritti)
Wed Oct 9 17:40:13 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c
......
......@@ -426,11 +426,14 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
gint work_height;
gint old_height;
gint old_width;
gint scrollbar_spacing;
widget = GTK_WIDGET (combo);
popup = GTK_SCROLLED_WINDOW (combo->popup);
popwin = GTK_BIN (combo->popwin);
scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (popup);
gdk_window_get_origin (combo->entry->window, x, y);
real_height = MIN (combo->entry->requisition.height,
combo->entry->allocation.height);
......@@ -454,7 +457,7 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
2 * GTK_CONTAINER (popwin->child)->border_width +
2 * GTK_CONTAINER (combo->popup)->border_width +
2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width +
2 * GTK_BIN (popup)->child->style->xthickness);
2 * GTK_BIN (popup)->child->style->ythickness);
do
{
......@@ -464,21 +467,26 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
if (!show_hscroll &&
alloc_width < list_requisition.width)
{
work_height += (popup->hscrollbar->requisition.height +
GTK_SCROLLED_WINDOW_GET_CLASS (combo->popup)->scrollbar_spacing);
GtkRequisition requisition;
gtk_widget_size_request (popup->hscrollbar, &requisition);
work_height += (requisition.height + scrollbar_spacing);
show_hscroll = TRUE;
}
if (!show_vscroll &&
work_height + list_requisition.height > avail_height)
{
GtkRequisition requisition;
if (work_height + min_height > avail_height &&
*y - real_height > avail_height)
{
*y -= (work_height + list_requisition.height + real_height);
break;
}
alloc_width -= (popup->vscrollbar->requisition.width +
GTK_SCROLLED_WINDOW_GET_CLASS (combo->popup)->scrollbar_spacing);
gtk_widget_size_request (popup->hscrollbar, &requisition);
alloc_width -= (requisition.width + scrollbar_spacing);
show_vscroll = TRUE;
}
} while (old_width != alloc_width || old_height != work_height);
......
......@@ -68,10 +68,6 @@
#define DEFAULT_SCROLLBAR_SPACING 3
#define SCROLLBAR_SPACING(w) \
(GTK_SCROLLED_WINDOW_GET_CLASS (w)->scrollbar_spacing >= 0 ? \
GTK_SCROLLED_WINDOW_GET_CLASS (w)->scrollbar_spacing : DEFAULT_SCROLLBAR_SPACING)
enum {
PROP_0,
PROP_HADJUSTMENT,
......@@ -912,6 +908,7 @@ gtk_scrolled_window_size_request (GtkWidget *widget,
GtkBin *bin;
gint extra_width;
gint extra_height;
gint scrollbar_spacing;
GtkRequisition hscrollbar_requisition;
GtkRequisition vscrollbar_requisition;
GtkRequisition child_requisition;
......@@ -922,6 +919,8 @@ gtk_scrolled_window_size_request (GtkWidget *widget,
scrolled_window = GTK_SCROLLED_WINDOW (widget);
bin = GTK_BIN (scrolled_window);
scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
extra_width = 0;
extra_height = 0;
requisition->width = 0;
......@@ -972,7 +971,7 @@ gtk_scrolled_window_size_request (GtkWidget *widget,
{
requisition->width = MAX (requisition->width, hscrollbar_requisition.width);
if (!extra_height || scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS)
extra_height = SCROLLBAR_SPACING (scrolled_window) + hscrollbar_requisition.height;
extra_height = scrollbar_spacing + hscrollbar_requisition.height;
}
if (scrolled_window->vscrollbar_policy == GTK_POLICY_AUTOMATIC ||
......@@ -980,7 +979,7 @@ gtk_scrolled_window_size_request (GtkWidget *widget,
{
requisition->height = MAX (requisition->height, vscrollbar_requisition.height);
if (!extra_height || scrolled_window->vscrollbar_policy == GTK_POLICY_ALWAYS)
extra_width = SCROLLBAR_SPACING (scrolled_window) + vscrollbar_requisition.width;
extra_width = scrollbar_spacing + vscrollbar_requisition.width;
}
requisition->width += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_width);
......@@ -998,11 +997,13 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkScrolledWindow *scrolled_window;
gint scrollbar_spacing;
g_return_if_fail (widget != NULL);
g_return_if_fail (allocation != NULL);
scrolled_window = GTK_SCROLLED_WINDOW (widget);
scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
allocation->x = GTK_CONTAINER (widget)->border_width;
allocation->y = GTK_CONTAINER (widget)->border_width;
......@@ -1024,12 +1025,9 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget,
if (scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT ||
scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)
allocation->x += (vscrollbar_requisition.width +
SCROLLBAR_SPACING (scrolled_window));
allocation->x += (vscrollbar_requisition.width + scrollbar_spacing);
allocation->width = MAX (1, (gint)allocation->width -
((gint)vscrollbar_requisition.width +
(gint)SCROLLBAR_SPACING (scrolled_window)));
allocation->width = MAX (1, allocation->width - (vscrollbar_requisition.width + scrollbar_spacing));
}
if (scrolled_window->hscrollbar_visible)
{
......@@ -1039,12 +1037,9 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget,
if (scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT ||
scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)
allocation->y += (hscrollbar_requisition.height +
SCROLLBAR_SPACING (scrolled_window));
allocation->y += (hscrollbar_requisition.height + scrollbar_spacing);
allocation->height = MAX (1, (gint)allocation->height -
((gint)hscrollbar_requisition.height +
(gint)SCROLLBAR_SPACING (scrolled_window)));
allocation->height = MAX (1, allocation->height - (hscrollbar_requisition.height + scrollbar_spacing));
}
}
......@@ -1056,6 +1051,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
GtkBin *bin;
GtkAllocation relative_allocation;
GtkAllocation child_allocation;
gint scrollbar_spacing;
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
g_return_if_fail (allocation != NULL);
......@@ -1063,6 +1059,8 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
scrolled_window = GTK_SCROLLED_WINDOW (widget);
bin = GTK_BIN (scrolled_window);
scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
widget->allocation = *allocation;
if (scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS)
......@@ -1132,7 +1130,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT)
child_allocation.y = (relative_allocation.y +
relative_allocation.height +
SCROLLBAR_SPACING (scrolled_window) +
scrollbar_spacing +
(scrolled_window->shadow_type == GTK_SHADOW_NONE ?
0 : widget->style->ythickness));
else
......@@ -1167,7 +1165,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT)
child_allocation.x = (relative_allocation.x +
relative_allocation.width +
SCROLLBAR_SPACING (scrolled_window) +
scrollbar_spacing +
(scrolled_window->shadow_type == GTK_SHADOW_NONE ?
0 : widget->style->xthickness));
else
......@@ -1367,3 +1365,25 @@ gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
gtk_widget_show (viewport);
gtk_container_add (GTK_CONTAINER (viewport), child);
}
/**
* _gtk_scrolled_window_get_spacing:
* @scrolled_window: a scrolled window
*
* Gets the spacing between the scrolled window's scrollbars and
* the scrolled widget. Used by GtkCombo
*
* Return value: the spacing, in pixels.
**/
gint
_gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window)
{
GtkScrolledWindowClass *class;
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
class = GTK_SCROLLED_WINDOW_GET_CLASS (scrolled_window);
return class->scrollbar_spacing >= 0 ? class->scrollbar_spacing : DEFAULT_SCROLLBAR_SPACING;
}
......@@ -120,6 +120,7 @@ GtkShadowType gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolle
void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
GtkWidget *child);
gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);
#ifdef __cplusplus
}
......
Markdown is supported
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