Mercurial > emacs
changeset 39618:6d60a3a33839
(x_create_toolkit_scroll_bar): Try to allocate colors for the shadows,
and tell the toolkit about them if we succeed.
(x_destroy_window) [USE_TOOLKIT_SCROLL_BARS]: Free scroll-bar shadow colors.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 05 Oct 2001 16:35:12 +0000 |
parents | d39706d66016 |
children | 1e12db2b25f0 |
files | src/xterm.c |
diffstat | 1 files changed, 62 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Fri Oct 05 16:33:06 2001 +0000 +++ b/src/xterm.c Fri Oct 05 16:35:12 2001 +0000 @@ -8736,7 +8736,6 @@ XtSetArg (av[ac], XtNorientation, XtorientVertical); ++ac; /* For smoother scrolling with Xaw3d -sm */ /* XtSetArg (av[ac], XtNpickTop, True); ++ac; */ - /* XtSetArg (av[ac], XtNbeNiceToColormap, True); ++ac; */ pixel = f->output_data.x->scroll_bar_foreground_pixel; if (pixel != -1) @@ -8751,7 +8750,61 @@ XtSetArg (av[ac], XtNbackground, pixel); ++ac; } - + + /* Top/bottom shadow colors. */ + + /* Allocate them, if necessary. */ + if (f->output_data.x->scroll_bar_top_shadow_pixel == -1) + { + pixel = f->output_data.x->scroll_bar_background_pixel; + if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), + &pixel, 1.2, 0x8000)) + pixel = -1; + f->output_data.x->scroll_bar_top_shadow_pixel = pixel; + } + if (f->output_data.x->scroll_bar_bottom_shadow_pixel == -1) + { + pixel = f->output_data.x->scroll_bar_background_pixel; + if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), + &pixel, 0.6, 0x4000)) + pixel = -1; + f->output_data.x->scroll_bar_bottom_shadow_pixel = pixel; + } + + /* Tell the toolkit about them. */ + if (f->output_data.x->scroll_bar_top_shadow_pixel == -1 + || f->output_data.x->scroll_bar_bottom_shadow_pixel == -1) + /* We tried to allocate a color for the top/bottom shadow, and + failed, so tell Xaw3d to use dithering instead. */ + { + XtSetArg (av[ac], XtNbeNiceToColormap, True); + ++ac; + } + else + /* Tell what colors Xaw3d should use for the top/bottom shadow, to + be more consistent with other emacs 3d colors, and since Xaw3d is + not good at dealing with allocation failure. */ + { + /* This tells Xaw3d to use real colors instead of dithering for + the shadows. */ + XtSetArg (av[ac], XtNbeNiceToColormap, False); + ++ac; + + /* Specify the colors. */ + pixel = f->output_data.x->scroll_bar_top_shadow_pixel; + if (pixel != -1) + { + XtSetArg (av[ac], "topShadowPixel", pixel); + ++ac; + } + pixel = f->output_data.x->scroll_bar_bottom_shadow_pixel; + if (pixel != -1) + { + XtSetArg (av[ac], "bottomShadowPixel", pixel); + ++ac; + } + } + widget = XtCreateWidget (scroll_bar_name, scrollbarWidgetClass, f->output_data.x->edit_widget, av, ac); @@ -13139,6 +13192,13 @@ unload_color (f, f->output_data.x->scroll_bar_background_pixel); if (f->output_data.x->scroll_bar_foreground_pixel != -1) unload_color (f, f->output_data.x->scroll_bar_foreground_pixel); +#ifdef USE_TOOLKIT_SCROLL_BARS + /* Scrollbar shadow colors. */ + if (f->output_data.x->scroll_bar_top_shadow_pixel != -1) + unload_color (f, f->output_data.x->scroll_bar_top_shadow_pixel); + if (f->output_data.x->scroll_bar_bottom_shadow_pixel != -1) + unload_color (f, f->output_data.x->scroll_bar_bottom_shadow_pixel); +#endif /* USE_TOOLKIT_SCROLL_BARS */ if (f->output_data.x->white_relief.allocated_p) unload_color (f, f->output_data.x->white_relief.pixel); if (f->output_data.x->black_relief.allocated_p)