emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6efed75ff3: Implement `pre_activate' callbacks for Motif menus


From: Po Lu
Subject: master 6efed75ff3: Implement `pre_activate' callbacks for Motif menus
Date: Fri, 4 Mar 2022 20:39:21 -0500 (EST)

branch: master
commit 6efed75ff3158214d16482f2bcca06c9ac010da4
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 lwlib/lwlib-Xm.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index a1114d4255..52ea304f71 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]