]> code.delx.au - gnu-emacs/blobdiff - lwlib/lwlib-Xm.c
More censorship.
[gnu-emacs] / lwlib / lwlib-Xm.c
index 0fe6caa001958d356e7756d0f5999137fe5ff420..26ac76fad9e5a7ecd53b0a22397d05b0f6e6c11c 100644 (file)
@@ -15,7 +15,8 @@ GNU General Public License for more details.
 
 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, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -257,8 +258,10 @@ xm_update_pushbutton (instance, widget, val)
 }
 
 static void
-xm_update_cascadebutton (widget_instance* instance, Widget widget,
-                        widget_value* val)
+xm_update_cascadebutton (instance, widget, val)
+     widget_instance* instance;
+     Widget widget;
+     widget_value* val;
 {
   /* Should also rebuild the menu by calling ...update_menu... */
   XtRemoveAllCallbacks (widget, XmNcascadingCallback);
@@ -401,7 +404,7 @@ make_menu_in_widget (instance, widget, val)
        }
       else
        {
-         menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0);
+         menu = XmCreatePulldownMenu (widget, cur->name, NULL, 0);
          make_menu_in_widget (instance, menu, cur->contents);
          XtSetArg (al [ac], XmNsubMenuId, menu); ac++;
          button = XmCreateCascadeButton (widget, cur->name, al, ac);
@@ -467,7 +470,7 @@ update_one_menu_entry (instance, widget, val, deep_p)
     {
       if (contents)
        {
-         menu = XmCreatePulldownMenu (XtParent (widget), "pulldown", NULL, 0);
+         menu = XmCreatePulldownMenu (XtParent (widget), XtName (widget), NULL, 0);
          make_menu_in_widget (instance, menu, contents);
          ac = 0;
          XtSetArg (al [ac], XmNsubMenuId, menu); ac++;
@@ -724,11 +727,14 @@ xm_update_one_value (instance, widget, val)
 /* This function is for activating a button from a program.  It's wrong because
    we pass a NULL argument in the call_data which is not Motif compatible.
    This is used from the XmNdefaultAction callback of the List widgets to
-   have a dble-click put down a dialog box like the button woudl do. 
+   have a double-click put down a dialog box like the button would do. 
    I could not find a way to do that with accelerators.
  */
 static void
-activate_button (Widget widget, XtPointer closure, XtPointer call_data)
+activate_button (widget, closure, call_data)
+     Widget widget;
+     XtPointer closure;
+     XtPointer call_data;
 {
   Widget button = (Widget)closure;
   XtCallCallbacks (button, XmNactivateCallback, NULL);
@@ -836,7 +842,7 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
       n_children++;
     }
 
-  /* invisible seperator button */
+  /* invisible separator button */
   ac = 0;
   XtSetArg (al[ac], XmNmappedWhenManaged, FALSE); ac++;
   children [n_children] = XmCreateLabel (row, "separator_button", al, ac);
@@ -1404,23 +1410,26 @@ xm_destroy_instance (instance)
 
 \f/* popup utility */
 void
-xm_popup_menu (widget)
+xm_popup_menu (widget, event)
      Widget widget;
+     XEvent *event;
 {
   XButtonPressedEvent dummy;
-  XEvent* event;
-
-  dummy.type = ButtonPress;
-  dummy.serial = 0;
-  dummy.send_event = 0;
-  dummy.display = XtDisplay (widget);
-  dummy.window = XtWindow (XtParent (widget));
-  dummy.time = 0;
-  dummy.button = 0;
-  XQueryPointer (dummy.display, dummy.window, &dummy.root,
-                &dummy.subwindow, &dummy.x_root, &dummy.y_root,
-                &dummy.x, &dummy.y, &dummy.state);
-  event = (XEvent *) &dummy;
+
+  if (event == 0)
+    {
+      dummy.type = ButtonPress;
+      dummy.serial = 0;
+      dummy.send_event = 0;
+      dummy.display = XtDisplay (widget);
+      dummy.window = XtWindow (XtParent (widget));
+      dummy.time = 0;
+      dummy.button = 0;
+      XQueryPointer (dummy.display, dummy.window, &dummy.root,
+                    &dummy.subwindow, &dummy.x_root, &dummy.y_root,
+                    &dummy.x, &dummy.y, &dummy.state);
+      event = (XEvent *) &dummy;
+    }
 
   if (event->type == ButtonPress || event->type == ButtonRelease)
     {