/* Implements a lightweight menubar widget.
+
Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright (C) 1994-1995, 1997, 1999-2011 Free Software Foundation, Inc.
This file is part of the Lucid Widget Library.
#endif
#include <setjmp.h>
-#include "lisp.h"
+#include <lisp.h>
#include <stdio.h>
#include <ctype.h>
extern int gray_bitmap_height;
extern char *gray_bitmap_bits;
-#include "xterm.h"
+#include <xterm.h>
#else /* not emacs */
static int pointer_grabbed;
static XEvent menu_post_event;
-static XFontStruct *xlwmenu_default_font;
-
static char
xlwMenuTranslations [] =
"<BtnDown>: start()\n\
offset(menu.fontSet), XtRFontSet, NULL},
#endif
#ifdef HAVE_XFT
-#define DEFAULT_FACENAME "Sans-10"
- {XtNfaceName, XtCFaceName, XtRString, sizeof(String),
- offset(menu.faceName), XtRString, DEFAULT_FACENAME},
- {XtNdefaultFace, XtCDefaultFace, XtRInt, sizeof(int),
- offset(menu.default_face), XtRImmediate, (XtPointer)1},
+#define DEFAULT_FONTNAME "Sans-10"
+#else
+#define DEFAULT_FONTNAME "XtDefaultFont"
#endif
- {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- offset(menu.font), XtRString, "XtDefaultFont"},
+ {XtNfont, XtCFont, XtRString, sizeof(String),
+ offset(menu.fontName), XtRString, DEFAULT_FONTNAME },
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
offset(menu.foreground), XtRString, "XtDefaultForeground"},
{XtNdisabledForeground, XtCDisabledForeground, XtRPixel, sizeof(Pixel),
};
#undef offset
-static Boolean XlwMenuSetValues();
-static void XlwMenuRealize();
-static void XlwMenuResize();
-static void XlwMenuInitialize();
-static void XlwMenuRedisplay();
-static void XlwMenuDestroy();
-static void XlwMenuClassInitialize();
-static void Start();
-static void Drag();
-static void Down();
-static void Up();
-static void Left();
-static void Right();
-static void Select();
-static void Key();
-static void Nothing();
+static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new,
+ ArgList args, Cardinal *num_args);
+static void XlwMenuRealize(Widget, Mask *, XSetWindowAttributes *);
+static void XlwMenuResize(Widget w);
+static void XlwMenuInitialize(Widget, Widget, ArgList, Cardinal *);
+static void XlwMenuRedisplay(Widget w, XEvent *ev, Region region);
+static void XlwMenuDestroy(Widget w);
+static void XlwMenuClassInitialize(void);
+static void Start(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Drag(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Down(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Up(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Left(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Right(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Select(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Key(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+static void Nothing(Widget w, XEvent *ev, String *params, Cardinal *num_params);
static int separator_height (enum menu_separator);
static void pop_up_menu (XlwMenuWidget, XButtonPressedEvent *);
-
+static void abort_gracefully (Widget w) NO_RETURN;
static XtActionsRec
xlwMenuActionsList [] =
/* Ungrab pointer and keyboard */
static void
-ungrab_all (w, ungrabtime)
- Widget w;
- Time ungrabtime;
+ungrab_all (Widget w, Time ungrabtime)
{
XtUngrabPointer (w, ungrabtime);
if (GRAB_KEYBOARD) XtUngrabKeyboard (w, ungrabtime);
/* Like abort, but remove grabs from widget W before. */
static void
-abort_gracefully (w)
- Widget w;
+abort_gracefully (Widget w)
{
if (XtIsShell (XtParent (w)))
XtRemoveGrab (w);
}
static void
-push_new_stack (mw, val)
- XlwMenuWidget mw;
- widget_value* val;
+push_new_stack (XlwMenuWidget mw, widget_value *val)
{
if (!mw->menu.new_stack)
{
}
static void
-pop_new_stack_if_no_contents (mw)
- XlwMenuWidget mw;
+pop_new_stack_if_no_contents (XlwMenuWidget mw)
{
if (mw->menu.new_depth > 1)
{
}
static void
-make_old_stack_space (mw, n)
- XlwMenuWidget mw;
- int n;
+make_old_stack_space (XlwMenuWidget mw, int n)
{
if (!mw->menu.old_stack)
{
\f/* Size code */
static int
-string_width (mw, s)
- XlwMenuWidget mw;
- char *s;
+string_width (XlwMenuWidget mw, char *s)
{
XCharStruct xcs;
int drop;
#endif
static int
-arrow_width (mw)
- XlwMenuWidget mw;
+arrow_width (XlwMenuWidget mw)
{
return (MENU_FONT_ASCENT (mw) * 3/4) | 1;
}
/* Return the width of toggle buttons of widget MW. */
static int
-toggle_button_width (mw)
- XlwMenuWidget mw;
+toggle_button_width (XlwMenuWidget mw)
{
return (MENU_FONT_HEIGHT (mw) * 2 / 3) | 1;
}
/* Return the width of radio buttons of widget MW. */
static int
-radio_button_width (mw)
- XlwMenuWidget mw;
+radio_button_width (XlwMenuWidget mw)
{
return toggle_button_width (mw) * 1.41;
}
};
static char*
-resource_widget_value (mw, val)
- XlwMenuWidget mw;
- widget_value *val;
+resource_widget_value (XlwMenuWidget mw, widget_value *val)
{
if (!val->toolkit_data)
{
/* Returns the sizes of an item */
static void
-size_menu_item (mw, val, horizontal_p, label_width, rest_width, button_width,
- height)
- XlwMenuWidget mw;
- widget_value* val;
- int horizontal_p;
- int* label_width;
- int* rest_width;
- int* button_width;
- int* height;
+size_menu_item (XlwMenuWidget mw,
+ widget_value* val,
+ int horizontal_p,
+ int* label_width,
+ int* rest_width,
+ int* button_width,
+ int* height)
{
enum menu_separator separator;
}
static void
-size_menu (mw, level)
- XlwMenuWidget mw;
- int level;
+size_menu (XlwMenuWidget mw, int level)
{
- unsigned int label_width = 0;
+ int label_width = 0;
int rest_width = 0;
int button_width = 0;
int max_rest_width = 0;
int max_button_width = 0;
- unsigned int height = 0;
+ int height = 0;
int horizontal_p = mw->menu.horizontal && (level == 0);
widget_value* val;
window_state* ws;
\f/* Display code */
static void
-draw_arrow (mw, window, gc, x, y, width, down_p)
- XlwMenuWidget mw;
- Window window;
- GC gc;
- int x;
- int y;
- int width;
- int down_p;
+draw_arrow (XlwMenuWidget mw,
+ Window window,
+ GC gc,
+ int x,
+ int y,
+ int width,
+ int down_p)
{
Display *dpy = XtDisplay (mw);
GC top_gc = mw->menu.shadow_top_gc;
static void
-draw_shadow_rectangle (mw, window, x, y, width, height, erase_p, down_p)
- XlwMenuWidget mw;
- Window window;
- int x;
- int y;
- int width;
- int height;
- int erase_p;
- int down_p;
+draw_shadow_rectangle (XlwMenuWidget mw,
+ Window window,
+ int x,
+ int y,
+ int width,
+ int height,
+ int erase_p,
+ int down_p)
{
Display *dpy = XtDisplay (mw);
GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc;
static void
-draw_shadow_rhombus (mw, window, x, y, width, height, erase_p, down_p)
- XlwMenuWidget mw;
- Window window;
- int x;
- int y;
- int width;
- int height;
- int erase_p;
- int down_p;
+draw_shadow_rhombus (XlwMenuWidget mw,
+ Window window,
+ int x,
+ int y,
+ int width,
+ int height,
+ int erase_p,
+ int down_p)
{
Display *dpy = XtDisplay (mw);
GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc;
toggle button is selected. */
static void
-draw_toggle (mw, window, x, y, selected_p)
- XlwMenuWidget mw;
- Window window;
- int x, y, selected_p;
+draw_toggle (XlwMenuWidget mw, Window window, int x, int y, int selected_p)
{
int width, height;
toggle button is selected. */
static void
-draw_radio (mw, window, x, y, selected_p)
- XlwMenuWidget mw;
- Window window;
- int x, y, selected_p;
+draw_radio (XlwMenuWidget mw, Window window, int x, int y, int selected_p)
{
int width, height;
separator to draw. TYPE is the separator type. */
static void
-draw_separator (mw, window, x, y, width, type)
- XlwMenuWidget mw;
- Window window;
- int x, y, width;
- enum menu_separator type;
+draw_separator (XlwMenuWidget mw,
+ Window window,
+ int x,
+ int y,
+ int width,
+ enum menu_separator type)
{
Display *dpy = XtDisplay (mw);
XGCValues xgcv;
/* Return the pixel height of menu separator SEPARATOR. */
static int
-separator_height (separator)
- enum menu_separator separator;
+separator_height (enum menu_separator separator)
{
switch (separator)
{
the menu item was. */
static void
-display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
- just_compute_p)
- XlwMenuWidget mw;
- widget_value* val;
- window_state* ws;
- XPoint* where;
- Boolean highlighted_p;
- Boolean horizontal_p;
- Boolean just_compute_p;
+display_menu_item (XlwMenuWidget mw,
+ widget_value* val,
+ window_state* ws,
+ XPoint* where,
+ Boolean highlighted_p,
+ Boolean horizontal_p,
+ Boolean just_compute_p)
{
GC deco_gc;
GC text_gc;
#ifdef HAVE_XFT
if (ws->xft_draw)
{
- XGlyphInfo gi;
int draw_x = ws->width - ws->max_rest_width
+ mw->menu.arrow_spacing;
int draw_y = y + v_spacing + shadow + font_ascent;
}
static void
-display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return)
- XlwMenuWidget mw;
- int level;
- Boolean just_compute_p;
- XPoint* highlighted_pos;
- XPoint* hit;
- widget_value** hit_return;
+display_menu (XlwMenuWidget mw,
+ int level,
+ Boolean just_compute_p,
+ XPoint *highlighted_pos,
+ XPoint *hit,
+ widget_value **hit_return)
{
widget_value* val;
widget_value* following_item;
{
if (val->enabled)
*hit_return = val;
- else
+ else
no_return = 1;
- if (mw->menu.inside_entry != val)
+ if (mw->menu.inside_entry != val)
{
if (mw->menu.inside_entry)
XtCallCallbackList ((Widget)mw, mw->menu.leave,
\f/* Motion code */
static void
-set_new_state (mw, val, level)
- XlwMenuWidget mw;
- widget_value* val;
- int level;
+set_new_state (XlwMenuWidget mw, widget_value *val, int level)
{
int i;
for (i = 0; i < mw->menu.windows_length; ++i)
if (mw->menu.windows [i].w == widget) break;
if (i < mw->menu.windows_length && i < mw->menu.old_depth)
- display_menu (mw, i, False, NULL, NULL, NULL, NULL, NULL);
+ display_menu (mw, i, False, NULL, NULL, NULL);
}
static void
static void
-make_windows_if_needed (mw, n)
- XlwMenuWidget mw;
- int n;
+make_windows_if_needed (XlwMenuWidget mw, int n)
{
int i;
int start_at;
window_state* windows;
-#ifdef HAVE_XFT
- int screen = XScreenNumberOfScreen (mw->core.screen);
-#endif
if (mw->menu.windows_length >= n)
return;
#endif
set_window_type (windows [i].w, mw);
}
+ XFlush (XtDisplay (mw));
}
/* Value is non-zero if WINDOW is part of menu bar widget W. */
int
-xlwmenu_window_p (w, window)
- Widget w;
- Window window;
+xlwmenu_window_p (Widget w, Window window)
{
XlwMenuWidget mw = (XlwMenuWidget) w;
int i;
/* Make the window fit in the screen */
static void
-fit_to_screen (mw, ws, previous_ws, horizontal_p)
- XlwMenuWidget mw;
- window_state* ws;
- window_state* previous_ws;
- Boolean horizontal_p;
+fit_to_screen (XlwMenuWidget mw,
+ window_state *ws,
+ window_state *previous_ws,
+ Boolean horizontal_p)
{
unsigned int screen_width = WidthOfScreen (XtScreen (mw));
unsigned int screen_height = HeightOfScreen (XtScreen (mw));
static void
create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw)
{
- if (ws->pixmap != None)
+ if (ws->pixmap != None)
{
XFreePixmap (XtDisplay (ws->w), ws->pixmap);
ws->pixmap = None;
/* Updates old_stack from new_stack and redisplays. */
static void
-remap_menubar (mw)
- XlwMenuWidget mw;
+remap_menubar (XlwMenuWidget mw)
{
int i;
int last_same;
fit_to_screen (mw, ws, previous_ws, mw->menu.horizontal && i == 1);
- XtVaSetValues (ws->w, XtNwidth, ws->width, XtNheight, ws->height,
- XtNx, ws->x, XtNy, ws->y, NULL);
create_pixmap_for_menu (ws, mw);
+ XtMoveWidget (ws->w, ws->x, ws->y);
XtPopup (ws->w, XtGrabNone);
+ XtResizeWidget (ws->w, ws->width, ws->height,
+ mw->core.border_width);
+ XtResizeWindow (ws->w);
display_menu (mw, i, False, &selection_position, NULL, NULL);
}
}
static Boolean
-motion_event_is_in_menu (mw, ev, level, relative_pos)
- XlwMenuWidget mw;
- XMotionEvent* ev;
- int level;
- XPoint* relative_pos;
+motion_event_is_in_menu (XlwMenuWidget mw,
+ XMotionEvent *ev,
+ int level,
+ XPoint *relative_pos)
{
window_state* ws = &mw->menu.windows [level];
int shadow = level == 0 ? 0 : mw->menu.shadow_thickness;
}
static Boolean
-map_event_to_widget_value (mw, ev, val, level)
- XlwMenuWidget mw;
- XMotionEvent* ev;
- widget_value** val;
- int* level;
+map_event_to_widget_value (XlwMenuWidget mw,
+ XMotionEvent *ev,
+ widget_value **val,
+ int *level)
{
int i;
XPoint relative_pos;
}
}
- if (!inside)
+ if (!inside)
{
- if (mw->menu.inside_entry != NULL)
+ if (mw->menu.inside_entry != NULL)
XtCallCallbackList ((Widget)mw, mw->menu.leave,
(XtPointer) mw->menu.inside_entry);
mw->menu.inside_entry = NULL;
\f/* Procedures */
static void
-make_drawing_gcs (mw)
- XlwMenuWidget mw;
+make_drawing_gcs (XlwMenuWidget mw)
{
XGCValues xgcv;
float scale;
XtGCMask mask = GCForeground | GCBackground;
#ifdef HAVE_X_I18N
- if (!mw->menu.fontSet)
+ if (!mw->menu.fontSet && mw->menu.font)
{
xgcv.font = mw->menu.font->fid;
mask |= GCFont;
}
#else
- xgcv.font = mw->menu.font->fid;
- mask |= GCFont;
+ if (mw->menu.font)
+ {
+ xgcv.font = mw->menu.font->fid;
+ mask |= GCFont;
+ }
#endif
xgcv.foreground = mw->menu.foreground;
xgcv.background = mw->core.background_pixel;
}
static void
-release_drawing_gcs (mw)
- XlwMenuWidget mw;
+release_drawing_gcs (XlwMenuWidget mw)
{
XtReleaseGC ((Widget) mw, mw->menu.foreground_gc);
XtReleaseGC ((Widget) mw, mw->menu.button_gc);
mw->menu.background_gc = (GC) -1;
}
+#ifndef emacs
#define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
? ((unsigned long) (x)) : ((unsigned long) (y)))
+#endif
static void
-make_shadow_gcs (mw)
- XlwMenuWidget mw;
+make_shadow_gcs (XlwMenuWidget mw)
{
XGCValues xgcv;
unsigned long pm = 0;
static void
-release_shadow_gcs (mw)
- XlwMenuWidget mw;
+release_shadow_gcs (XlwMenuWidget mw)
{
Display *dpy = XtDisplay ((Widget) mw);
Screen *screen = XtScreen ((Widget) mw);
}
#ifdef HAVE_XFT
+static XftFont *
+getDefaultXftFont (XlwMenuWidget mw)
+{
+ int screen = XScreenNumberOfScreen (mw->core.screen);
+ return XftFontOpenName (XtDisplay (mw), screen, DEFAULT_FONTNAME);
+}
+
static int
-openXftFont (mw)
- XlwMenuWidget mw;
+openXftFont (XlwMenuWidget mw)
{
- char *fname = mw->menu.faceName;
+ char *fname = mw->menu.fontName;
mw->menu.xft_font = 0;
- mw->menu.default_face = fname && strcmp (fname, DEFAULT_FACENAME) == 0;
+ mw->menu.default_face = fname && strcmp (fname, DEFAULT_FONTNAME) == 0;
if (fname && strcmp (fname, "none") != 0)
{
--i;
if (fname[i] == ' ')
{
- fname = xstrdup (mw->menu.faceName);
+ fname = xstrdup (mw->menu.fontName);
fname[i] = '-';
}
- mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
- if (!mw->menu.xft_font)
+ mw->menu.font = XLoadQueryFont (XtDisplay (mw), fname);
+ if (!mw->menu.font)
{
- fprintf (stderr, "Can't find font '%s'\n", fname);
- mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen,
- DEFAULT_FACENAME);
+ mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
+ if (!mw->menu.xft_font)
+ {
+ fprintf (stderr, "Can't find font '%s'\n", fname);
+ mw->menu.xft_font = getDefaultXftFont (mw);
+ }
}
}
- if (fname != mw->menu.faceName) free (fname);
+ if (fname != mw->menu.fontName) free (fname);
return mw->menu.xft_font != 0;
}
#endif
static void
-XlwMenuInitialize (request, mw, args, num_args)
- Widget request;
- XlwMenuWidget mw;
- ArgList args;
- Cardinal *num_args;
+XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
{
/* Get the GCs and the widget size */
-
+ XlwMenuWidget mw = (XlwMenuWidget) w;
Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
Display* display = XtDisplay (mw);
/* _XtCreate is freeing the object that was passed to us,
so make a copy that we will actually keep. */
- lwlib_bcopy (mw->menu.contents, tem, sizeof (widget_value));
+ memcpy (tem, mw->menu.contents, sizeof (widget_value));
mw->menu.contents = tem;
#endif
;
else
#endif
-
- if (!mw->menu.font)
{
- if (!xlwmenu_default_font)
- xlwmenu_default_font = XLoadQueryFont (display, "fixed");
- mw->menu.font = xlwmenu_default_font;
- if (!mw->menu.font)
+ mw->menu.font = XLoadQueryFont (display, mw->menu.fontName);
+ if (!mw->menu.font)
{
- fprintf (stderr, "Menu font fixed not found, can't continue.\n");
- abort ();
+ mw->menu.font = XLoadQueryFont (display, "fixed");
+ if (!mw->menu.font)
+ {
+ fprintf (stderr, "Menu font fixed not found, can't continue.\n");
+ abort ();
+ }
}
}
if (mw->menu.fontSet)
mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet);
#endif
-
+
make_drawing_gcs (mw);
make_shadow_gcs (mw);
}
static void
-XlwMenuClassInitialize ()
+XlwMenuClassInitialize (void)
{
- xlwmenu_default_font = 0;
}
static void
-XlwMenuRealize (w, valueMask, attributes)
- Widget w;
- Mask *valueMask;
- XSetWindowAttributes *attributes;
+XlwMenuRealize (Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
{
XlwMenuWidget mw = (XlwMenuWidget)w;
XSetWindowAttributes xswa;
receives expose events through Xt. So we repaint all the other panes
when receiving an Expose event. */
static void
-XlwMenuRedisplay (w, ev, region)
- Widget w;
- XEvent* ev;
- Region region;
+XlwMenuRedisplay (Widget w, XEvent *ev, Region region)
{
XlwMenuWidget mw = (XlwMenuWidget)w;
- int i;
/* If we have a depth beyond 1, it's because a submenu was displayed.
If the submenu has been destroyed, set the depth back to 1. */
over a menu item is unmapped. */
void
-xlwmenu_redisplay (w)
- Widget w;
+xlwmenu_redisplay (Widget w)
{
XlwMenuRedisplay (w, NULL, None);
}
static void
-XlwMenuDestroy (w)
- Widget w;
+XlwMenuDestroy (Widget w)
{
int i;
XlwMenuWidget mw = (XlwMenuWidget) w;
XftFontClose (XtDisplay (mw), mw->menu.xft_font);
#endif
- if (mw->menu.windows [0].pixmap != None)
+ if (mw->menu.windows [0].pixmap != None)
XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap);
/* start from 1 because the one in slot 0 is w->core.window */
for (i = 1; i < mw->menu.windows_length; i++)
{
- if (mw->menu.windows [i].pixmap != None)
+ if (mw->menu.windows [i].pixmap != None)
XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap);
#ifdef HAVE_XFT
if (mw->menu.windows [i].xft_draw)
#ifdef HAVE_XFT
static int
-facename_changed (XlwMenuWidget newmw,
+fontname_changed (XlwMenuWidget newmw,
XlwMenuWidget oldmw)
{
- /* This will fore a new XftFont even if the same string is set.
+ /* This will force a new XftFont even if the same string is set.
This is good, as rendering parameters may have changed and
we just want to do a redisplay. */
- return newmw->menu.faceName != oldmw->menu.faceName;
+ return newmw->menu.fontName != oldmw->menu.fontName;
}
#endif
static Boolean
-XlwMenuSetValues (current, request, new)
- Widget current;
- Widget request;
- Widget new;
+XlwMenuSetValues (Widget current, Widget request, Widget new,
+ ArgList args, Cardinal *num_args)
{
XlwMenuWidget oldmw = (XlwMenuWidget)current;
XlwMenuWidget newmw = (XlwMenuWidget)new;
- Boolean redisplay = False;
- int i;
+ Boolean do_redisplay = False;
if (newmw->menu.contents
&& newmw->menu.contents->contents
&& newmw->menu.contents->contents->change >= VISIBLE_CHANGE)
- redisplay = True;
+ do_redisplay = True;
/* Do redisplay if the contents are entirely eliminated. */
if (newmw->menu.contents
&& newmw->menu.contents->contents == 0
&& newmw->menu.contents->change >= VISIBLE_CHANGE)
- redisplay = True;
+ do_redisplay = True;
if (newmw->core.background_pixel != oldmw->core.background_pixel
|| newmw->menu.foreground != oldmw->menu.foreground
#ifdef HAVE_XFT
- || facename_changed (newmw, oldmw)
+ || fontname_changed (newmw, oldmw)
#endif
#ifdef HAVE_X_I18N
|| newmw->menu.fontSet != oldmw->menu.fontSet
#endif
)
{
+ int i;
release_drawing_gcs (newmw);
make_drawing_gcs (newmw);
newmw->menu.bottom_shadow_color = -1;
make_shadow_gcs (newmw);
- redisplay = True;
+ do_redisplay = True;
if (XtIsRealized (current))
/* If the menu is currently displayed, change the display. */
}
#ifdef HAVE_XFT
- if (facename_changed (newmw, oldmw))
+ if (fontname_changed (newmw, oldmw))
{
int i;
int screen = XScreenNumberOfScreen (newmw->core.screen);
#ifdef HAVE_X_I18N
if (newmw->menu.fontSet != oldmw->menu.fontSet && newmw->menu.fontSet != NULL)
{
- redisplay = True;
+ do_redisplay = True;
newmw->menu.font_extents = XExtentsOfFontSet (newmw->menu.fontSet);
}
#endif
- return redisplay;
+ return do_redisplay;
}
static void
-XlwMenuResize (w)
- Widget w;
+XlwMenuResize (Widget w)
{
XlwMenuWidget mw = (XlwMenuWidget)w;
\f/* Action procedures */
static void
-handle_single_motion_event (mw, ev)
- XlwMenuWidget mw;
- XMotionEvent* ev;
+handle_single_motion_event (XlwMenuWidget mw, XMotionEvent *ev)
{
widget_value* val;
int level;
}
static void
-handle_motion_event (mw, ev)
- XlwMenuWidget mw;
- XMotionEvent* ev;
+handle_motion_event (XlwMenuWidget mw, XMotionEvent *ev)
{
int x = ev->x_root;
int y = ev->y_root;
}
static void
-Start (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Start (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
XlwMenuWidget mw = (XlwMenuWidget)w;
}
static void
-Drag (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Drag (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
XlwMenuWidget mw = (XlwMenuWidget)w;
if (mw->menu.popped_up)
/* Do nothing.
This is how we handle presses and releases of modifier keys. */
static void
-Nothing (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Nothing (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
}
static widget_value *
-find_first_selectable (mw, item, skip_titles)
- XlwMenuWidget mw;
- widget_value *item;
- int skip_titles;
+find_first_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles)
{
widget_value *current = item;
enum menu_separator separator;
}
static widget_value *
-find_next_selectable (mw, item, skip_titles)
- XlwMenuWidget mw;
- widget_value *item;
- int skip_titles;
+find_next_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles)
{
widget_value *current = item;
enum menu_separator separator;
}
static widget_value *
-find_prev_selectable (mw, item, skip_titles)
- XlwMenuWidget mw;
- widget_value *item;
- int skip_titles;
+find_prev_selectable (XlwMenuWidget mw, widget_value *item, int skip_titles)
{
widget_value *current = item;
widget_value *prev = item;
}
static void
-Down (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Down (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
XlwMenuWidget mw = (XlwMenuWidget) w;
widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
}
static void
-Up (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Up (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
XlwMenuWidget mw = (XlwMenuWidget) w;
widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
}
void
-Left (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Left (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
XlwMenuWidget mw = (XlwMenuWidget) w;
widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
}
void
-Right (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Right (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
XlwMenuWidget mw = (XlwMenuWidget) w;
widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
/* Handle key press and release events while menu is popped up.
Our action is to get rid of the menu. */
static void
-Key (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Key (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
XlwMenuWidget mw = (XlwMenuWidget)w;
}
static void
-Select (w, ev, params, num_params)
- Widget w;
- XEvent *ev;
- String *params;
- Cardinal *num_params;
+Select (Widget w, XEvent *ev, String *params, Cardinal *num_params)
{
XlwMenuWidget mw = (XlwMenuWidget)w;
widget_value* selected_item = mw->menu.old_stack [mw->menu.old_depth - 1];
\f/* Special code to pop-up a menu */
static void
-pop_up_menu (mw, event)
- XlwMenuWidget mw;
- XButtonPressedEvent* event;
+pop_up_menu (XlwMenuWidget mw, XButtonPressedEvent *event)
{
int x = event->x_root;
int y = event->y_root;
((XMotionEvent*)event)->is_hint = 0;
handle_motion_event (mw, (XMotionEvent*)event);
}
-
-/* arch-tag: 657f43dd-dfd0-4cc9-910c-52935f01176e
- (do not change this comment) */