summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-03-05 09:35:44 +0800
committerPo Lu <luangruo@yahoo.com>2022-03-05 09:35:44 +0800
commit6efed75ff3158214d16482f2bcca06c9ac010da4 (patch)
tree886ebede3e3ff7ec449f3c8c92b49cddccee41b1 /lwlib
parent08221a58b752326c077707622b8b1df429564f3a (diff)
downloademacs-6efed75ff3158214d16482f2bcca06c9ac010da4.tar.gz
Implement `pre_activate' callbacks for Motif menus
* lwlib/lwlib-Xm.c (make_menu_in_widget): Add xm_pop_up_callback as the popup callback. (xm_pop_up_callback): New function.
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/lwlib-Xm.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index a1114d42556..52ea304f717 100644
--- a/lwlib/lwlib-Xm.c
+++ b/lwlib/lwlib-Xm.c
@@ -115,6 +115,7 @@ static void xm_generic_callback (Widget, XtPointer, XtPointer);
static void xm_nosel_callback (Widget, XtPointer, XtPointer);
static void xm_pull_down_callback (Widget, XtPointer, XtPointer);
static void xm_pop_down_callback (Widget, XtPointer, XtPointer);
+static void xm_pop_up_callback (Widget, XtPointer, XtPointer);
static void xm_internal_update_other_instances (Widget, XtPointer,
XtPointer);
static void xm_arm_callback (Widget, XtPointer, XtPointer);
@@ -513,8 +514,12 @@ make_menu_in_widget (widget_instance* instance,
/* Add a callback to popups and pulldowns that is called when
it is made invisible again. */
if (!menubar_p)
- XtAddCallback (XtParent (widget), XmNpopdownCallback,
- xm_pop_down_callback, (XtPointer)instance);
+ {
+ XtAddCallback (XtParent (widget), XmNpopdownCallback,
+ xm_pop_down_callback, (XtPointer) instance);
+ XtAddCallback (XtParent (widget), XmNpopupCallback,
+ xm_pop_up_callback, (XtPointer) instance);
+ }
/* Preserve the first KEEP_FIRST_CHILDREN old children. */
for (child_index = 0, cur = val; child_index < keep_first_children;
@@ -1915,6 +1920,18 @@ xm_pop_down_callback (Widget widget,
do_call (widget, closure, post_activate);
}
+static void
+xm_pop_up_callback (Widget widget,
+ XtPointer closure,
+ XtPointer call_data)
+{
+ widget_instance *instance = (widget_instance *) closure;
+
+ if ((!instance->pop_up_p && XtParent (widget) == instance->widget)
+ || XtParent (widget) == instance->parent)
+ do_call (widget, closure, pre_activate);
+}
+
/* set the keyboard focus */
void