/* The lwlib interface to Motif widgets.
- Copyright (C) 1994-1997, 1999-2011
- Free Software Foundation, Inc.
- Copyright (C) 1992 Lucid, Inc.
+
+Copyright (C) 1994-1997, 1999-2015 Free Software Foundation, Inc.
+Copyright (C) 1992 Lucid, Inc.
This file is part of the Lucid Widget Library.
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, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <unistd.h>
#include <stdio.h>
#include <X11/CoreP.h>
#include <X11/CompositeP.h>
-#include "../src/lisp.h"
+#include <lisp.h>
#include "lwlib-Xm.h"
#include "lwlib-utils.h"
Boolean);
static void free_destroyed_instance (destroyed_instance*);
Widget first_child (Widget);
-Boolean lw_motif_widget_p (Widget);
static XmString resource_motif_string (Widget, char *);
static void destroy_all_children (Widget, int);
static void xm_update_label (widget_instance *, Widget, widget_value *);
static void xm_update_text (widget_instance *, Widget, widget_value *);
static void xm_update_text_field (widget_instance *, Widget,
widget_value *);
-void xm_update_one_value (widget_instance *, Widget, widget_value *);
static void activate_button (Widget, XtPointer, XtPointer);
static Widget make_dialog (char *, Widget, Boolean, char *, char *,
Boolean, Boolean, Boolean, int, int);
static void mark_dead_instance_destroyed (Widget, XtPointer, XtPointer);
static void recenter_widget (Widget);
static Widget recycle_instance (destroyed_instance*);
-Widget xm_create_dialog (widget_instance*);
static Widget make_menubar (widget_instance*);
static void remove_grabs (Widget, XtPointer, XtPointer);
static Widget make_popup_menu (widget_instance*);
static Widget make_main (widget_instance*);
-void xm_destroy_instance (widget_instance*);
-void xm_popup_menu (Widget, XEvent *);
static void set_min_dialog_size (Widget);
static void do_call (Widget, XtPointer, enum do_call_type);
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);
-void xm_set_keyboard_focus (Widget, Widget);
-void xm_set_main_areas (Widget, Widget, Widget);
static void xm_internal_update_other_instances (Widget, XtPointer,
XtPointer);
static void xm_arm_callback (Widget, XtPointer, XtPointer);
Boolean pop_up_p)
{
destroyed_instance* instance =
- (destroyed_instance*)malloc (sizeof (destroyed_instance));
- instance->name = safe_strdup (name);
- instance->type = safe_strdup (type);
+ (destroyed_instance*) xmalloc (sizeof (destroyed_instance));
+ instance->name = xstrdup (name);
+ instance->type = xstrdup (type);
instance->widget = widget;
instance->parent = parent;
instance->pop_up_p = pop_up_p;
static void
free_destroyed_instance (destroyed_instance* instance)
{
- free (instance->name);
- free (instance->type);
- free (instance);
+ xfree (instance->name);
+ xfree (instance->type);
+ xfree (instance);
}
\f/* motif utility functions */
int child_index;
widget_value* cur;
Widget button = 0;
- Widget title = 0;
Widget menu;
Arg al [256];
int ac;
/* Allocate the children array */
for (num_children = 0, cur = val; cur; num_children++, cur = cur->next)
;
- children = (Widget*)XtMalloc (num_children * sizeof (Widget));
+ children = (Widget*)(void*)XtMalloc (num_children * sizeof (Widget));
/* WIDGET should be a RowColumn. */
if (!XmIsRowColumn (widget))
{
ac = 0;
XtSetArg (al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++;
- title = button = XmCreateLabel (widget, cur->name, al, ac);
+ button = XmCreateLabel (widget, cur->name, al, ac);
}
else if (lw_separator_p (cur->name, &separator, 1))
{
}
else if (class == xmTextWidgetClass)
{
- free (val->value);
+ xfree (val->value);
val->value = XmTextGetString (widget);
val->edited = True;
}
else if (class == xmTextFieldWidgetClass)
{
- free (val->value);
+ xfree (val->value);
val->value = XmTextFieldGetString (widget);
val->edited = True;
}
XtVaGetValues (toggle, XmNset, &set, NULL);
if (set)
- {
- free (val->value);
- val->value = safe_strdup (XtName (toggle));
- }
+ dupstring (&val->value, XtName (toggle));
}
val->edited = True;
}
if (pos_list [j] == i)
{
cur->selected = True;
- val->value = safe_strdup (cur->name);
+ val->value = xstrdup (cur->name);
}
}
val->edited = 1;
{
KeySym sym = 0;
Modifiers modif_ret;
-
+
XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0,
&modif_ret, &sym);
-
+
if (sym == osfXK_Cancel)
{
Widget w = *((Widget *) closure);
Widget row;
Widget icon;
Widget icon_separator;
- Widget message;
+ Widget message_label;
Widget value = 0;
Widget separator;
Widget button = 0;
XtSetArg(al[ac], XmNleftWidget, icon); ac++;
XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
XtSetArg(al[ac], XmNrightOffset, 13); ac++;
- message = XmCreateLabel (form, "message", al, ac);
+ message_label = XmCreateLabel (form, "message", al, ac);
if (list)
XtManageChild (value);
{
children [i] = value; i++;
}
- children [i] = message; i++;
+ children [i] = message_label; i++;
children [i] = icon; i++;
children [i] = icon_separator; i++;
XtManageChildren (children, i);
{
XtVaSetValues (w, XtNallowShellResize, flag, NULL);
}
-