(eval-expression): Mention truncation in doc.
[bpt/emacs.git] / lwlib / lwlib-Xm.c
index 8a68cbe..6fdd236 100644 (file)
@@ -1,13 +1,13 @@
 /* The lwlib interface to Motif widgets.
 /* The lwlib interface to Motif widgets.
-   Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2004, 2005
-             Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
+                 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
    Copyright (C) 1992 Lucid, Inc.
 
 This file is part of the Lucid Widget Library.
 
 The Lucid Widget Library is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
    Copyright (C) 1992 Lucid, Inc.
 
 This file is part of the Lucid Widget Library.
 
 The Lucid Widget Library is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 1, or (at your option)
 any later version.
 
 The Lucid Widget Library is distributed in the hope that it will be useful,
 any later version.
 
 The Lucid Widget Library is distributed in the hope that it will be useful,
@@ -17,8 +17,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
 
 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>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -524,6 +524,10 @@ make_menu_in_widget (instance, widget, val, keep_first_children)
   Widget* old_children;
   unsigned int old_num_children;
 
   Widget* old_children;
   unsigned int old_num_children;
 
+  /* Disable drag and drop for labels in menu bar.  */
+  static char overrideTrans[] = "<Btn2Down>: Noop()";
+  XtTranslations override = XtParseTranslationTable (overrideTrans);
+
   old_children = XtCompositeChildren (widget, &old_num_children);
 
   /* Allocate the children array */
   old_children = XtCompositeChildren (widget, &old_num_children);
 
   /* Allocate the children array */
@@ -632,6 +636,8 @@ make_menu_in_widget (instance, widget, val, keep_first_children)
 
          XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback,
                         (XtPointer)instance);
 
          XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback,
                         (XtPointer)instance);
+          XtOverrideTranslations (button, override);
+
        }
 
       children[child_index] = button;
        }
 
       children[child_index] = button;
@@ -950,15 +956,13 @@ xm_update_one_value (instance, widget, val)
     }
   else if (class == xmTextWidgetClass)
     {
     }
   else if (class == xmTextWidgetClass)
     {
-      if (val->value)
-       free (val->value);
+      free (val->value);
       val->value = XmTextGetString (widget);
       val->edited = True;
     }
   else if (class == xmTextFieldWidgetClass)
     {
       val->value = XmTextGetString (widget);
       val->edited = True;
     }
   else if (class == xmTextFieldWidgetClass)
     {
-      if (val->value)
-       free (val->value);
+      free (val->value);
       val->value = XmTextFieldGetString (widget);
       val->edited = True;
     }
       val->value = XmTextFieldGetString (widget);
       val->edited = True;
     }
@@ -983,8 +987,7 @@ xm_update_one_value (instance, widget, val)
              XtVaGetValues (toggle, XmNset, &set, NULL);
              if (set)
                {
              XtVaGetValues (toggle, XmNset, &set, NULL);
              if (set)
                {
-                 if (val->value)
-                   free (val->value);
+                 free (val->value);
                  val->value = safe_strdup (XtName (toggle));
                }
            }
                  val->value = safe_strdup (XtName (toggle));
                }
            }