#include <dmalloc.h>
#endif
-/* simple, naieve integer maximum */
+/* simple, naive integer maximum */
#ifndef max
#define max(a,b) ((a)>(b)?(a):(b))
#endif
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(menu.font), XtRString, (XtPointer) "XtDefaultFont"},
# ifdef USE_XFONTSET
+ /* #### Consider using the same method as for Motif; see the comment in
+ XlwMenuInitialize(). */
{XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet),
offset(menu.font_set), XtRString, (XtPointer) "XtDefaultFontSet"},
# endif
XtNumber(xlwMenuResources), /* resource_count */
NULLQUARK, /* xrm_class */
TRUE, /* compress_motion */
- TRUE, /* compress_exposure */
+ XtExposeCompressMaximal, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
XlwMenuDestroy, /* destroy */
{
return
reference_time &&
- (ev->xbutton.time - reference_time < XtGetMultiClickTime (XtDisplay (w)));
+ (ev->xbutton.time - reference_time
+ < (Time) XtGetMultiClickTime (XtDisplay (w)));
}
\f/* Size code */
}
static void
-massage_resource_name (CONST char *in, char *out)
+massage_resource_name (const char *in, char *out)
{
/* Turn a random string into something suitable for using as a resource.
For example:
Boolean firstp = True;
while (*in)
{
- char ch = massaged_resource_char[(unsigned char) *in++];
- if (ch)
+ if (*in == '%' && *(in + 1) == '_')
+ in += 2;
+ else
{
- int int_ch = (int) (unsigned char) ch;
- *out++ = firstp ? tolower (int_ch) : toupper (int_ch);
- firstp = False;
- while ((ch = massaged_resource_char[(unsigned char) *in++]) != '\0')
- *out++ = ch;
- if (!*(in-1)) /* Overshot the NULL byte? */
- break;
+ char ch;
+
+ if (*in == '%' && *(in + 1) == '%')
+ in++;
+ ch = massaged_resource_char[(unsigned char) *in++];
+ if (ch)
+ {
+ int int_ch = (int) (unsigned char) ch;
+ *out++ = firstp ? tolower (int_ch) : toupper (int_ch);
+ firstp = False;
+ while ((ch = massaged_resource_char[(unsigned char) *in++])
+ != '\0')
+ *out++ = ch;
+ if (!*(in-1)) /* Overshot the NULL byte? */
+ break;
+ }
}
}
*out = 0;
0, XtRImmediate, 0 }
};
-/*
- * This function looks through string searching for parameter
- * inserts of the form:
- * %[padding]1
- * padding is space (' ') or dash ('-') characters meaning
- * padding to the left or right of the inserted parameter.
- * In essence all %1 strings are replaced by value in the return
- * value (which the caller is expected to free).
- * %% means insert one % (like printf).
- * %1 means insert value.
- * %-1 means insert value followed by one space. The latter is
- * not inserted if value is a zero length string.
- */
+/* This function searches STRING for parameter inserts of the form:
+ %[padding]1
+ padding is either space (' ') or dash ('-') meaning
+ padding to the left or right of the inserted parameter.
+ In essence, all %1 strings are replaced by VALUE in the return value.
+ The caller is expected to free the return value using XtFree().
+ %% means insert one % (like printf).
+ %1 means insert VALUE.
+ %-1 means insert VALUE followed by one space. The latter is
+ not inserted if VALUE is a zero length string.
+*/
static char*
-parameterize_string (CONST char *string, CONST char *value)
+parameterize_string (const char *string, const char *value)
{
- char *percent;
+ const char *percent;
char *result;
unsigned int done = 0;
unsigned int ntimes;
{
result = XtMalloc(1);
result[0] = '\0';
- return (result);
+ return result;
}
if (!value)
value = "";
- for (ntimes = 1, result = (char *) string; (percent = strchr(result, '%'));
+ for (ntimes = 1, percent = string;
+ (percent = strchr (percent, '%'));
ntimes++)
- result = &percent[1];
+ percent++;
result = XtMalloc ((ntimes * strlen(value)) + strlen(string) + 4);
result[0] = '\0';
- while ((percent = strchr(string, '%')))
+ while ((percent = strchr (string, '%')))
{
unsigned int left_pad;
unsigned int right_pad;
- char *p;
+ const char *p;
if (percent[1] == '%')
{ /* it's a real % */
/* Unused */
#if 0
-/* These two routines should be a seperate file..djw */
+/* These two routines should be a separate file..djw */
static char *
xlw_create_localized_string (Widget w,
char *name,
else
return TEXT_TYPE;
#else
- else
+ else
abort();
return UNSPECIFIED_TYPE; /* Not reached */
#endif
2 * mw->menu.vertical_margin +
2 * mw->menu.shadow_thickness);
/* no left column decoration */
- *toggle_width = mw->menu.horizontal_margin + mw->menu.shadow_thickness;;
+ *toggle_width = mw->menu.horizontal_margin + mw->menu.shadow_thickness;
*label_width = string_width_u (mw, resource_widget_value (mw, val));
*bindings_width = mw->menu.horizontal_margin + mw->menu.shadow_thickness;
static struct _shadow_names
{
- CONST char * name;
+ const char * name;
shadow_type type;
} shadow_names[] =
{
int start_at;
XSetWindowAttributes xswa;
Widget p;
- int mask;
+ unsigned long mask;
int depth;
Visual *visual;
window_state *windows;
mw->menu.old_depth = new_depth;
- /* refresh the last seletion */
+ /* refresh the last selection */
selection_position.x = 0;
selection_position.y = 0;
display_menu (mw, last_same, new_selection == old_selection,
xgcv.foreground = mw->menu.top_shadow_color;
xgcv.background = mw->core.background_pixel;
/* xgcv.stipple = mw->menu.top_shadow_pixmap; gtb */
-#ifdef NEED_MOTIF
if (mw->menu.top_shadow_pixmap &&
mw->menu.top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)
xgcv.stipple = mw->menu.top_shadow_pixmap;
else
xgcv.stipple = 0;
-#else
- xgcv.stipple = mw->menu.top_shadow_pixmap;
-#endif /* NEED_MOTIF */
pm = (xgcv.stipple ? GCStipple|GCFillStyle : 0);
mw->menu.shadow_top_gc =
XtGetGC((Widget)mw, GCForeground|GCBackground|pm, &xgcv);
xgcv.foreground = mw->menu.bottom_shadow_color;
/* xgcv.stipple = mw->menu.bottom_shadow_pixmap; gtb */
-#ifdef NEED_MOTIF
- if (mw->menu.top_shadow_pixmap &&
- mw->menu.top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)
+ if (mw->menu.bottom_shadow_pixmap &&
+ mw->menu.bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)
xgcv.stipple = mw->menu.bottom_shadow_pixmap;
else
xgcv.stipple = 0;
-#else
- xgcv.stipple = mw->menu.bottom_shadow_pixmap;
-#endif /* NEED_MOTIF */
pm = (xgcv.stipple ? GCStipple|GCFillStyle : 0);
mw->menu.shadow_bottom_gc =
XtGetGC ((Widget)mw, GCForeground|GCBackground|pm, &xgcv);
{
/* Get the GCs and the widget size */
XlwMenuWidget mw = (XlwMenuWidget)new;
-
- XSetWindowAttributes xswa;
- int mask;
-
Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
Display *display = XtDisplay (mw);
gray_width, gray_height, 1, 0, 1);
#ifdef NEED_MOTIF
+ /* #### Even if it's a kludge!!!, we should consider doing the same for
+ X Font Sets. */
/* The menu.font_list slot came from the *fontList resource (Motif standard.)
The menu.font_list_2 slot came from the *font resource, for backward
compatibility with older versions of this code, and consistency with the
- rest of emacs. If both font and fontList are specified, we use font.
+ rest of emacs. If both font and fontList are specified, we use fontList.
If only one is specified, we use that. If neither are specified, we
use the "fallback" value. What a kludge!!!
make_shadow_gcs (mw);
extract_font_extents (mw);
- xswa.background_pixel = mw->core.background_pixel;
- xswa.border_pixel = mw->core.border_pixel;
- mask = CWBackPixel | CWBorderPixel;
-
mw->menu.popped_up = False;
mw->menu.pointer_grabbed = False;
mw->menu.next_release_must_exit = False;
{
XlwMenuWidget mw = (XlwMenuWidget)w;
XSetWindowAttributes xswa;
- int mask;
+ unsigned long mask;
(*xlwMenuWidgetClass->core_class.superclass->core_class.realize)
(w, valueMask, attributes);
if (!mw->menu.pointer_grabbed)
{
XWindowAttributes ret;
- Window parent,root;
- Window *waste;
+ Window parent,root = 0UL;
+ Window *waste = NULL;
unsigned int num_waste;
lw_menu_active = True;