Mercurial > emacs
comparison src/xterm.c @ 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 | 2ca67ed01cd8 |
children | 45d46b88cdd1 |
comparison
equal
deleted
inserted
replaced
39617:d39706d66016 | 39618:6d60a3a33839 |
---|---|
8734 to their taste with `emacs*verticalScrollBar.background: xxx'. */ | 8734 to their taste with `emacs*verticalScrollBar.background: xxx'. */ |
8735 XtSetArg (av[ac], XtNmappedWhenManaged, False); ++ac; | 8735 XtSetArg (av[ac], XtNmappedWhenManaged, False); ++ac; |
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) |
8743 { | 8742 { |
8744 XtSetArg (av[ac], XtNforeground, pixel); | 8743 XtSetArg (av[ac], XtNforeground, pixel); |
8749 if (pixel != -1) | 8748 if (pixel != -1) |
8750 { | 8749 { |
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 |
8758 { | 8811 { |
8759 char *initial = ""; | 8812 char *initial = ""; |
13137 | 13190 |
13138 if (f->output_data.x->scroll_bar_background_pixel != -1) | 13191 if (f->output_data.x->scroll_bar_background_pixel != -1) |
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) |
13145 unload_color (f, f->output_data.x->black_relief.pixel); | 13205 unload_color (f, f->output_data.x->black_relief.pixel); |
13146 | 13206 |