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.
This commit is contained in:
Jan Djärv 2010-06-22 14:28:08 +02:00
parent 6555773f3f
commit bc869eca8c
4 changed files with 23 additions and 15 deletions

View file

@ -1,5 +1,13 @@
2010-06-22 Jan Djärv <jan.h.d@swipnet.se>
* 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.

View file

@ -3174,17 +3174,6 @@ xg_create_scroll_bar (f, bar, scroll_callback, end_callback, scroll_bar_name)
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 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)
/* 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

View file

@ -163,7 +163,6 @@ extern void xg_create_scroll_bar P_ ((FRAME_PTR f,
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,

View file

@ -4998,7 +4998,6 @@ x_scroll_bar_create (w, top, left, width, height)
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,