diff options
author | Miles Bader <miles@gnu.org> | 2000-09-03 11:37:45 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2000-09-03 11:37:45 +0000 |
commit | 65c0ae052346801645a5f59802678224d96cd62e (patch) | |
tree | 6bf2073bc7b5eaf6a57f88fa485ac2223e5b7125 /lwlib | |
parent | 46d516e5b08d08907704f3d3cb6cd5861b2a2982 (diff) | |
download | emacs-65c0ae052346801645a5f59802678224d96cd62e.tar.gz |
(x_alloc_lighter_color_for_widget):
New extern declaration.
(make_shadow_gcs) [emacs]:
Use x_alloc_lighter_color_for_widget to do shadow calculation.
(make_shadow_gcs):
Remove code that tests whether the top shadow is dimmer than the bottom
shadow--it shouldn't ever happen.
Diffstat (limited to 'lwlib')
-rw-r--r-- | lwlib/xlwmenu.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 0ef65b518d3..1ced18a5eb2 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -46,6 +46,9 @@ extern unsigned char *gray_bitmap_bits; /* Defined in xterm.c. */ extern int x_alloc_nearest_color_for_widget __P ((Widget, Colormap, XColor*)); +extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, + unsigned long *, + double, int)); extern int x_catch_errors __P ((Display*)); extern int x_uncatch_errors __P ((Display*, int)); extern int x_had_errors_p __P ((Display*)); @@ -1476,14 +1479,16 @@ make_shadow_gcs (mw) mw->menu.top_shadow_color == mw->menu.foreground) { topc.pixel = mw->core.background_pixel; +#ifdef emacs + if (x_alloc_lighter_color_for_widget ((Widget) mw, dpy, cmap, + &topc.pixel, + 1.2, 0x8000)) +#else XQueryColor (dpy, cmap, &topc); /* don't overflow/wrap! */ topc.red = MINL (65535, topc.red * 1.2); topc.green = MINL (65535, topc.green * 1.2); topc.blue = MINL (65535, topc.blue * 1.2); -#ifdef emacs - if (x_alloc_nearest_color_for_widget ((Widget) mw, cmap, &topc)) -#else if (XAllocColor (dpy, cmap, &topc)) #endif { @@ -1496,13 +1501,15 @@ make_shadow_gcs (mw) mw->menu.bottom_shadow_color == mw->core.background_pixel) { botc.pixel = mw->core.background_pixel; +#ifdef emacs + if (x_alloc_lighter_color_for_widget ((Widget) mw, dpy, cmap, + &botc.pixel, + 0.6, 0x4000)) +#else XQueryColor (dpy, cmap, &botc); botc.red *= 0.6; botc.green *= 0.6; botc.blue *= 0.6; -#ifdef emacs - if (x_alloc_nearest_color_for_widget ((Widget) mw, cmap, &botc)) -#else if (XAllocColor (dpy, cmap, &botc)) #endif { @@ -1514,15 +1521,7 @@ make_shadow_gcs (mw) if (top_frobbed && bottom_frobbed) { - int top_avg = ((topc.red / 3) + (topc.green / 3) + (topc.blue / 3)); - int bot_avg = ((botc.red / 3) + (botc.green / 3) + (botc.blue / 3)); - if (bot_avg > top_avg) - { - Pixel tmp = mw->menu.top_shadow_color; - mw->menu.top_shadow_color = mw->menu.bottom_shadow_color; - mw->menu.bottom_shadow_color = tmp; - } - else if (topc.pixel == botc.pixel) + if (topc.pixel == botc.pixel) { if (botc.pixel == mw->menu.foreground) { |