From 090bbf2b77284b5fa35197f0bfc96945889bf978 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 21 Sep 2017 19:33:50 -0400 Subject: MqTabChrome: Explain hardcoded GtkScrolledWindow sizes --- (limited to 'src') diff --git a/src/tab-chrome.c b/src/tab-chrome.c index 3ca8df2..a9391db 100644 --- a/src/tab-chrome.c +++ b/src/tab-chrome.c @@ -201,6 +201,41 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, ++chrome->back_items; } + /* + * The following GtkScrolledWindow widgets have hardcoded minimum sizes, + * because there seems to be (in GTK+ versions before 3.22) no way to + * set the natural size of GtkScrolledWindow and its GtkViewport. + * + * I tried: + * + * - Setting size requests of the sizes of child widgets plus + * scrollbars (commit 2205669) + * - Putting GtkScrolledWindow widgets in stacks with non-scrolled + * versions of children, to allocate more area for the + * GtkScrolledWindow widgets to fill (commits 922cdef and 90686fa) + * - Setting policies to disable scrollbars upon GtkScrolledWindow + * instantiation, then enabling scrollbars on the GtkScrolledWindow + * "size-allocate" signal (commits c534c7e and 42ca783) + * + * Attempts to match the size of a GtkScrolledWindow's GtkViewport to + * its child's size don't allow the GtkScrolledWindow and GtkViewport to + * shrink when necessary to fit within the window. Therefore, such + * methods are equivalent to simply not using GtkScrolledWindow at all. + * And there appears to be no easy way to calculate the available size + * (the size of the GtkWindow minus all of the surrounding widgets) to + * manually manage a GtkViewport's size. + * + * GtkScrolledWindow or GtkViewport ignores the child's preferred + * (minimum and natural) sizes and apparently just sets a hardcoded size + * of about 64x64 px. I considered subclassing GtkScrolledWindow or + * GtkViewport, but I'm not sure where the hardcoded size is set. + * + * The functions gtk_scrolled_window_set_propagate_natural_width() and + * gtk_scrolled_window_set_propagate_natural_height() were introduced in + * GTK+ 3.22 and probably do what I want. However, I want to maintain + * compatibility with at least GTK+ 3.12 or 3.14. + */ + /* Set up the list scrolled window. */ list_scrolled_window = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_min_content_width( -- cgit v0.9.1