diff options
| author | Miles Bader | 2001-10-05 16:35:12 +0000 |
|---|---|---|
| committer | Miles Bader | 2001-10-05 16:35:12 +0000 |
| commit | 7c1bef7a5bf233a4c24348300bc77eb2db6e4dcc (patch) | |
| tree | c533e1f9c0a33f1c4ac9f39f0ff98337839a9520 /src | |
| parent | f9fdaa6a2773b365693889050d66af2f69354860 (diff) | |
| download | emacs-7c1bef7a5bf233a4c24348300bc77eb2db6e4dcc.tar.gz emacs-7c1bef7a5bf233a4c24348300bc77eb2db6e4dcc.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c index 6a3b6ac3a11..b48b5187062 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -8736,7 +8736,6 @@ x_create_toolkit_scroll_bar (f, bar) | |||
| 8736 | XtSetArg (av[ac], XtNorientation, XtorientVertical); ++ac; | 8736 | XtSetArg (av[ac], XtNorientation, XtorientVertical); ++ac; |
| 8737 | /* For smoother scrolling with Xaw3d -sm */ | 8737 | /* For smoother scrolling with Xaw3d -sm */ |
| 8738 | /* XtSetArg (av[ac], XtNpickTop, True); ++ac; */ | 8738 | /* XtSetArg (av[ac], XtNpickTop, True); ++ac; */ |
| 8739 | /* XtSetArg (av[ac], XtNbeNiceToColormap, True); ++ac; */ | ||
| 8740 | 8739 | ||
| 8741 | pixel = f->output_data.x->scroll_bar_foreground_pixel; | 8740 | pixel = f->output_data.x->scroll_bar_foreground_pixel; |
| 8742 | if (pixel != -1) | 8741 | if (pixel != -1) |
| @@ -8751,7 +8750,61 @@ x_create_toolkit_scroll_bar (f, bar) | |||
| 8751 | XtSetArg (av[ac], XtNbackground, pixel); | 8750 | XtSetArg (av[ac], XtNbackground, pixel); |
| 8752 | ++ac; | 8751 | ++ac; |
| 8753 | } | 8752 | } |
| 8754 | 8753 | ||
| 8754 | /* Top/bottom shadow colors. */ | ||
| 8755 | |||
| 8756 | /* Allocate them, if necessary. */ | ||
| 8757 | if (f->output_data.x->scroll_bar_top_shadow_pixel == -1) | ||
| 8758 | { | ||
| 8759 | pixel = f->output_data.x->scroll_bar_background_pixel; | ||
| 8760 | if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), | ||
| 8761 | &pixel, 1.2, 0x8000)) | ||
| 8762 | pixel = -1; | ||
| 8763 | f->output_data.x->scroll_bar_top_shadow_pixel = pixel; | ||
| 8764 | } | ||
| 8765 | if (f->output_data.x->scroll_bar_bottom_shadow_pixel == -1) | ||
| 8766 | { | ||
| 8767 | pixel = f->output_data.x->scroll_bar_background_pixel; | ||
| 8768 | if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), | ||
| 8769 | &pixel, 0.6, 0x4000)) | ||
| 8770 | pixel = -1; | ||
| 8771 | f->output_data.x->scroll_bar_bottom_shadow_pixel = pixel; | ||
| 8772 | } | ||
| 8773 | |||
| 8774 | /* Tell the toolkit about them. */ | ||
| 8775 | if (f->output_data.x->scroll_bar_top_shadow_pixel == -1 | ||
| 8776 | || f->output_data.x->scroll_bar_bottom_shadow_pixel == -1) | ||
| 8777 | /* We tried to allocate a color for the top/bottom shadow, and | ||
| 8778 | failed, so tell Xaw3d to use dithering instead. */ | ||
| 8779 | { | ||
| 8780 | XtSetArg (av[ac], XtNbeNiceToColormap, True); | ||
| 8781 | ++ac; | ||
| 8782 | } | ||
| 8783 | else | ||
| 8784 | /* Tell what colors Xaw3d should use for the top/bottom shadow, to | ||
| 8785 | be more consistent with other emacs 3d colors, and since Xaw3d is | ||
| 8786 | not good at dealing with allocation failure. */ | ||
| 8787 | { | ||
| 8788 | /* This tells Xaw3d to use real colors instead of dithering for | ||
| 8789 | the shadows. */ | ||
| 8790 | XtSetArg (av[ac], XtNbeNiceToColormap, False); | ||
| 8791 | ++ac; | ||
| 8792 | |||
| 8793 | /* Specify the colors. */ | ||
| 8794 | pixel = f->output_data.x->scroll_bar_top_shadow_pixel; | ||
| 8795 | if (pixel != -1) | ||
| 8796 | { | ||
| 8797 | XtSetArg (av[ac], "topShadowPixel", pixel); | ||
| 8798 | ++ac; | ||
| 8799 | } | ||
| 8800 | pixel = f->output_data.x->scroll_bar_bottom_shadow_pixel; | ||
| 8801 | if (pixel != -1) | ||
| 8802 | { | ||
| 8803 | XtSetArg (av[ac], "bottomShadowPixel", pixel); | ||
| 8804 | ++ac; | ||
| 8805 | } | ||
| 8806 | } | ||
| 8807 | |||
| 8755 | widget = XtCreateWidget (scroll_bar_name, scrollbarWidgetClass, | 8808 | widget = XtCreateWidget (scroll_bar_name, scrollbarWidgetClass, |
| 8756 | f->output_data.x->edit_widget, av, ac); | 8809 | f->output_data.x->edit_widget, av, ac); |
| 8757 | 8810 | ||
| @@ -13139,6 +13192,13 @@ x_free_frame_resources (f) | |||
| 13139 | unload_color (f, f->output_data.x->scroll_bar_background_pixel); | 13192 | unload_color (f, f->output_data.x->scroll_bar_background_pixel); |
| 13140 | if (f->output_data.x->scroll_bar_foreground_pixel != -1) | 13193 | if (f->output_data.x->scroll_bar_foreground_pixel != -1) |
| 13141 | unload_color (f, f->output_data.x->scroll_bar_foreground_pixel); | 13194 | unload_color (f, f->output_data.x->scroll_bar_foreground_pixel); |
| 13195 | #ifdef USE_TOOLKIT_SCROLL_BARS | ||
| 13196 | /* Scrollbar shadow colors. */ | ||
| 13197 | if (f->output_data.x->scroll_bar_top_shadow_pixel != -1) | ||
| 13198 | unload_color (f, f->output_data.x->scroll_bar_top_shadow_pixel); | ||
| 13199 | if (f->output_data.x->scroll_bar_bottom_shadow_pixel != -1) | ||
| 13200 | unload_color (f, f->output_data.x->scroll_bar_bottom_shadow_pixel); | ||
| 13201 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | ||
| 13142 | if (f->output_data.x->white_relief.allocated_p) | 13202 | if (f->output_data.x->white_relief.allocated_p) |
| 13143 | unload_color (f, f->output_data.x->white_relief.pixel); | 13203 | unload_color (f, f->output_data.x->white_relief.pixel); |
| 13144 | if (f->output_data.x->black_relief.allocated_p) | 13204 | if (f->output_data.x->black_relief.allocated_p) |