emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r100632: Hide scroll bar when window


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100632: Hide scroll bar when window is too small to avoid Gtk+ warning.
Date: Tue, 22 Jun 2010 14:28:08 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100632
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Tue 2010-06-22 14:28:08 +0200
message:
  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.
modified:
  src/ChangeLog
  src/gtkutil.c
  src/gtkutil.h
  src/xterm.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-06-22 07:55:08 +0000
+++ b/src/ChangeLog     2010-06-22 12:28:08 +0000
@@ -1,5 +1,13 @@
 2010-06-22  Jan Djärv  <address@hidden>
 
+       * xterm.c (x_scroll_bar_create): Remove call to xg_show_scroll_bar.
+
+       * gtkutil.h (xg_show_scroll_bar): : Remove.
+
+       * 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.
+
        * xfns.c (x_default_font_parameter): Try to open font from system
        before using it (bug#6478).  Rename got_from_gconf to got_from_system.
 

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2010-05-08 12:04:47 +0000
+++ b/src/gtkutil.c     2010-06-22 12:28:08 +0000
@@ -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

=== modified file 'src/gtkutil.h'
--- a/src/gtkutil.h     2010-01-13 08:35:10 +0000
+++ b/src/gtkutil.h     2010-06-22 12:28:08 +0000
@@ -163,7 +163,6 @@
                                       GCallback scroll_callback,
                                       GCallback end_callback,
                                       char *scroll_bar_name));
-extern void xg_show_scroll_bar P_ ((int scrollbar_id));
 extern void xg_remove_scroll_bar P_ ((FRAME_PTR f, int scrollbar_id));
 
 extern void xg_update_scrollbar_pos P_ ((FRAME_PTR f,

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2010-06-08 03:02:41 +0000
+++ b/src/xterm.c       2010-06-22 12:28:08 +0000
@@ -4998,7 +4998,6 @@
                              left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
                              width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
                              max (height, 1));
-    xg_show_scroll_bar (bar->x_window);
 #else /* not USE_GTK */
     Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
     XtConfigureWidget (scroll_bar,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]