Basic functions to set Lisp_Object and pointer slots of intervals.
[bpt/emacs.git] / lwlib / xlwmenu.c
index 507d1f1..e8831c3 100644 (file)
@@ -1,7 +1,7 @@
 /* Implements a lightweight menubar widget.
 
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 1994-1995, 1997, 1999-2011  Free Software Foundation, Inc.
+Copyright (C) 1994-1995, 1997, 1999-2012  Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
@@ -22,9 +22,7 @@ Boston, MA 02110-1301, USA.  */
 
 /* Created by devin@lucid.com */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <setjmp.h>
 #include <lisp.h>
@@ -49,22 +47,12 @@ Boston, MA 02110-1301, USA.  */
 
 #ifdef emacs
 
-/* Defined in xfns.c.  When config.h defines `static' as empty, we get
-   redefinition errors when gray_bitmap is included more than once, so
-   we're referring to the one include in xfns.c here.  */
-
-extern int gray_bitmap_width;
-extern int gray_bitmap_height;
-extern char *gray_bitmap_bits;
-
 #include <xterm.h>
+#include "bitmaps/gray.xbm"
 
 #else /* not emacs */
 
 #include <X11/bitmaps/gray>
-#define gray_bitmap_width      gray_width
-#define gray_bitmap_height     gray_height
-#define gray_bitmap_bits       gray_bits
 
 #endif /* not emacs */
 
@@ -113,7 +101,7 @@ xlwMenuTranslations [] =
 <KeyUp>:          key()\n\
 ";
 
-/* FIXME: Space should toggle toggleable menu item but not remove the menu
+/* FIXME: Space should toggle togglable menu item but not remove the menu
    so you can toggle the next one without entering the menu again.  */
 
 /* FIXME: Should ESC close one level of menu structure or the complete menu?  */
@@ -200,7 +188,6 @@ 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 [] =
@@ -283,7 +270,7 @@ ungrab_all (Widget w, Time ungrabtime)
 
 /* Like abort, but remove grabs from widget W before.  */
 
-static void
+static _Noreturn void
 abort_gracefully (Widget w)
 {
   if (XtIsShell (XtParent (w)))
@@ -1486,7 +1473,7 @@ remap_menubar (XlwMenuWidget mw)
   if (new_selection && !new_selection->enabled)
     new_selection = NULL;
 
-  /* Call callback when the hightlighted item changes.  */
+  /* Call callback when the highlighted item changes.  */
   if (old_selection || new_selection)
     XtCallCallbackList ((Widget)mw, mw->menu.highlight,
                        (XtPointer) new_selection);
@@ -1693,8 +1680,10 @@ release_drawing_gcs (XlwMenuWidget mw)
   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 (XlwMenuWidget mw)
@@ -1889,7 +1878,7 @@ openXftFont (XlwMenuWidget mw)
         }
     }
 
-  if (fname != mw->menu.fontName) free (fname);
+  if (fname != mw->menu.fontName) xfree (fname);
 
   return mw->menu.xft_font != 0;
 }
@@ -1916,8 +1905,8 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
   mw->menu.cursor = mw->menu.cursor_shape;
 
   mw->menu.gray_pixmap
-    = XCreatePixmapFromBitmapData (display, window, gray_bitmap_bits,
-                                  gray_bitmap_width, gray_bitmap_height,
+    = XCreatePixmapFromBitmapData (display, window, gray_bits,
+                                  gray_width, gray_height,
                                   (unsigned long)1, (unsigned long)0, 1);
 
 #ifdef HAVE_XFT