]> git.eshelyaron.com Git - emacs.git/commitdiff
Implement `pre_activate' callbacks for Motif menus
authorPo Lu <luangruo@yahoo.com>
Sat, 5 Mar 2022 01:35:44 +0000 (09:35 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 5 Mar 2022 01:35:44 +0000 (09:35 +0800)
* lwlib/lwlib-Xm.c (make_menu_in_widget): Add
xm_pop_up_callback as the popup callback.
(xm_pop_up_callback): New function.

lwlib/lwlib-Xm.c

index a1114d425566851064f7a1b5eb6900900c4eda6a..52ea304f717a388014e39a843a44447569c73ffc 100644 (file)
@@ -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);
+}
+
 \f
 /* set the keyboard focus */
 void