#include <X11/cursorfont.h>
#include <X11/bitmaps/gray>
#include "xlwmenuP.h"
+
#ifdef emacs
/* Defined in xterm.c. */
extern int x_alloc_nearest_color_for_widget __P ((Widget, Colormap, XColor*));
extern int x_uncatch_errors __P ((Display*, int));
extern int x_had_errors_p __P ((Display*));
extern int x_clear_errors __P ((Display*));
+extern unsigned long x_copy_dpy_color __P ((Display *, Colormap,
+ unsigned long));
+
+/* Defined in xfaces.c. */
+extern void x_free_dpy_colors __P ((Display *, Screen *, Colormap,
+ unsigned long *pixels, int npixels));
#endif
static int pointer_grabbed;
GC bottom_gc = !erase_p ? mw->menu.shadow_bottom_gc : mw->menu.background_gc;
int thickness = mw->menu.shadow_thickness;
XPoint points [4];
- double sqrt2 = 1.4142;
if (!erase_p && down_p)
{
else if (topc.pixel == botc.pixel)
{
if (botc.pixel == mw->menu.foreground)
- mw->menu.top_shadow_color = mw->core.background_pixel;
+ {
+ x_free_dpy_colors (dpy, screen, cmap,
+ &mw->menu.top_shadow_color, 1);
+ mw->menu.top_shadow_color
+ = x_copy_dpy_color (dpy, cmap, mw->core.background_pixel);
+ }
else
- mw->menu.bottom_shadow_color = mw->menu.foreground;
+ {
+ x_free_dpy_colors (dpy, screen, cmap,
+ &mw->menu.bottom_shadow_color, 1);
+ mw->menu.bottom_shadow_color
+ = x_copy_dpy_color (dpy, cmap, mw->menu.foreground);
+ }
}
}
mw->menu.top_shadow_color == mw->core.background_pixel)
{
mw->menu.top_shadow_pixmap = mw->menu.gray_pixmap;
- mw->menu.top_shadow_color = mw->menu.foreground;
+ if (top_frobbed)
+ x_free_dpy_colors (dpy, screen, cmap, &mw->menu.top_shadow_color, 1);
+ mw->menu.top_shadow_color = x_copy_dpy_color (dpy, cmap,
+ mw->menu.foreground);
}
if (!mw->menu.bottom_shadow_pixmap &&
mw->menu.bottom_shadow_color == mw->core.background_pixel)
{
mw->menu.bottom_shadow_pixmap = mw->menu.gray_pixmap;
- mw->menu.bottom_shadow_color = mw->menu.foreground;
+ if (bottom_frobbed)
+ x_free_dpy_colors (dpy, screen, cmap,
+ &mw->menu.bottom_shadow_color, 1);
+ mw->menu.bottom_shadow_color = x_copy_dpy_color (dpy, cmap,
+ mw->menu.foreground);
}
xgcv.fill_style = FillStippled;
release_shadow_gcs (mw)
XlwMenuWidget mw;
{
+ Display *dpy = XtDisplay ((Widget) mw);
+ Screen *screen = XtScreen ((Widget) mw);
+ Colormap cmap = mw->core.colormap;
+ Pixel px[2];
+
+ px[0] = mw->menu.top_shadow_color;
+ px[1] = mw->menu.bottom_shadow_color;
+ x_free_dpy_colors (dpy, screen, cmap, px, 2);
XtReleaseGC ((Widget) mw, mw->menu.shadow_top_gc);
XtReleaseGC ((Widget) mw, mw->menu.shadow_bottom_gc);
}