diff options
| author | Jan Djärv | 2010-06-22 14:28:08 +0200 |
|---|---|---|
| committer | Jan Djärv | 2010-06-22 14:28:08 +0200 |
| commit | bc869eca8c91810c66ead464b57630ccebabaf29 (patch) | |
| tree | c345294f2385789af92fed61909430dfecd1aeef /src | |
| parent | 6555773f3fa4f997c58c85dc1160afee875ad31d (diff) | |
| download | emacs-bc869eca8c91810c66ead464b57630ccebabaf29.tar.gz emacs-bc869eca8c91810c66ead464b57630ccebabaf29.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/gtkutil.c | 28 | ||||
| -rw-r--r-- | src/gtkutil.h | 1 | ||||
| -rw-r--r-- | src/xterm.c | 1 |
4 files changed, 23 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3d8e962e070..b52d6c1dffe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | 2010-06-22 Jan Djärv <jan.h.d@swipnet.se> | 1 | 2010-06-22 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * xterm.c (x_scroll_bar_create): Remove call to xg_show_scroll_bar. | ||
| 4 | |||
| 5 | * gtkutil.h (xg_show_scroll_bar): : Remove. | ||
| 6 | |||
| 7 | * gtkutil.c (xg_update_scrollbar_pos): Show/hide scroll bar as needed | ||
| 8 | if height is less than scroll bar min size. | ||
| 9 | (xg_show_scroll_bar): Remove, show moved to xg_update_scrollbar_pos. | ||
| 10 | |||
| 3 | * xfns.c (x_default_font_parameter): Try to open font from system | 11 | * xfns.c (x_default_font_parameter): Try to open font from system |
| 4 | before using it (bug#6478). Rename got_from_gconf to got_from_system. | 12 | before using it (bug#6478). Rename got_from_gconf to got_from_system. |
| 5 | 13 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index c8800817b68..51b1c64c108 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -3174,17 +3174,6 @@ xg_create_scroll_bar (f, bar, scroll_callback, end_callback, scroll_bar_name) | |||
| 3174 | bar->x_window = scroll_id; | 3174 | bar->x_window = scroll_id; |
| 3175 | } | 3175 | } |
| 3176 | 3176 | ||
| 3177 | /* Make the scroll bar represented by SCROLLBAR_ID visible. */ | ||
| 3178 | |||
| 3179 | void | ||
| 3180 | xg_show_scroll_bar (scrollbar_id) | ||
| 3181 | int scrollbar_id; | ||
| 3182 | { | ||
| 3183 | GtkWidget *w = xg_get_widget_from_map (scrollbar_id); | ||
| 3184 | if (w) | ||
| 3185 | gtk_widget_show_all (gtk_widget_get_parent (w)); | ||
| 3186 | } | ||
| 3187 | |||
| 3188 | /* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */ | 3177 | /* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */ |
| 3189 | 3178 | ||
| 3190 | void | 3179 | void |
| @@ -3243,10 +3232,23 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) | |||
| 3243 | 3232 | ||
| 3244 | /* Move and resize to new values. */ | 3233 | /* Move and resize to new values. */ |
| 3245 | gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top); | 3234 | gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top); |
| 3246 | gtk_widget_set_size_request (wscroll, width, height); | 3235 | gint msl; |
| 3236 | gtk_widget_style_get (wscroll, "min-slider-length", &msl, NULL); | ||
| 3237 | if (msl > height) | ||
| 3238 | { | ||
| 3239 | /* No room. Hide scroll bar as some themes output a warning if | ||
| 3240 | the height is less than the min size. */ | ||
| 3241 | gtk_widget_hide (wparent); | ||
| 3242 | gtk_widget_hide (wscroll); | ||
| 3243 | } | ||
| 3244 | else | ||
| 3245 | { | ||
| 3246 | gtk_widget_show_all (wparent); | ||
| 3247 | gtk_widget_set_size_request (wscroll, width, height); | ||
| 3248 | } | ||
| 3247 | gtk_widget_queue_draw (wfixed); | 3249 | gtk_widget_queue_draw (wfixed); |
| 3248 | gdk_window_process_all_updates (); | 3250 | gdk_window_process_all_updates (); |
| 3249 | if (oldx != -1) | 3251 | if (oldx != -1 && oldw > 0 && oldh > 0) |
| 3250 | { | 3252 | { |
| 3251 | /* Clear under old scroll bar position. This must be done after | 3253 | /* Clear under old scroll bar position. This must be done after |
| 3252 | the gtk_widget_queue_draw and gdk_window_process_all_updates | 3254 | the gtk_widget_queue_draw and gdk_window_process_all_updates |
diff --git a/src/gtkutil.h b/src/gtkutil.h index 602228f97be..4eba4710ea3 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h | |||
| @@ -163,7 +163,6 @@ extern void xg_create_scroll_bar P_ ((FRAME_PTR f, | |||
| 163 | GCallback scroll_callback, | 163 | GCallback scroll_callback, |
| 164 | GCallback end_callback, | 164 | GCallback end_callback, |
| 165 | char *scroll_bar_name)); | 165 | char *scroll_bar_name)); |
| 166 | extern void xg_show_scroll_bar P_ ((int scrollbar_id)); | ||
| 167 | extern void xg_remove_scroll_bar P_ ((FRAME_PTR f, int scrollbar_id)); | 166 | extern void xg_remove_scroll_bar P_ ((FRAME_PTR f, int scrollbar_id)); |
| 168 | 167 | ||
| 169 | extern void xg_update_scrollbar_pos P_ ((FRAME_PTR f, | 168 | extern void xg_update_scrollbar_pos P_ ((FRAME_PTR f, |
diff --git a/src/xterm.c b/src/xterm.c index f195c4fbbd5..59573a5942e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -4998,7 +4998,6 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 4998 | left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 4998 | left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
| 4999 | width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, | 4999 | width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
| 5000 | max (height, 1)); | 5000 | max (height, 1)); |
| 5001 | xg_show_scroll_bar (bar->x_window); | ||
| 5002 | #else /* not USE_GTK */ | 5001 | #else /* not USE_GTK */ |
| 5003 | Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); | 5002 | Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); |
| 5004 | XtConfigureWidget (scroll_bar, | 5003 | XtConfigureWidget (scroll_bar, |