X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/8f1d2ef658f95549eb33fe5265f8f11c5129bece..refs/heads/wip:/lwlib/lwlib-Xm.c diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index 059cf10d2b..4d48e64cb1 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -1,6 +1,6 @@ /* The lwlib interface to Motif widgets. -Copyright (C) 1994-1997, 1999-2011 Free Software Foundation, Inc. +Copyright (C) 1994-1997, 1999-2014 Free Software Foundation, Inc. Copyright (C) 1992 Lucid, Inc. This file is part of the Lucid Widget Library. @@ -16,13 +16,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 . */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include @@ -34,7 +30,7 @@ Boston, MA 02110-1301, USA. */ #include #include -#include "../src/lisp.h" +#include #include "lwlib-Xm.h" #include "lwlib-utils.h" @@ -83,7 +79,6 @@ static destroyed_instance *make_destroyed_instance (char *, char *, 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 *); @@ -103,7 +98,6 @@ static void xm_update_menu (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); @@ -111,21 +105,16 @@ static destroyed_instance* find_matching_instance (widget_instance*); 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); @@ -174,8 +163,8 @@ make_destroyed_instance (char* name, { destroyed_instance* instance = (destroyed_instance*) xmalloc (sizeof (destroyed_instance)); - instance->name = safe_strdup (name); - instance->type = safe_strdup (type); + instance->name = xstrdup (name); + instance->type = xstrdup (type); instance->widget = widget; instance->parent = parent; instance->pop_up_p = pop_up_p; @@ -186,9 +175,9 @@ make_destroyed_instance (char* name, static void free_destroyed_instance (destroyed_instance* instance) { - free (instance->name); - free (instance->type); - free (instance); + xfree (instance->name); + xfree (instance->type); + xfree (instance); } /* motif utility functions */ @@ -492,7 +481,6 @@ make_menu_in_widget (widget_instance* instance, int child_index; widget_value* cur; Widget button = 0; - Widget title = 0; Widget menu; Arg al [256]; int ac; @@ -511,7 +499,7 @@ make_menu_in_widget (widget_instance* instance, /* 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)) @@ -556,7 +544,7 @@ make_menu_in_widget (widget_instance* instance, { 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)) { @@ -928,13 +916,13 @@ xm_update_one_value (widget_instance* instance, } 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; } @@ -958,10 +946,7 @@ xm_update_one_value (widget_instance* instance, XtVaGetValues (toggle, XmNset, &set, NULL); if (set) - { - free (val->value); - val->value = safe_strdup (XtName (toggle)); - } + dupstring (&val->value, XtName (toggle)); } val->edited = True; } @@ -984,7 +969,7 @@ xm_update_one_value (widget_instance* instance, if (pos_list [j] == i) { cur->selected = True; - val->value = safe_strdup (cur->name); + val->value = xstrdup (cur->name); } } val->edited = 1; @@ -1020,10 +1005,10 @@ dialog_key_cb (Widget widget, { 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); @@ -1055,7 +1040,7 @@ make_dialog (char* name, Widget row; Widget icon; Widget icon_separator; - Widget message; + Widget message_label; Widget value = 0; Widget separator; Widget button = 0; @@ -1269,7 +1254,7 @@ make_dialog (char* name, 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); @@ -1281,7 +1266,7 @@ make_dialog (char* name, { 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); @@ -1956,4 +1941,3 @@ xm_manage_resizing (Widget w, Boolean flag) { XtVaSetValues (w, XtNallowShellResize, flag, NULL); } -