/* The lwlib interface to "xlwmenu" menus.
- Copyright (C) 1992 Lucid, Inc.
- Copyright (C) 1994, 2000, 2001 Free Software Foundation, Inc.
+
+Copyright (C) 1992 Lucid, Inc.
+Copyright (C) 1994, 2000-2011 Free Software Foundation, Inc.
This file is part of the Lucid Widget Library.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "lisp.h"
+#include <setjmp.h>
+#include <lisp.h>
#include "lwlib-Xlw.h"
#include <X11/StringDefs.h>
This is sometimes handy to have available. */
void
-x_print_complete_resource_name (widget)
- Widget widget;
+x_print_complete_resource_name (Widget widget)
{
int i;
String names[100];
if there isn't any highlighted menu item. */
static void
-highlight_hook (w, client_data, call_data)
- Widget w;
- XtPointer client_data;
- XtPointer call_data;
+highlight_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
widget_instance *instance = (widget_instance *) client_data;
}
static void
-pre_hook (w, client_data, call_data)
- Widget w;
- XtPointer client_data;
- XtPointer call_data;
+enter_hook (Widget w, XtPointer client_data, XtPointer call_data)
+{
+ highlight_hook (w, client_data, call_data);
+}
+
+static void
+leave_hook (Widget w, XtPointer client_data, XtPointer call_data)
+{
+ highlight_hook (w, client_data, NULL);
+}
+
+
+static void
+pre_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
widget_instance* instance = (widget_instance*)client_data;
widget_value* val;
}
static void
-pick_hook (w, client_data, call_data)
- Widget w;
- XtPointer client_data;
- XtPointer call_data;
+pick_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
widget_instance* instance = (widget_instance*)client_data;
widget_value* contents_val = (widget_value*)call_data;
\f/* creation functions */
static Widget
-xlw_create_menubar (instance)
- widget_instance* instance;
+xlw_create_menubar (widget_instance *instance)
{
Widget widget;
Arg al[5];
XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance);
XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
- XtAddCallback (widget, XtNhighlightCallback, highlight_hook,
- (XtPointer)instance);
+ XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance);
+ XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance);
return widget;
}
static Widget
-xlw_create_popup_menu (instance)
- widget_instance* instance;
+xlw_create_popup_menu (widget_instance *instance)
{
Widget popup_shell
= XtCreatePopupShell (instance->info->name, overrideShellWidgetClass,
popup_shell, al, ac);
XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
- XtAddCallback (widget, XtNhighlightCallback, highlight_hook,
- (XtPointer)instance);
+ XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance);
+ XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance);
+
return popup_shell;
}
};
Boolean
-lw_lucid_widget_p (widget)
- Widget widget;
+lw_lucid_widget_p (Widget widget)
{
WidgetClass the_class = XtClass (widget);
}
void
-#ifdef PROTOTYPES
xlw_update_one_widget (widget_instance* instance, Widget widget,
widget_value* val, Boolean deep_p)
-#else
-xlw_update_one_widget (instance, widget, val, deep_p)
- widget_instance* instance;
- Widget widget;
- widget_value* val;
- Boolean deep_p;
-#endif
{
Arg al[1];
}
void
-xlw_update_one_value (instance, widget, val)
- widget_instance* instance;
- Widget widget;
- widget_value* val;
+xlw_update_one_value (widget_instance *instance,
+ Widget widget,
+ widget_value *val)
{
return;
}
void
-#ifdef PROTOTYPES
xlw_pop_instance (widget_instance* instance, Boolean up)
-#else
-xlw_pop_instance (instance, up)
- widget_instance* instance;
- Boolean up;
-#endif
{
}
void
-xlw_popup_menu (widget, event)
- Widget widget;
- XEvent *event;
+xlw_popup_menu (Widget widget, XEvent *event)
{
- XButtonPressedEvent dummy;
XlwMenuWidget mw;
if (!XtIsShell (widget))
mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
if (event)
- pop_up_menu (mw, (XButtonPressedEvent*) event);
+ XtCallActionProc ((Widget) mw, "start", event, NULL, 0);
else
{
- dummy.type = ButtonPress;
- dummy.serial = 0;
- dummy.send_event = 0;
- dummy.display = XtDisplay (widget);
- dummy.window = XtWindow (XtParent (widget));
- dummy.time = CurrentTime;
- dummy.button = 0;
- XQueryPointer (dummy.display, dummy.window, &dummy.root,
- &dummy.subwindow, &dummy.x_root, &dummy.y_root,
- &dummy.x, &dummy.y, &dummy.state);
-
- pop_up_menu (mw, &dummy);
+ XEvent dummy;
+ XButtonPressedEvent *bd = &dummy.xbutton;
+
+ bd->type = ButtonPress;
+ bd->serial = 0;
+ bd->send_event = 0;
+ bd->display = XtDisplay (widget);
+ bd->window = XtWindow (XtParent (widget));
+ bd->time = CurrentTime;
+ bd->button = 0;
+ XQueryPointer (bd->display, bd->window, &bd->root,
+ &bd->subwindow, &bd->x_root, &bd->y_root,
+ &bd->x, &bd->y, &bd->state);
+
+ XtCallActionProc ((Widget) mw, "start", &dummy, NULL, 0);
}
}
\f/* Destruction of instances */
void
-xlw_destroy_instance (instance)
- widget_instance* instance;
+xlw_destroy_instance (widget_instance *instance)
{
if (instance->widget)
XtDestroyWidget (instance->widget);
}
-