diff src/gtkutil.c @ 109037:3e9a832a5533

Hide scroll bar when window is too small to avoid Gtk+ warning. * gtkutil.c (xg_update_scrollbar_pos): Show/hide scroll bar as needed if height is less than scroll bar min size. (xg_show_scroll_bar): Remove, show moved to xg_update_scrollbar_pos. * gtkutil.h (xg_show_scroll_bar): : Remove. * xterm.c (x_scroll_bar_create): Remove call to xg_show_scroll_bar.
author Jan D. <jan.h.d@swipnet.se>
date Tue, 22 Jun 2010 14:28:08 +0200
parents 8bb62bdbd80a
children 98796fa1a7f8
line wrap: on
line diff
--- a/src/gtkutil.c	Tue Jun 22 01:10:26 2010 -0700
+++ b/src/gtkutil.c	Tue Jun 22 14:28:08 2010 +0200
@@ -3174,17 +3174,6 @@
   bar->x_window = scroll_id;
 }
 
-/* Make the scroll bar represented by SCROLLBAR_ID visible.  */
-
-void
-xg_show_scroll_bar (scrollbar_id)
-     int scrollbar_id;
-{
-  GtkWidget *w = xg_get_widget_from_map (scrollbar_id);
-  if (w)
-    gtk_widget_show_all (gtk_widget_get_parent (w));
-}
-
 /* Remove the scroll bar represented by SCROLLBAR_ID from the frame F.  */
 
 void
@@ -3243,10 +3232,23 @@
 
       /* Move and resize to new values.  */
       gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top);
-      gtk_widget_set_size_request (wscroll, width, height);
+      gint msl;
+      gtk_widget_style_get (wscroll, "min-slider-length", &msl, NULL);
+      if (msl > height)
+        {
+          /* No room.  Hide scroll bar as some themes output a warning if
+             the height is less than the min size.  */
+          gtk_widget_hide (wparent);
+          gtk_widget_hide (wscroll);
+        }
+      else
+        {
+          gtk_widget_show_all (wparent);
+          gtk_widget_set_size_request (wscroll, width, height);
+        }
       gtk_widget_queue_draw (wfixed);
       gdk_window_process_all_updates ();
-      if (oldx != -1) 
+      if (oldx != -1 && oldw > 0 && oldh > 0)
         {
           /* Clear under old scroll bar position.  This must be done after
              the gtk_widget_queue_draw and gdk_window_process_all_updates