Mercurial > hg > xemacs-beta
changeset 4528:726060ee587c g++-warning-removal-2008-10-28
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Wed, 29 Oct 2008 04:06:33 +0900 |
parents | 03ba50f7ecd7 |
children | 6f41fb7f3a65 c40d3f96af55 |
files | lwlib/lwlib-Xaw.c lwlib/lwlib-Xlw.c lwlib/lwlib-Xm.c lwlib/lwlib.c lwlib/lwlib.h lwlib/xlwcheckbox.c lwlib/xlwgauge.c lwlib/xlwmenu.c lwlib/xlwradio.c lwlib/xlwscrollbar.c lwlib/xlwtabs.c lwlib/xt-wrappers.h src/EmacsFrame.c src/EmacsManager.c src/EmacsShell-sub.c src/console-x.h src/device-x.c src/emacs.c src/emodules.c src/event-Xt.c src/event-stream.c src/file-coding.c src/file-coding.h src/frame-x.c src/gif_io.c src/glyphs-x.c src/input-method-xlib.c src/menubar-x.c src/mule-coding.c src/print.c src/redisplay.c |
diffstat | 31 files changed, 906 insertions(+), 889 deletions(-) [+] |
line wrap: on
line diff
--- a/lwlib/lwlib-Xaw.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/lwlib-Xaw.c Wed Oct 29 04:06:33 2008 +0900 @@ -88,15 +88,15 @@ Arg al [10]; /* First size and position the scrollbar widget. */ - XtSetArg (al [0], XtNx, data->scrollbar_x); - XtSetArg (al [1], XtNy, data->scrollbar_y); - XtSetArg (al [2], XtNwidth, data->scrollbar_width); - XtSetArg (al [3], XtNheight, data->scrollbar_height); + Xt_SET_ARG (al [0], XtNx, data->scrollbar_x); + Xt_SET_ARG (al [1], XtNy, data->scrollbar_y); + Xt_SET_ARG (al [2], XtNwidth, data->scrollbar_width); + Xt_SET_ARG (al [3], XtNheight, data->scrollbar_height); XtSetValues (widget, al, 4); /* Now size the scrollbar's slider. */ - XtSetArg (al [0], XtNtopOfThumb, &widget_topOfThumb); - XtSetArg (al [1], XtNshown, &widget_shown); + Xt_SET_ARG (al [0], XtNtopOfThumb, &widget_topOfThumb); + Xt_SET_ARG (al [1], XtNshown, &widget_shown); XtGetValues (widget, al, 2); new_shown = (double) data->slider_size / @@ -142,47 +142,37 @@ #endif #ifdef LWLIB_DIALOGS_ATHENA else if (XtIsSubclass (widget, dialogWidgetClass)) - { - Arg al [1]; - XtSetArg (al [0], XtNlabel, val->contents->value); - XtSetValues (widget, al, 1); - } + Xt_SET_VALUE (widget, XtNlabel, val->contents->value); #endif /* LWLIB_DIALOGS_ATHENA */ #ifdef LWLIB_WIDGETS_ATHENA else if (XtClass (widget) == labelWidgetClass) - { - Arg al [1]; - XtSetArg (al [0], XtNlabel, val->value); - XtSetValues (widget, al, 1); - } + Xt_SET_VALUE (widget, XtNlabel, val->value); #endif /* LWLIB_WIDGETS_ATHENA */ #if defined (LWLIB_DIALOGS_ATHENA) || defined (LWLIB_WIDGETS_ATHENA) else if (XtIsSubclass (widget, commandWidgetClass)) { - Dimension bw = 0; Arg al [3]; - XtSetArg (al [0], XtNborderWidth, &bw); - XtGetValues (widget, al, 1); #ifndef LWLIB_DIALOGS_ATHENA3D - if (bw == 0) - /* Don't let buttons end up with 0 borderwidth, that's ugly... - Yeah, all this should really be done through app-defaults files - or fallback resources, but that's a whole different can of worms - that I don't feel like opening right now. Making Athena widgets - not look like shit is just entirely too much work. - */ - { - XtSetArg (al [0], XtNborderWidth, 1); - XtSetValues (widget, al, 1); + { + Dimension bw = 0; + Xt_GET_VALUE (widget, XtNborderWidth, &bw); + if (bw == 0) + /* Don't let buttons end up with 0 borderwidth, that's ugly... + Yeah, all this should really be done through app-defaults files + or fallback resources, but that's a whole different can of worms + that I don't feel like opening right now. Making Athena widgets + not look like shit is just entirely too much work. + */ + Xt_SET_VALUE (widget, XtNborderWidth, 1); } #endif /* ! LWLIB_DIALOGS_ATHENA3D */ lw_remove_accelerator_spec (val->value); - XtSetArg (al [0], XtNlabel, val->value); - XtSetArg (al [1], XtNsensitive, val->enabled); + Xt_SET_ARG (al [0], XtNlabel, val->value); + Xt_SET_ARG (al [1], XtNsensitive, val->enabled); /* Force centered button text. See above. */ - XtSetArg (al [2], XtNjustify, XtJustifyCenter); + Xt_SET_ARG (al [2], XtNjustify, XtJustifyCenter); XtSetValues (widget, al, 3); XtRemoveAllCallbacks (widget, XtNcallback); @@ -190,10 +180,7 @@ #ifdef LWLIB_WIDGETS_ATHENA /* set the selected state */ if (XtIsSubclass (widget, toggleWidgetClass)) - { - XtSetArg (al [0], XtNstate, val->selected); - XtSetValues (widget, al, 1); - } + Xt_SET_VALUE (widget, XtNstate, val->selected); #endif /* LWLIB_WIDGETS_ATHENA */ } #endif /* LWLIB_DIALOGS_ATHENA */ @@ -219,19 +206,15 @@ if (XtIsSubclass (widget, toggleWidgetClass)) { - Arg al [1]; - XtSetArg (al [0], XtNstate, &val->selected); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XtNstate, &val->selected); val->edited = True; } #ifndef NEED_MOTIF else if (XtIsSubclass (widget, asciiTextWidgetClass)) { - Arg al [2]; String buf = 0; - XtSetArg (al [0], XtNstring, &buf); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XtNstring, &buf); if (val->value) { free (val->value); @@ -339,7 +322,7 @@ static XtActionProc wm_delete_window (Widget shell, XtPointer closure, XtPointer call_data); static XtActionsRec xaw_actions [] = { - {"lwlib_delete_dialog", (XtActionProc) wm_delete_window} + { (String) "lwlib_delete_dialog", (XtActionProc) wm_delete_window} }; static Boolean actions_initted = False; @@ -375,9 +358,9 @@ override = XtParseTranslationTable (overrideTrans); ac = 0; - XtSetArg (av[ac], XtNtitle, shell_title); ac++; - XtSetArg (av[ac], XtNallowShellResize, True); ac++; - XtSetArg (av[ac], XtNtransientFor, parent); ac++; + Xt_SET_ARG (av[ac], XtNtitle, shell_title); ac++; + Xt_SET_ARG (av[ac], XtNallowShellResize, True); ac++; + Xt_SET_ARG (av[ac], XtNtransientFor, parent); ac++; shell = XtCreatePopupShell ("dialog", transientShellWidgetClass, parent, av, ac); XtOverrideTranslations (shell, override); @@ -390,12 +373,12 @@ for (i = 0; i < left_buttons; i++) { ac = 0; - XtSetArg (av [ac], XtNfromHoriz, button); ac++; - XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; - XtSetArg (av [ac], XtNright, XtChainLeft); ac++; - XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; - XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; - XtSetArg (av [ac], XtNresizable, True); ac++; + Xt_SET_ARG (av [ac], XtNfromHoriz, button); ac++; + Xt_SET_ARG (av [ac], XtNleft, XtChainLeft); ac++; + Xt_SET_ARG (av [ac], XtNright, XtChainLeft); ac++; + Xt_SET_ARG (av [ac], XtNtop, XtChainBottom); ac++; + Xt_SET_ARG (av [ac], XtNbottom, XtChainBottom); ac++; + Xt_SET_ARG (av [ac], XtNresizable, True); ac++; sprintf (button_name, "button%d", ++bc); button = XtCreateManagedWidget (button_name, commandWidgetClass, dialog, av, ac); @@ -410,18 +393,18 @@ window) but I can't seem to make it do it. */ ac = 0; - XtSetArg (av [ac], XtNfromHoriz, button); ac++; -/* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */ - XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; - XtSetArg (av [ac], XtNright, XtChainRight); ac++; - XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; - XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; - XtSetArg (av [ac], XtNlabel, ""); ac++; - XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */ - XtSetArg (av [ac], XtNborderWidth, 0); ac++; - XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++; - XtSetArg (av [ac], XtNresizable, False); ac++; - XtSetArg (av [ac], XtNsensitive, False); ac++; + Xt_SET_ARG (av [ac], XtNfromHoriz, button); ac++; +/* Xt_SET_ARG (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */ + Xt_SET_ARG (av [ac], XtNleft, XtChainLeft); ac++; + Xt_SET_ARG (av [ac], XtNright, XtChainRight); ac++; + Xt_SET_ARG (av [ac], XtNtop, XtChainBottom); ac++; + Xt_SET_ARG (av [ac], XtNbottom, XtChainBottom); ac++; + Xt_SET_ARG (av [ac], XtNlabel, ""); ac++; + Xt_SET_ARG (av [ac], XtNwidth, 30); /* #### aaack!! */ ac++; + Xt_SET_ARG (av [ac], XtNborderWidth, 0); ac++; + Xt_SET_ARG (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++; + Xt_SET_ARG (av [ac], XtNresizable, False); ac++; + Xt_SET_ARG (av [ac], XtNsensitive, False); ac++; button = XtCreateManagedWidget ("separator", /* labelWidgetClass, */ /* This has to be Command to fake out @@ -432,12 +415,12 @@ for (i = 0; i < right_buttons; i++) { ac = 0; - XtSetArg (av [ac], XtNfromHoriz, button); ac++; - XtSetArg (av [ac], XtNleft, XtChainRight); ac++; - XtSetArg (av [ac], XtNright, XtChainRight); ac++; - XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; - XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; - XtSetArg (av [ac], XtNresizable, True); ac++; + Xt_SET_ARG (av [ac], XtNfromHoriz, button); ac++; + Xt_SET_ARG (av [ac], XtNleft, XtChainRight); ac++; + Xt_SET_ARG (av [ac], XtNright, XtChainRight); ac++; + Xt_SET_ARG (av [ac], XtNtop, XtChainBottom); ac++; + Xt_SET_ARG (av [ac], XtNbottom, XtChainBottom); ac++; + Xt_SET_ARG (av [ac], XtNresizable, True); ac++; sprintf (button_name, "button%d", ++bc); button = XtCreateManagedWidget (button_name, commandWidgetClass, dialog, av, ac); @@ -525,13 +508,10 @@ if (XtIsSubclass (widget, toggleWidgetClass)) { Boolean check; - Arg al [1]; - XtSetArg (al [0], XtNstate, &check); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XtNstate, &check); - XtSetArg (al [0], XtNstate, !check); - XtSetValues (widget, al, 1); + Xt_SET_VALUE (widget, XtNstate, !check); } #endif /* LWLIB_WIDGETS_ATHENA */ lw_internal_update_other_instances (widget, closure, call_data); @@ -549,11 +529,7 @@ #if 0 user_data = NULL; - { - Arg al [1]; - XtSetArg (al [0], XtNuserData, &user_data); - XtGetValues (widget, al, 1); - } + Xt_GET_VALUE (widget, XtNuserData, &user_data); #else /* Damn! Athena doesn't give us a way to hang our own data on the buttons, so we have to go find it... I guess this assumes that @@ -594,11 +570,10 @@ LWLIB_ID id; Widget *kids = 0; Widget widget; - Arg al [1]; + if (! XtIsSubclass (shell, shellWidgetClass)) abort (); - XtSetArg (al [0], XtNchildren, &kids); - XtGetValues (shell, al, 1); + Xt_GET_VALUE (shell, XtNchildren, &kids); if (!kids || !*kids) abort (); for (widget = *kids; @@ -697,11 +672,11 @@ top-level aware of this so that people could have a border but so few people use the Athena scrollbar now that it really isn't worth the effort, at least not at the moment. */ - XtSetArg (av [ac], XtNborderWidth, 0); ac++; - XtSetArg (av [ac], XtNorientation, - vertical ? XtorientVertical : XtorientHorizontal); ac++; - XtSetArg (av [ac], "jumpProc", jumpCallbacks); ac++; - XtSetArg (av [ac], "scrollProc", scrollCallbacks); ac++; + Xt_SET_ARG (av [ac], XtNborderWidth, 0); ac++; + Xt_SET_ARG (av [ac], XtNorientation, + vertical ? XtorientVertical : XtorientHorizontal); ac++; + Xt_SET_ARG (av [ac], "jumpProc", jumpCallbacks); ac++; + Xt_SET_ARG (av [ac], "scrollProc", scrollCallbacks); ac++; return XtCreateWidget (instance->info->name, scrollbarWidgetClass, instance->parent, av, ac); @@ -730,13 +705,13 @@ Widget button = 0; widget_value* val = instance->info->val; - XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++; - XtSetArg (al [ac], XtNjustify, XtJustifyCenter); ac++; + Xt_SET_ARG (al [ac], XtNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XtNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XtNjustify, XtJustifyCenter); ac++; /* The highlight doesn't appear to be dynamically set which makes it look ugly. I think this may be a LessTif bug but for now we just get rid of it. */ - XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0);ac++; + Xt_SET_ARG (al [ac], XtNhighlightThickness, (Dimension)0); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -749,7 +724,7 @@ { if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE) { - XtSetArg (al [ac], XtNstate, val->selected); ac++; + Xt_SET_ARG (al [ac], XtNstate, val->selected); ac++; button = XtCreateWidget (val->name, val->type == TOGGLE_TYPE ? checkboxWidgetClass : radioWidgetClass, @@ -783,9 +758,9 @@ int ac = 0; Widget label = 0; - XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++; - XtSetArg (al [ac], XtNjustify, XtJustifyCenter); ac++; + Xt_SET_ARG (al [ac], XtNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XtNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XtNjustify, XtJustifyCenter); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -868,20 +843,20 @@ #if 0 /* This looks too awful, although more correct. */ if (!val->call_data) { - XtSetArg (al [ac], XtNsensitive, False); ac++; + Xt_SET_ARG (al [ac], XtNsensitive, False); ac++; } else { - XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XtNsensitive, val->enabled); ac++; } #else - XtSetArg (al [ac], XtNsensitive, True); ac++; + Xt_SET_ARG (al [ac], XtNsensitive, True); ac++; #endif - XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++; - XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++; - XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0);ac++; - XtSetArg (al [ac], XtNntics, (Cardinal)10);ac++; + Xt_SET_ARG (al [ac], XtNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XtNorientation, XtorientHorizontal); ac++; + Xt_SET_ARG (al [ac], XtNhighlightThickness, (Dimension)0); ac++; + Xt_SET_ARG (al [ac], XtNntics, (Cardinal)10); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -915,18 +890,18 @@ Widget text = 0; widget_value* val = instance->info->val; - XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++; - XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0); ac++; - XtSetArg (al [ac], XtNtype, XawAsciiString); ac++; - XtSetArg (al [ac], XtNeditType, XawtextEdit); ac++; - XtSetArg (al [ac], XtNuseStringInPlace, False); ac++; + Xt_SET_ARG (al [ac], XtNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XtNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XtNhighlightThickness, (Dimension)0); ac++; + Xt_SET_ARG (al [ac], XtNtype, XawAsciiString); ac++; + Xt_SET_ARG (al [ac], XtNeditType, XawtextEdit); ac++; + Xt_SET_ARG (al [ac], XtNuseStringInPlace, False); ac++; #if 0 - XtSetArg (al [ac], XtNlength, TEXT_BUFFER_SIZE); ac++; + Xt_SET_ARG (al [ac], XtNlength, TEXT_BUFFER_SIZE); ac++; #endif if (val->value) { - XtSetArg (al [ac], XtNstring, val->value); ac++; + Xt_SET_ARG (al [ac], XtNstring, val->value); ac++; } /* add any args the user supplied for creation time */ @@ -956,8 +931,8 @@ #endif #ifdef LWLIB_WIDGETS_ATHENA {"button", xaw_create_button }, - { "label", xaw_create_label_field }, - {"text-field", xaw_create_text_field }, + {"label", xaw_create_label_field }, + {"text-field", xaw_create_text_field }, {"progress", xaw_create_progress }, #endif {NULL, NULL}
--- a/lwlib/lwlib-Xlw.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/lwlib-Xlw.c Wed Oct 29 04:06:33 2008 +0900 @@ -122,7 +122,7 @@ Arg al [1]; Widget widget; - XtSetArg (al [0], XtNmenu, instance->info->val); + Xt_SET_ARG (al [0], XtNmenu, instance->info->val); widget = XtCreateWidget (instance->info->name, xlwMenuWidgetClass, instance->parent, al, 1); XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance); @@ -139,8 +139,8 @@ popup_shell = XtCreatePopupShell (instance->info->name, overrideShellWidgetClass, instance->parent, NULL, 0); - XtSetArg (al [0], XtNmenu, instance->info->val); - XtSetArg (al [1], XtNhorizontal, False); + Xt_SET_ARG (al [0], XtNmenu, instance->info->val); + Xt_SET_ARG (al [1], XtNhorizontal, False); widget = XtCreateManagedWidget ("popup", xlwMenuWidgetClass, popup_shell, al, 2); XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); @@ -234,20 +234,20 @@ callbacks[0].closure = (XtPointer) instance; - XtSetArg (al[ac], XmNminimum, 1); ac++; - XtSetArg (al[ac], XmNmaximum, INT_MAX); ac++; - XtSetArg (al[ac], XmNincrement, 1); ac++; - XtSetArg (al[ac], XmNpageIncrement, 1); ac++; - XtSetArg (al[ac], XmNorientation, (vertical ? XmVERTICAL : XmHORIZONTAL)); ac++; + Xt_SET_ARG (al[ac], XmNminimum, 1); ac++; + Xt_SET_ARG (al[ac], XmNmaximum, INT_MAX); ac++; + Xt_SET_ARG (al[ac], XmNincrement, 1); ac++; + Xt_SET_ARG (al[ac], XmNpageIncrement, 1); ac++; + Xt_SET_ARG (al[ac], XmNorientation, (vertical ? XmVERTICAL : XmHORIZONTAL)); ac++; - XtSetArg (al[ac], XmNdecrementCallback, callbacks); ac++; - XtSetArg (al[ac], XmNdragCallback, callbacks); ac++; - XtSetArg (al[ac], XmNincrementCallback, callbacks); ac++; - XtSetArg (al[ac], XmNpageDecrementCallback, callbacks); ac++; - XtSetArg (al[ac], XmNpageIncrementCallback, callbacks); ac++; - XtSetArg (al[ac], XmNtoBottomCallback, callbacks); ac++; - XtSetArg (al[ac], XmNtoTopCallback, callbacks); ac++; - XtSetArg (al[ac], XmNvalueChangedCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNdecrementCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNdragCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNincrementCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNpageDecrementCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNpageIncrementCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNtoBottomCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNtoTopCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNvalueChangedCallback, callbacks); ac++; return XtCreateWidget (instance->info->name, xlwScrollBarWidgetClass, instance->parent, al, ac); @@ -278,15 +278,15 @@ Arg al [4]; /* First size and position the scrollbar widget. */ - XtSetArg (al [0], XtNx, data->scrollbar_x); - XtSetArg (al [1], XtNy, data->scrollbar_y); - XtSetArg (al [2], XtNwidth, data->scrollbar_width); - XtSetArg (al [3], XtNheight, data->scrollbar_height); + Xt_SET_ARG (al [0], XtNx, data->scrollbar_x); + Xt_SET_ARG (al [1], XtNy, data->scrollbar_y); + Xt_SET_ARG (al [2], XtNwidth, data->scrollbar_width); + Xt_SET_ARG (al [3], XtNheight, data->scrollbar_height); XtSetValues (widget, al, 4); /* Now size the scrollbar's slider. */ - XtSetArg (al [0], XmNsliderSize, &widget_sliderSize); - XtSetArg (al [1], XmNvalue, &widget_val); + Xt_SET_ARG (al [0], XmNsliderSize, &widget_sliderSize); + Xt_SET_ARG (al [1], XmNvalue, &widget_val); XtGetValues (widget, al, 2); percent = (double) data->slider_size / @@ -382,9 +382,9 @@ Widget tab = 0; widget_value* val = instance->info->val; - XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XtNmappedWhenManaged, False); ac++; - XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++; + Xt_SET_ARG (al [ac], XtNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XtNmappedWhenManaged, False); ac++; + Xt_SET_ARG (al [ac], XtNorientation, XtorientHorizontal); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -406,7 +406,7 @@ Arg al[1]; /* Children are always invisible, don't permit resizing. */ - XtSetArg (al[0], XtNresizable, False); + Xt_SET_ARG (al[0], XtNresizable, False); for (cur = val; cur; cur = cur->next) { @@ -479,8 +479,8 @@ Widget clip = 0; widget_value* val = instance->info->val; - XtSetArg (al [ac], XtNmappedWhenManaged, False); ac++; - XtSetArg (al [ac], XtNsensitive, True); ac++; + Xt_SET_ARG (al [ac], XtNmappedWhenManaged, False); ac++; + Xt_SET_ARG (al [ac], XtNsensitive, True); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -557,13 +557,11 @@ else if (class_ == xlwMenuWidgetClass) { XlwMenuWidget mw; - Arg al [1]; if (XtIsShell (widget)) mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0]; else mw = (XlwMenuWidget)widget; - XtSetArg (al [0], XtNmenu, val); - XtSetValues (widget, al, 1); /* #### mw unused! */ + Xt_SET_VALUE (widget, XtNmenu, val); /* #### mw unused! */ } #endif #ifdef LWLIB_SCROLLBARS_LUCID
--- a/lwlib/lwlib-Xm.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/lwlib-Xm.c Wed Oct 29 04:06:33 2008 +0900 @@ -216,8 +216,7 @@ int type; /* Don't clobber pixmap types. */ - XtSetArg (al [0], XmNlabelType, &type); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XmNlabelType, &type); if (type == XmPIXMAP) return; @@ -280,14 +279,14 @@ } } - XtSetArg (al [ac], XmNlabelString, built_string); ac++; - XtSetArg (al [ac], XmNlabelType, XmSTRING); ac++; + Xt_SET_ARG (al [ac], XmNlabelString, built_string); ac++; + Xt_SET_ARG (al [ac], XmNlabelType, XmSTRING); ac++; } if (val->key) { key_string = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET); - XtSetArg (al [ac], XmNacceleratorText, key_string); ac++; + Xt_SET_ARG (al [ac], XmNacceleratorText, key_string); ac++; } if (ac) @@ -342,9 +341,7 @@ xm_update_pushbutton (widget_instance* instance, Widget widget, widget_value* UNUSED (val)) { - Arg al [1]; - XtSetArg (al [0], XmNalignment, XmALIGNMENT_CENTER); - XtSetValues (widget, al, 1); + Xt_SET_VALUE (widget, XmNalignment, XmALIGNMENT_CENTER); XtRemoveAllCallbacks (widget, XmNactivateCallback); XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); } @@ -360,21 +357,21 @@ Dimension width = 0; if (!val->call_data) { - XtSetArg (al [ac], XmNeditable, False); ac++; + Xt_SET_ARG (al [ac], XmNeditable, False); ac++; } else { - XtSetArg (al [ac], XmNeditable, val->enabled); ac++; + Xt_SET_ARG (al [ac], XmNeditable, val->enabled); ac++; } - height = (Dimension)lw_get_value_arg (val, XtNheight); - width = (Dimension)lw_get_value_arg (val, XtNwidth); + height = (Dimension) lw_get_value_arg (val, XtNheight); + width = (Dimension) lw_get_value_arg (val, XtNwidth); if (height > 0) { - XtSetArg (al [ac], XmNscaleHeight, height); ac++; + Xt_SET_ARG (al [ac], XmNscaleHeight, height); ac++; } if (width > 0) { - XtSetArg (al [ac], XmNscaleWidth, width); ac++; + Xt_SET_ARG (al [ac], XmNscaleWidth, width); ac++; } XtSetValues (scale, al, ac); @@ -419,8 +416,8 @@ XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); XtAddCallback (widget, XmNvalueChangedCallback, xm_generic_callback, instance); - XtSetArg (al [0], XmNset, val->selected); - XtSetArg (al [1], XmNalignment, XmALIGNMENT_BEGINNING); + Xt_SET_ARG (al [0], XmNset, val->selected); + Xt_SET_ARG (al [1], XmNalignment, XmALIGNMENT_BEGINNING); XtSetValues (widget, al, 1); } @@ -447,8 +444,8 @@ if (toggle) { Arg al [2]; - XtSetArg (al [0], XmNsensitive, cur->enabled); - XtSetArg (al [1], XmNset, (!val->value && cur->selected ? cur->selected : False)); + Xt_SET_ARG (al [0], XmNsensitive, cur->enabled); + Xt_SET_ARG (al [1], XmNset, (!val->value && cur->selected ? cur->selected : False)); XtSetValues (toggle, al, 2); } } @@ -458,11 +455,7 @@ { toggle = XtNameToWidget (widget, val->value); if (toggle) - { - Arg al [1]; - XtSetArg (al [0], XmNset, True); - XtSetValues (toggle, al, 1); - } + Xt_SET_VALUE (toggle, XmNset, True); } } @@ -511,8 +504,7 @@ children = (Widget*)XtMalloc (num_children * sizeof (Widget)); /* tricky way to know if this RowColumn is a menubar or a pulldown... */ - XtSetArg (al [0], XmNisHomogeneous, &menubar_p); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XmNisHomogeneous, &menubar_p); /* add the unmap callback for popups and pulldowns */ /*** this sounds bogus ***/ @@ -528,9 +520,9 @@ { ac = 0; button = 0; - XtSetArg (al [ac], XmNsensitive, cur->enabled); ac++; - XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; - XtSetArg (al [ac], XmNuserData, cur->call_data); ac++; + Xt_SET_ARG (al [ac], XmNsensitive, cur->enabled); ac++; + Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; + Xt_SET_ARG (al [ac], XmNuserData, cur->call_data); ac++; switch (cur->type) { @@ -545,14 +537,14 @@ /* #### - xlwmenu.h supports several types that motif does not. Also, motif supports pixmaps w/ type NO_LINE and lwlib provides no way to access that functionality. --Stig */ - XtSetArg (al [ac], XmNseparatorType, cur->value), ac++; + Xt_SET_ARG (al [ac], XmNseparatorType, cur->value); ac++; } button = XmCreateSeparator (widget, "separator", al, ac); break; case CASCADE_TYPE: menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0); make_menu_in_widget (instance, menu, cur->contents); - XtSetArg (al [ac], XmNsubMenuId, menu); ac++; + Xt_SET_ARG (al [ac], XmNsubMenuId, menu); ac++; button = XmCreateCascadeButton (widget, cur->name, al, ac); xm_safe_update_label (instance, button, cur); @@ -567,10 +559,10 @@ button = XmCreateLabel (widget, cur->name, al, ac); else if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE) { - XtSetArg (al [ac], XmNindicatorType, + Xt_SET_ARG (al [ac], XmNindicatorType, (cur->type == TOGGLE_TYPE ? - XmN_OF_MANY : XmONE_OF_MANY)); ac++; - XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++; + XmN_OF_MANY : XmONE_OF_MANY)); ac++; + Xt_SET_ARG (al [ac], XmNvisibleWhenOff, True); ac++; button = XmCreateToggleButtonGadget (widget, cur->name, al, ac); } else @@ -597,11 +589,7 @@ height if you don't manage them until after you set this and as a bonus the Help menu ends up where it is supposed to. */ if (button) - { - ac = 0; - XtSetArg (al [ac], XmNmenuHelpWidget, button); ac++; - XtSetValues (widget, al, ac); - } + Xt_SET_VALUE (widget, XmNmenuHelpWidget, button); if (num_children) XtManageChildren (children, num_children); @@ -623,8 +611,8 @@ /* update the sensitivity and userdata */ /* Common to all widget types */ - XtSetArg (al [0], XmNsensitive, val->enabled); - XtSetArg (al [1], XmNuserData, val->call_data); + Xt_SET_ARG (al [0], XmNsensitive, val->enabled); + Xt_SET_ARG (al [1], XmNuserData, val->call_data); XtSetValues (widget, al, 2); /* update the menu button as a label. */ @@ -642,8 +630,7 @@ /* update the pulldown/pullaside as needed */ menu = NULL; - XtSetArg (al [0], XmNsubMenuId, &menu); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XmNsubMenuId, &menu); contents = val->contents; @@ -653,16 +640,12 @@ { menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0); make_menu_in_widget (instance, menu, contents); - ac = 0; - XtSetArg (al [ac], XmNsubMenuId, menu); ac++; - XtSetValues (widget, al, ac); + Xt_SET_VALUE (widget, XmNsubMenuId, menu); } } else if (!contents) { - ac = 0; - XtSetArg (al [ac], XmNsubMenuId, NULL); ac++; - XtSetValues (widget, al, ac); + Xt_SET_VALUE (widget, XmNsubMenuId, NULL); XtDestroyWidget (menu); } else if (deep_p && contents->change != NO_CHANGE) @@ -772,15 +755,15 @@ Arg al [4]; /* First size and position the scrollbar widget. */ - XtSetArg (al [0], XtNx, data->scrollbar_x); - XtSetArg (al [1], XtNy, data->scrollbar_y); - XtSetArg (al [2], XtNwidth, data->scrollbar_width); - XtSetArg (al [3], XtNheight, data->scrollbar_height); + Xt_SET_ARG (al [0], XtNx, data->scrollbar_x); + Xt_SET_ARG (al [1], XtNy, data->scrollbar_y); + Xt_SET_ARG (al [2], XtNwidth, data->scrollbar_width); + Xt_SET_ARG (al [3], XtNheight, data->scrollbar_height); XtSetValues (widget, al, 4); /* Now size the scrollbar's slider. */ - XtSetArg (al [0], XmNsliderSize, &widget_sliderSize); - XtSetArg (al [1], XmNvalue, &widget_val); + Xt_SET_ARG (al [0], XmNsliderSize, &widget_sliderSize); + Xt_SET_ARG (al [1], XmNvalue, &widget_val); XtGetValues (widget, al, 2); percent = (double) data->slider_size / @@ -845,8 +828,8 @@ val->edited = False; /* Common to all widget types */ - XtSetArg (al [ac], XmNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XmNuserData, val->call_data); ac++; + Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; XtSetValues (widget, al, ac); #if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF) @@ -875,8 +858,7 @@ { Boolean radiobox = 0; - XtSetArg (al [0], XmNradioBehavior, &radiobox); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XmNradioBehavior, &radiobox); if (radiobox) xm_update_radiobox (instance, widget, val); @@ -938,9 +920,7 @@ if (class_ == xmToggleButtonWidgetClass || class_ == xmToggleButtonGadgetClass) { - Arg al [1]; - XtSetArg (al [0], XmNset, &val->selected); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XmNset, &val->selected); val->edited = True; } else if (class_ == xmTextWidgetClass) @@ -960,11 +940,8 @@ else if (class_ == xmRowColumnWidgetClass) { Boolean radiobox = 0; - { - Arg al [1]; - XtSetArg (al [0], XmNradioBehavior, &radiobox); - XtGetValues (widget, al, 1); - } + + Xt_GET_VALUE (widget, XmNradioBehavior, &radiobox); if (radiobox) { @@ -974,10 +951,8 @@ { int set = False; Widget toggle = radio->composite.children [i]; - Arg al [1]; - XtSetArg (al [0], XmNset, &set); - XtGetValues (toggle, al, 1); + Xt_GET_VALUE (toggle, XmNset, &set); if (set) { if (val->value) @@ -1130,42 +1105,42 @@ if (pop_up_p) { ac = 0; - XtSetArg(al[ac], XmNtitle, shell_title); ac++; - XtSetArg(al[ac], XtNallowShellResize, True); ac++; - XtSetArg(al[ac], XmNdeleteResponse, XmUNMAP); ac++; + Xt_SET_ARG(al[ac], XmNtitle, shell_title); ac++; + Xt_SET_ARG(al[ac], XtNallowShellResize, True); ac++; + Xt_SET_ARG(al[ac], XmNdeleteResponse, XmUNMAP); ac++; result = XmCreateDialogShell (parent, "dialog", al, ac); - XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++; -/* XtSetArg(al[ac], XmNautoUnmanage, TRUE); ac++; */ /* ####is this ok? */ - XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; + Xt_SET_ARG(al[ac], XmNautoUnmanage, FALSE); ac++; +/* Xt_SET_ARG(al[ac], XmNautoUnmanage, TRUE); ac++; */ /* ####is this ok? */ + Xt_SET_ARG(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; form = XmCreateForm (result, (char *) shell_title, al, ac); } else { ac = 0; - XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++; - XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; + Xt_SET_ARG(al[ac], XmNautoUnmanage, FALSE); ac++; + Xt_SET_ARG(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; form = XmCreateForm (parent, (char *) shell_title, al, ac); result = form; } ac = 0; - XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++; - XtSetArg(al[ac], XmNorientation, XmVERTICAL); ac++; - XtSetArg(al[ac], XmNnumColumns, left_buttons + right_buttons + 1); ac++; - XtSetArg(al[ac], XmNmarginWidth, 0); ac++; - XtSetArg(al[ac], XmNmarginHeight, 0); ac++; - XtSetArg(al[ac], XmNspacing, 13); ac++; - XtSetArg(al[ac], XmNadjustLast, False); ac++; - XtSetArg(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++; - XtSetArg(al[ac], XmNisAligned, True); ac++; - XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; - XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNbottomOffset, 13); ac++; - XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNleftOffset, 13); ac++; - XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNrightOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNpacking, XmPACK_COLUMN); ac++; + Xt_SET_ARG(al[ac], XmNorientation, XmVERTICAL); ac++; + Xt_SET_ARG(al[ac], XmNnumColumns, left_buttons + right_buttons + 1); ac++; + Xt_SET_ARG(al[ac], XmNmarginWidth, 0); ac++; + Xt_SET_ARG(al[ac], XmNmarginHeight, 0); ac++; + Xt_SET_ARG(al[ac], XmNspacing, 13); ac++; + Xt_SET_ARG(al[ac], XmNadjustLast, False); ac++; + Xt_SET_ARG(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++; + Xt_SET_ARG(al[ac], XmNisAligned, True); ac++; + Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; + Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; row = XmCreateRowColumn (form, "row", al, ac); n_children = 0; @@ -1176,10 +1151,10 @@ ac = 0; if (i == 0) { - XtSetArg(al[ac], XmNhighlightThickness, 1); ac++; - XtSetArg(al[ac], XmNshowAsDefault, TRUE); ac++; + Xt_SET_ARG(al[ac], XmNhighlightThickness, 1); ac++; + Xt_SET_ARG(al[ac], XmNshowAsDefault, TRUE); ac++; } - XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; + Xt_SET_ARG(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; children [n_children] = XmCreatePushButton (row, button_name, al, ac); DO_DND_KLUDGE (children [n_children]); @@ -1187,7 +1162,7 @@ { button = children [n_children]; ac = 0; - XtSetArg(al[ac], XmNdefaultButton, button); ac++; + Xt_SET_ARG(al[ac], XmNdefaultButton, button); ac++; XtSetValues (row, al, ac); #ifdef ARMANDACTIVATE_KLUDGE /* See comment above */ @@ -1204,9 +1179,8 @@ /* invisible separator button */ ac = 0; - XtSetArg (al[ac], XmNmappedWhenManaged, FALSE); ac++; - children [n_children] = XmCreateLabel (row, "separator_button", - al, ac); + Xt_SET_ARG (al[ac], XmNmappedWhenManaged, FALSE); ac++; + children [n_children] = XmCreateLabel (row, "separator_button", al, ac); DO_DND_KLUDGE (children [n_children]); n_children++; @@ -1215,7 +1189,7 @@ char button_name [16]; sprintf (button_name, "button%d", left_buttons + i + 1); ac = 0; - XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; + Xt_SET_ARG(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; children [n_children] = XmCreatePushButton (row, button_name, al, ac); DO_DND_KLUDGE (children [n_children]); if (! button) button = children [n_children]; @@ -1225,53 +1199,53 @@ XtManageChildren (children, n_children); ac = 0; - XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; - XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNbottomOffset, 13); ac++; - XtSetArg(al[ac], XmNbottomWidget, row); ac++; - XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNleftOffset, 0); ac++; - XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNrightOffset, 0); ac++; + Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; + Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNbottomWidget, row); ac++; + Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNleftOffset, 0); ac++; + Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNrightOffset, 0); ac++; separator = XmCreateSeparator (form, "", al, ac); ac = 0; - XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; - XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNtopOffset, 13); ac++; - XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNleftOffset, 13); ac++; - XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; + Xt_SET_ARG(al[ac], XmNlabelType, XmPIXMAP); ac++; + Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNtopOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; icon = XmCreateLabel (form, (char *) icon_name, al, ac); DO_DND_KLUDGE (icon); ac = 0; - XtSetArg(al[ac], XmNmappedWhenManaged, FALSE); ac++; - XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNtopOffset, 6); ac++; - XtSetArg(al[ac], XmNtopWidget, icon); ac++; - XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNbottomOffset, 6); ac++; - XtSetArg(al[ac], XmNbottomWidget, separator); ac++; - XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++; - XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; + Xt_SET_ARG(al[ac], XmNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNtopOffset, 6); ac++; + Xt_SET_ARG(al[ac], XmNtopWidget, icon); ac++; + Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNbottomOffset, 6); ac++; + Xt_SET_ARG(al[ac], XmNbottomWidget, separator); ac++; + Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++; + Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; icon_separator = XmCreateLabel (form, "", al, ac); DO_DND_KLUDGE (icon_separator); if (text_input_slot) { ac = 0; - XtSetArg(al[ac], XmNcolumns, 50); ac++; - XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; - XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNbottomOffset, 13); ac++; - XtSetArg(al[ac], XmNbottomWidget, separator); ac++; - XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNleftOffset, 13); ac++; - XtSetArg(al[ac], XmNleftWidget, icon); ac++; - XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNrightOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNcolumns, 50); ac++; + Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; + Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNbottomWidget, separator); ac++; + Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNleftWidget, icon); ac++; + Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; value = XmCreateTextField (form, "value", al, ac); DO_DND_KLUDGE (value); } @@ -1279,19 +1253,19 @@ { Widget radio_butt; ac = 0; - XtSetArg(al[ac], XmNmarginWidth, 0); ac++; - XtSetArg(al[ac], XmNmarginHeight, 0); ac++; - XtSetArg(al[ac], XmNspacing, 13); ac++; - XtSetArg(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++; - XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++; - XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNbottomOffset, 13); ac++; - XtSetArg(al[ac], XmNbottomWidget, separator); ac++; - XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNleftOffset, 13); ac++; - XtSetArg(al[ac], XmNleftWidget, icon); ac++; - XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNrightOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNmarginWidth, 0); ac++; + Xt_SET_ARG(al[ac], XmNmarginHeight, 0); ac++; + Xt_SET_ARG(al[ac], XmNspacing, 13); ac++; + Xt_SET_ARG(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++; + Xt_SET_ARG(al[ac], XmNorientation, XmHORIZONTAL); ac++; + Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNbottomWidget, separator); ac++; + Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNleftWidget, icon); ac++; + Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; value = XmCreateRadioBox (form, "radiobutton1", al, ac); ac = 0; i = 0; @@ -1306,16 +1280,16 @@ else if (list) { ac = 0; - XtSetArg(al[ac], XmNvisibleItemCount, 5); ac++; - XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; - XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNbottomOffset, 13); ac++; - XtSetArg(al[ac], XmNbottomWidget, separator); ac++; - XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNleftOffset, 13); ac++; - XtSetArg(al[ac], XmNleftWidget, icon); ac++; - XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNrightOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNvisibleItemCount, 5); ac++; + Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; + Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNbottomWidget, separator); ac++; + Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNleftWidget, icon); ac++; + Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; value = XmCreateScrolledList (form, "list", al, ac); /* this is the easiest way I found to have the double click in the @@ -1325,18 +1299,18 @@ /* else add nothing; it's a separator */ ac = 0; - XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; - XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNtopOffset, 13); ac++; - XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNbottomOffset, 13); ac++; - XtSetArg(al[ac], XmNbottomWidget, - text_input_slot || radio_box || list ? value : separator); ac++; - XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; - XtSetArg(al[ac], XmNleftOffset, 13); ac++; - XtSetArg(al[ac], XmNleftWidget, icon); ac++; - XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg(al[ac], XmNrightOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; + Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNtopOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNbottomWidget, + text_input_slot || radio_box || list ? value : separator); ac++; + Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; + Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; + Xt_SET_ARG(al[ac], XmNleftWidget, icon); ac++; + Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; message = XmCreateLabel (form, "message", al, ac); DO_DND_KLUDGE (message); @@ -1427,12 +1401,12 @@ Position y; Arg al [2]; - XtSetArg (al [0], XtNwidth, &child_width); - XtSetArg (al [1], XtNheight, &child_height); + Xt_SET_ARG (al [0], XtNwidth, &child_width); + Xt_SET_ARG (al [1], XtNheight, &child_height); XtGetValues (widget, al, 2); - XtSetArg (al [0], XtNwidth, &parent_width); - XtSetArg (al [1], XtNheight, &parent_height); + Xt_SET_ARG (al [0], XtNwidth, &parent_width); + Xt_SET_ARG (al [1], XtNheight, &parent_height); XtGetValues (parent, al, 2); x = (Position) ((parent_width - child_width) / 2); @@ -1450,8 +1424,8 @@ if (y < 0) y = 0; - XtSetArg (al [0], XtNx, x); - XtSetArg (al [1], XtNy, y); + Xt_SET_ARG (al [0], XtNx, x); + Xt_SET_ARG (al [1], XtNy, y); XtSetValues (widget, al, 2); } @@ -1484,8 +1458,8 @@ if (separator) { Arg al [2]; - XtSetArg (al [0], XtNwidth, 5); - XtSetArg (al [1], XtNheight, 5); + Xt_SET_ARG (al [0], XtNwidth, 5); + Xt_SET_ARG (al [1], XtNheight, 5); XtSetValues (separator, al, 2); } @@ -1581,8 +1555,8 @@ Arg al[10]; int ac = 0; - XtSetArg(al[ac], XmNmarginHeight, 0); ac++; - XtSetArg(al[ac], XmNshadowThickness, 3); ac++; + Xt_SET_ARG(al[ac], XmNmarginHeight, 0); ac++; + Xt_SET_ARG(al[ac], XmNshadowThickness, 3); ac++; return XmCreateMenuBar (instance->parent, instance->info->name, al, ac); } @@ -1622,21 +1596,22 @@ callbacks[0].closure = (XtPointer) instance; - XtSetArg (al[ac], XmNminimum, 1); ac++; - XtSetArg (al[ac], XmNmaximum, INT_MAX); ac++; - XtSetArg (al[ac], XmNincrement, 1); ac++; - XtSetArg (al[ac], XmNpageIncrement, 1); ac++; - XtSetArg (al[ac], XmNborderWidth, 0); ac++; - XtSetArg (al[ac], XmNorientation, vertical ? XmVERTICAL : XmHORIZONTAL); ac++; + Xt_SET_ARG (al[ac], XmNminimum, 1); ac++; + Xt_SET_ARG (al[ac], XmNmaximum, INT_MAX); ac++; + Xt_SET_ARG (al[ac], XmNincrement, 1); ac++; + Xt_SET_ARG (al[ac], XmNpageIncrement, 1); ac++; + Xt_SET_ARG (al[ac], XmNborderWidth, 0); ac++; + Xt_SET_ARG (al[ac], XmNorientation, + vertical ? XmVERTICAL : XmHORIZONTAL); ac++; - XtSetArg (al[ac], XmNdecrementCallback, callbacks); ac++; - XtSetArg (al[ac], XmNdragCallback, callbacks); ac++; - XtSetArg (al[ac], XmNincrementCallback, callbacks); ac++; - XtSetArg (al[ac], XmNpageDecrementCallback, callbacks); ac++; - XtSetArg (al[ac], XmNpageIncrementCallback, callbacks); ac++; - XtSetArg (al[ac], XmNtoBottomCallback, callbacks); ac++; - XtSetArg (al[ac], XmNtoTopCallback, callbacks); ac++; - XtSetArg (al[ac], XmNvalueChangedCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNdecrementCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNdragCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNincrementCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNpageDecrementCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNpageIncrementCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNtoBottomCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNtoTopCallback, callbacks); ac++; + Xt_SET_ARG (al[ac], XmNvalueChangedCallback, callbacks); ac++; return XmCreateScrollBar (instance->parent, instance->info->name, al, ac); } @@ -1665,14 +1640,14 @@ Widget button = 0; widget_value* val = instance->info->val; - XtSetArg (al [ac], XmNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; - XtSetArg (al [ac], XmNuserData, val->call_data); ac++; - XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; + Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; + Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; /* The highlight doesn't appear to be dynamically set which makes it look ugly. I think this may be a LessTif bug but for now we just get rid of it. */ - XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++; + Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -1682,11 +1657,11 @@ else if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE) { - XtSetArg (al [ac], XmNset, val->selected); ac++; - XtSetArg (al [ac], XmNindicatorType, + Xt_SET_ARG (al [ac], XmNset, val->selected); ac++; + Xt_SET_ARG (al [ac], XmNindicatorType, (val->type == TOGGLE_TYPE ? - XmN_OF_MANY : XmONE_OF_MANY)); ac++; - XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++; + XmN_OF_MANY : XmONE_OF_MANY)); ac++; + Xt_SET_ARG (al [ac], XmNvisibleWhenOff, True); ac++; button = XmCreateToggleButton (instance->parent, val->name, al, ac); XtRemoveAllCallbacks (button, XmNvalueChangedCallback); XtAddCallback (button, XmNvalueChangedCallback, xm_generic_callback, @@ -1715,30 +1690,30 @@ widget_value* val = instance->info->val; if (!val->call_data) { - XtSetArg (al [ac], XmNeditable, False); ac++; + Xt_SET_ARG (al [ac], XmNeditable, False); ac++; } else { - XtSetArg (al [ac], XmNeditable, val->enabled); ac++; + Xt_SET_ARG (al [ac], XmNeditable, val->enabled); ac++; } - XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; - XtSetArg (al [ac], XmNuserData, val->call_data); ac++; - XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++; - XtSetArg (al [ac], XmNorientation, XmHORIZONTAL); ac++; + Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; + Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; + Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XmNorientation, XmHORIZONTAL); ac++; /* The highlight doesn't appear to be dynamically set which makes it look ugly. I think this may be a LessTif bug but for now we just get rid of it. */ - XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++; + Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; height = (Dimension)lw_get_value_arg (val, XtNheight); width = (Dimension)lw_get_value_arg (val, XtNwidth); if (height > 0) { - XtSetArg (al [ac], XmNscaleHeight, height); ac++; + Xt_SET_ARG (al [ac], XmNscaleHeight, height); ac++; } if (width > 0) { - XtSetArg (al [ac], XmNscaleWidth, width); ac++; + Xt_SET_ARG (al [ac], XmNscaleWidth, width); ac++; } /* add any args the user supplied for creation time */ @@ -1762,14 +1737,14 @@ Widget text = 0; widget_value* val = instance->info->val; - XtSetArg (al [ac], XmNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; - XtSetArg (al [ac], XmNuserData, val->call_data); ac++; - XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; + Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; + Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; /* The highlight doesn't appear to be dynamically set which makes it look ugly. I think this may be a LessTif bug but for now we just get rid of it. */ - XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++; + Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -1797,13 +1772,13 @@ int ac = 0; Widget label = 0; - XtSetArg (al [ac], XmNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; - XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; + Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; /* The highlight doesn't appear to be dynamically set which makes it look ugly. I think this may be a LessTif bug but for now we just get rid of it. */ - XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++; + Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -1829,14 +1804,14 @@ Widget combo = 0; widget_value* val = instance->info->val; - XtSetArg (al [ac], XmNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; - XtSetArg (al [ac], XmNuserData, val->call_data); ac++; - XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++; + Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; + Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; + Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; + Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; /* The highlight doesn't appear to be dynamically set which makes it look ugly. I think this may be a LessTif bug but for now we just get rid of it. */ - XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++; + Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -1944,7 +1919,7 @@ if (trans) { Arg al [1]; - XtSetArg (al [0], XmNmenuPost, trans); + Xt_SET_ARG (al [0], XmNmenuPost, trans); XtSetValues (widget, al, 1); } XmMenuPosition (widget, (XButtonPressedEvent *) event); @@ -1963,12 +1938,12 @@ short height; Arg al [2]; - XtSetArg (al [0], XmNwidth, &width); - XtSetArg (al [1], XmNheight, &height); + Xt_SET_ARG (al [0], XmNwidth, &width); + Xt_SET_ARG (al [1], XmNheight, &height); XtGetValues (w, al, 2); - XtSetArg (al [0], XmNminWidth, width); - XtSetArg (al [1], XmNminHeight, height); + Xt_SET_ARG (al [0], XmNminWidth, width); + Xt_SET_ARG (al [1], XmNminHeight, height); XtSetValues (w, al, 2); } @@ -2014,7 +1989,6 @@ widget_instance* instance = (widget_instance*)closure; Widget instance_widget; LWLIB_ID id; - Arg al [1]; if (!instance) return; @@ -2027,8 +2001,7 @@ id = instance->info->id; user_data = NULL; - XtSetArg(al [0], XmNuserData, &user_data); - XtGetValues (widget, al, 1); + Xt_GET_VALUE (widget, XmNuserData, &user_data); switch (type) { case pre_activate: @@ -2080,13 +2053,9 @@ || XtClass (widget) == xmToggleButtonGadgetClass) { Boolean check; - Arg al [1]; - XtSetArg (al [0], XmNset, &check); - XtGetValues (widget, al, 1); - - XtSetArg (al [0], XmNset, !check); - XtSetValues (widget, al, 1); + Xt_GET_VALUE (widget, XmNset, &check); + Xt_SET_VALUE (widget, XmNset, !check); } #endif lw_internal_update_other_instances (widget, closure, call_data);
--- a/lwlib/lwlib.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/lwlib.c Wed Oct 29 04:06:33 2008 +0900 @@ -1385,7 +1385,7 @@ } } -XtArgVal lw_get_value_arg (widget_value* wv, String name) +XtArgVal lw_get_value_arg (widget_value* wv, const String name) { int i; if (wv->args)
--- a/lwlib/lwlib.h Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/lwlib.h Wed Oct 29 04:06:33 2008 +0900 @@ -2,6 +2,7 @@ #define INCLUDED_lwlib_h_ #include <X11/Intrinsic.h> +#include "xt-wrappers.h" #if defined (LWLIB_MENUBARS_LUCID) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_MENUBARS_ATHENA) #define NEED_MENUBARS
--- a/lwlib/xlwcheckbox.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/xlwcheckbox.c Wed Oct 29 04:06:33 2008 +0900 @@ -40,6 +40,7 @@ #include <X11/StringDefs.h> #include ATHENA_XawInit_h_ #include "../src/xmu.h" +#include "xt-wrappers.h" #include "xlwcheckboxP.h" @@ -89,10 +90,12 @@ -#define offset(field) XtOffsetOf(CheckboxRec, field) +#define offset(field) XtOffsetOf(CheckboxRec, checkbox.field) +#define res(name,_class,intrepr,type,member,extrepr,value) \ + Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value) static XtResource resources[] = { - {XtNtristate, XtCTristate, XtRBoolean, sizeof(Boolean), - offset(checkbox.tristate), XtRImmediate, (XtPointer)FALSE}, + res (XtNtristate, XtCTristate, XtRBoolean, Boolean, tristate, + XtRImmediate, FALSE), } ; #undef offset @@ -127,7 +130,7 @@ CheckboxClassRec checkboxClassRec = { { (WidgetClass) SuperClass, /* superclass */ - "Checkbox", /* class_name */ + (String) "Checkbox", /* class_name */ sizeof(CheckboxRec), /* size */ CheckboxClassInit, /* class_initialize */ NULL, /* class_part_initialize */
--- a/lwlib/xlwgauge.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/xlwgauge.c Wed Oct 29 04:06:33 2008 +0900 @@ -53,6 +53,7 @@ #include <X11/Xatom.h> #include <X11/StringDefs.h> #include ATHENA_XawInit_h_ +#include "xt-wrappers.h" #include "xlwgaugeP.h" #include "../src/xmu.h" #ifdef HAVE_XMU @@ -77,33 +78,29 @@ -#define offset(field) XtOffsetOf(GaugeRec, field) +#define offset(field) XtOffsetOf(GaugeRec, gauge.field) +#define res(name,_class,intrepr,type,member,extrepr,value) \ + Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value) static XtResource resources[] = { - {XtNvalue, XtCValue, XtRInt, sizeof(int), - offset(gauge.value), XtRImmediate, (XtPointer)0}, - {XtNminValue, XtCMinValue, XtRInt, sizeof(int), - offset(gauge.v0), XtRImmediate, (XtPointer)0}, - {XtNmaxValue, XtCMaxValue, XtRInt, sizeof(int), - offset(gauge.v1), XtRImmediate, (XtPointer)100}, - {XtNntics, XtCNTics, XtRInt, sizeof(int), - offset(gauge.ntics), XtRImmediate, (XtPointer) 0}, - {XtNnlabels, XtCNLabels, XtRInt, sizeof(int), - offset(gauge.nlabels), XtRImmediate, (XtPointer) 0}, - {XtNlabels, XtCLabels, XtRStringArray, sizeof(String *), - offset(gauge.labels), XtRStringArray, NULL}, - {XtNautoScaleUp, XtCAutoScaleUp, XtRBoolean, sizeof(Boolean), - offset(gauge.autoScaleUp), XtRImmediate, FALSE}, - {XtNautoScaleDown, XtCAutoScaleDown, XtRBoolean, sizeof(Boolean), - offset(gauge.autoScaleDown), XtRImmediate, FALSE}, - {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation), - offset(gauge.orientation), XtRImmediate, (XtPointer)XtorientHorizontal}, - {XtNupdate, XtCInterval, XtRInt, sizeof(int), - offset(gauge.update), XtRImmediate, (XtPointer)0}, - {XtNgetValue, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(gauge.getValue), XtRImmediate, (XtPointer)NULL}, + res (XtNvalue, XtCValue, XtRInt, int, value, XtRImmediate, 0), + res (XtNminValue, XtCMinValue, XtRInt, int, v0, XtRImmediate, 0), + res (XtNmaxValue, XtCMaxValue, XtRInt, int, v1, XtRImmediate, 100), + res (XtNntics, XtCNTics, XtRInt, int, ntics, XtRImmediate, 0), + res (XtNnlabels, XtCNLabels, XtRInt, int, nlabels, XtRImmediate, 0), + res (XtNlabels, XtCLabels, XtRStringArray, String *, labels, + XtRStringArray, NULL), + res (XtNautoScaleUp, XtCAutoScaleUp, XtRBoolean, Boolean, autoScaleUp, + XtRImmediate, FALSE), + res (XtNautoScaleDown, XtCAutoScaleDown, XtRBoolean, Boolean, + autoScaleDown, XtRImmediate, FALSE), + res (XtNorientation, XtCOrientation, XtROrientation, XtOrientation, + orientation, XtRImmediate, XtorientHorizontal), + res (XtNupdate, XtCInterval, XtRInt, int, update, XtRImmediate, 0), + res (XtNgetValue, XtCCallback, XtRCallback, XtPointer, getValue, + XtRImmediate, NULL), }; #undef offset - +#undef res /* member functions */ @@ -146,8 +143,8 @@ static XtActionsRec actionsList[] = { - {"select", GaugeSelect}, - {"paste", GaugePaste}, + { (String) "select", GaugeSelect }, + { (String) "paste", GaugePaste }, } ; @@ -162,7 +159,7 @@ { /* core_class fields */ /* superclass */ (WidgetClass) &labelClassRec, - /* class_name */ "Gauge", + /* class_name */ (String) "Gauge", /* widget_size */ sizeof(GaugeRec), /* class_initialize */ GaugeClassInit, /* class_part_initialize */ NULL,
--- a/lwlib/xlwmenu.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/xlwmenu.c Wed Oct 29 04:06:33 2008 +0900 @@ -70,100 +70,112 @@ extern Widget lw_menubar_widget; -#define offset(field) XtOffset(XlwMenuWidget, field) static XtResource xlwMenuResources[] = { +/* The offset macro is a standard trick. The remaining macros are an + experiment to compress redundancies in resource descriptions, and shut + up GCC 4.3 (the String casts, which keep G++ from complaining about + implicit conversions from const char *). */ +#define offset(field) XtOffset(XlwMenuWidget, menu.field) +#define fontres(name,_class,repr,type,member,value) \ + Xt_RESOURCE (name, _class, repr, type, offset(member), XtRString, value) +#define mflres(name,cls,member,repr,value) \ + Xt_RESOURCE (name, cls, XmRFontList, XmFontList, offset(member), repr, value) +#define dimres(name,cls,repr,member,value) \ + Xt_RESOURCE (name, cls, repr, Dimension, offset(member), XtRImmediate, value) +#define boolres(nm,cls,member,val) \ + Xt_RESOURCE (nm, cls, XtRBoolean, Boolean, offset(member), XtRImmediate, val) +#define cbres(name,member,value) \ + Xt_RESOURCE (name, XtCCallback, XtRCallback, XtPointer, offset(member), \ + XtRCallback, value) +#define pixres(name,_class,member,repr,value) \ + Xt_RESOURCE (name, _class, XtRPixel, Pixel, offset(member), repr, value) +#define fgpixres(name,_class,member) \ + pixres (name, _class, member, XtRString, "XtDefaultForeground") +#define nullpixres(name,_class,member) \ + pixres (name, _class, member, XtRImmediate, -1) +#define pmres(name,cls,member) \ + Xt_RESOURCE (name, cls, XtRPixmap, Pixmap, offset(member), XtRImmediate, None) + #if defined(NEED_MOTIF) && !defined(USE_XFT_MENUBARS) /* There are three font list resources, so that we can accept either of the resources *fontList: or *font:, and so that we can tell the difference between them being specified, and being defaulted to a font from the XtRString specified here. */ - {XmNfontList, XmCFontList, XmRFontList, sizeof(XmFontList), - offset(menu.font_list), XtRImmediate, (XtPointer)0}, - {XtNfont, XtCFont, XmRFontList, sizeof(XmFontList), - offset(menu.font_list_2),XtRImmediate, (XtPointer)0}, - {XmNfontList, XmCFontList, XmRFontList, sizeof(XmFontList), - offset(menu.fallback_font_list), + mflres (XmNfontList, XmCFontList, font_list, XtRImmediate, 0), + mflres (XtNfont, XtCFont, font_list_2, XtRImmediate, 0), + mflres (XmNfontList, XmCFontList, fallback_font_list, /* We must use an iso8859-1 font here, or people without $LANG set lose. It's fair to assume that those who do have $LANG set also have the *fontList resource set, or at least know how to deal with this. */ - XtRString, (XtPointer) "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1"}, + XtRString, (XtPointer) "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1"), #else - {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), - offset(menu.font), XtRString, (XtPointer) "XtDefaultFont"}, + fontres (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, font, + "XtDefaultFont"), #ifdef USE_XFT_MENUBARS - {XtNfcFontName, XtCFcFontName, XtRString, sizeof (String), - offset(menu.fcFontName), - XtRString, (XtPointer) NULL}, + fontres (XtNfcFontName, XtCFcFontName, XtRString, String, fcFontName, + "sans-serif-12:bold"), /* #### This needs to be fixed to give a proper type and converter for XftFonts. See also xlwtabs.c. */ - {XtNxftFont, XtCXftFont, XtRString, sizeof(XtPointer), - offset(menu.xftFontName), XtRString, (XtPointer) "Helvetica-12:bold" }, + fontres (XtNxftFont, XtCXftFont, XtRString, XtPointer, xftFontName, + "Helvetica-12:bold"), #endif # ifdef USE_XFONTSET /* #### Consider using the same method as for Motif; see the comment in XlwMenuInitialize(). */ - {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet), - offset(menu.font_set), XtRString, (XtPointer) "XtDefaultFontSet"}, + fontres (XtNfontSet, XtCFontSet, XtRFontSet, XFontSet, font_set, + "XtDefaultFontSet"), # endif #endif - {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - offset(menu.foreground), XtRString, (XtPointer) "XtDefaultForeground"}, - {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel), - offset(menu.button_foreground), XtRString, (XtPointer) "XtDefaultForeground"}, - {XtNhighlightForeground, XtCHighlightForeground, XtRPixel, sizeof(Pixel), - offset(menu.highlight_foreground), XtRString, (XtPointer) "XtDefaultForeground"}, - {XtNtitleForeground, XtCTitleForeground, XtRPixel, sizeof(Pixel), - offset(menu.title_foreground), XtRString, (XtPointer) "XtDefaultForeground"}, - {XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension), - offset(menu.margin), XtRImmediate, (XtPointer)2}, - {XmNmarginWidth, XmCMarginWidth, XmRHorizontalDimension, sizeof(Dimension), - offset(menu.horizontal_margin), XtRImmediate, (XtPointer)2}, - {XmNmarginHeight, XmCMarginHeight, XmRVerticalDimension, sizeof(Dimension), - offset(menu.vertical_margin), XtRImmediate, (XtPointer)1}, - {XmNspacing, XmCSpacing, XmRHorizontalDimension, sizeof(Dimension), - offset(menu.column_spacing), XtRImmediate, (XtPointer)4}, - {XmNindicatorSize, XmCIndicatorSize, XtRDimension, sizeof(Dimension), - offset(menu.indicator_size), XtRImmediate, (XtPointer)0}, + fgpixres (XtNforeground, XtCForeground, foreground), + fgpixres (XtNbuttonForeground, XtCButtonForeground, button_foreground), + fgpixres (XtNhighlightForeground, XtCHighlightForeground, + highlight_foreground), + fgpixres (XtNtitleForeground, XtCTitleForeground, title_foreground), + dimres (XtNmargin, XtCMargin, XtRDimension, margin, 2), + dimres (XmNmarginWidth, XmCMarginWidth, XmRHorizontalDimension, + horizontal_margin, 2), + dimres (XmNmarginHeight, XmCMarginHeight, XmRVerticalDimension, + vertical_margin, 1), + dimres (XmNspacing, XmCSpacing, XmRHorizontalDimension, column_spacing, 4), + dimres (XmNindicatorSize, XmCIndicatorSize, XtRDimension, indicator_size, 0), #if 0 - {XmNshadowThickness, XmCShadowThickness, XmRHorizontalDimension, - sizeof (Dimension), offset (menu.shadow_thickness), - XtRImmediate, (XtPointer) 2}, + dimres (XmNshadowThickness, XmCShadowThickness, XmRHorizontalDimension, + shadow_thickness, 2), #else - {XmNshadowThickness, XmCShadowThickness, XtRDimension, - sizeof (Dimension), offset (menu.shadow_thickness), - XtRImmediate, (XtPointer) 2}, + dimres (XmNshadowThickness, XmCShadowThickness, XtRDimension, + shadow_thickness, 2), #endif - {XmNselectColor, XmCSelectColor, XtRPixel, sizeof (Pixel), - offset (menu.select_color), XtRImmediate, (XtPointer)-1}, - {XmNtopShadowColor, XmCTopShadowColor, XtRPixel, sizeof (Pixel), - offset (menu.top_shadow_color), XtRImmediate, (XtPointer)-1}, - {XmNbottomShadowColor, XmCBottomShadowColor, XtRPixel, sizeof (Pixel), - offset (menu.bottom_shadow_color), XtRImmediate, (XtPointer)-1}, - {XmNtopShadowPixmap, XmCTopShadowPixmap, XtRPixmap, sizeof (Pixmap), - offset (menu.top_shadow_pixmap), XtRImmediate, (XtPointer)None}, - {XmNbottomShadowPixmap, XmCBottomShadowPixmap, XtRPixmap, sizeof (Pixmap), - offset (menu.bottom_shadow_pixmap), XtRImmediate, (XtPointer)None}, - - {XtNopen, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(menu.open), XtRCallback, (XtPointer)NULL}, - {XtNselect, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(menu.select), XtRCallback, (XtPointer)NULL}, - {XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer), - offset(menu.contents), XtRImmediate, (XtPointer)NULL}, - {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), - offset(menu.cursor_shape), XtRString, (XtPointer) "right_ptr"}, - {XtNhorizontal, XtCHorizontal, XtRInt, sizeof(int), - offset(menu.horizontal), XtRImmediate, (XtPointer)True}, - {XtNuseBackingStore, XtCUseBackingStore, XtRBoolean, sizeof (Boolean), - offset (menu.use_backing_store), XtRImmediate, (XtPointer)False}, - {XtNbounceDown, XtCBounceDown, XtRBoolean, sizeof (Boolean), - offset (menu.bounce_down), XtRImmediate, (XtPointer)True}, - {XtNresourceLabels, XtCResourceLabels, XtRBoolean, sizeof (Boolean), - offset (menu.lookup_labels), XtRImmediate, (XtPointer)False}, + nullpixres (XmNselectColor, XmCSelectColor, select_color), + nullpixres (XmNtopShadowColor, XmCTopShadowColor, top_shadow_color), + nullpixres (XmNbottomShadowColor, XmCBottomShadowColor, bottom_shadow_color), + pmres (XmNtopShadowPixmap, XmCTopShadowPixmap, top_shadow_pixmap), + pmres (XmNbottomShadowPixmap, XmCBottomShadowPixmap, bottom_shadow_pixmap), + + cbres (XtNopen, open, NULL), + cbres (XtNselect, select, NULL), + Xt_RESOURCE (XtNmenu, XtCMenu, XtRPointer, XtPointer, offset(contents), + XtRImmediate, NULL), + Xt_RESOURCE (XtNcursor, XtCCursor, XtRCursor, Cursor, offset(cursor_shape), + XtRString, "right_ptr"), + Xt_RESOURCE (XtNhorizontal, XtCHorizontal, XtRInt, int, offset(horizontal), + XtRImmediate, True), + boolres (XtNuseBackingStore, XtCUseBackingStore, use_backing_store, False), + boolres (XtNbounceDown, XtCBounceDown, bounce_down, True), + boolres (XtNresourceLabels, XtCResourceLabels, lookup_labels, False), + +#undef offset +#undef mflres +#undef fontres +#undef dimres +#undef boolres +#undef cbres +#undef pixres +#undef fgpixres +#undef nullpixres +#undef pmres }; -#undef offset static Boolean XlwMenuSetValues (Widget current, Widget request, Widget new_, ArgList args, Cardinal *num_args); @@ -186,9 +198,9 @@ static XtActionsRec xlwMenuActionsList [] = { - {"start", Start}, - {"drag", Drag}, - {"select", Select}, + { (String) "start", Start}, + { (String) "drag", Drag}, + { (String) "select", Select}, }; #define SuperClass ((CoreWidgetClass)&coreClassRec) @@ -197,7 +209,7 @@ { { /* CoreClass fields initialization */ (WidgetClass) SuperClass, /* superclass */ - "XlwMenu", /* class_name */ + (String) "XlwMenu", /* class_name */ sizeof(XlwMenuRec), /* size */ XlwMenuClassInitialize, /* class_initialize */ NULL, /* class_part_initialize */ @@ -495,7 +507,7 @@ static XtResource nameResource[] = { - { "labelString", "LabelString", XtRString, sizeof(String), + { (String) "labelString", (String) "LabelString", XtRString, sizeof(String), 0, XtRImmediate, 0 } };
--- a/lwlib/xlwradio.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/xlwradio.c Wed Oct 29 04:06:33 2008 +0900 @@ -55,6 +55,7 @@ #include <X11/StringDefs.h> #include ATHENA_XawInit_h_ #include "../src/xmu.h" +#include "xt-wrappers.h" #include "xlwradioP.h" #define BOX_SIZE 13 @@ -116,8 +117,8 @@ static XtActionsRec actionsList[] = { - {"highlight", RadioHighlight}, - {"unhighlight", RadioUnhighlight}, + { (String) "highlight", RadioHighlight }, + { (String) "unhighlight", RadioUnhighlight }, }; #define SuperClass ((ToggleWidgetClass)&toggleClassRec) @@ -125,7 +126,7 @@ RadioClassRec radioClassRec = { { (WidgetClass) SuperClass, /* superclass */ - "Radio", /* class_name */ + (String) "Radio", /* class_name */ sizeof(RadioRec), /* size */ RadioClassInit, /* class_initialize */ RadioClassPartInit, /* class_part_initialize */
--- a/lwlib/xlwscrollbar.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/xlwscrollbar.c Wed Oct 29 04:06:33 2008 +0900 @@ -79,6 +79,7 @@ #include <X11/bitmaps/gray> #include "lwlib-colors.h" +#include "xt-wrappers.h" #include "xlwscrollbarP.h" #include "xlwscrollbar.h" @@ -113,90 +114,79 @@ } SliderStyle; /*-------------------------- Resources ----------------------------------*/ -#define offset(field) XtOffset(XlwScrollBarWidget, field) static XtResource resources[] = { - { XmNforeground, XmCForeground, XtRPixel, sizeof(Pixel), - offset(sb.foreground), XtRImmediate, (XtPointer) XtDefaultForeground }, +#define offset(field) XtOffset(XlwScrollBarWidget, field) +#define res(name,_class,intrepr,type,member,extrepr,value) \ + Xt_RESOURCE (name, _class, intrepr, type, offset(sb.member), extrepr, value) - { XmNtopShadowColor, XmCTopShadowColor, XtRPixel, - sizeof(Pixel), offset(sb.topShadowColor), XtRImmediate, (XtPointer) ~0 }, - { XmNbottomShadowColor, XmCBottomShadowColor, XtRPixel, - sizeof(Pixel), offset(sb.bottomShadowColor), XtRImmediate, - (XtPointer)~0 }, - - { XmNtopShadowPixmap, XmCTopShadowPixmap, XtRPixmap, - sizeof (Pixmap), offset(sb.topShadowPixmap), XtRImmediate, - (XtPointer)None}, - { XmNbottomShadowPixmap, XmCBottomShadowPixmap, - XtRPixmap, sizeof (Pixmap), offset(sb.bottomShadowPixmap), - XtRImmediate, (XtPointer)None}, + res (XmNforeground, XmCForeground, XtRPixel, Pixel, + foreground, XtRImmediate, XtDefaultForeground), + res (XmNtopShadowColor, XmCTopShadowColor, XtRPixel, + Pixel, topShadowColor, XtRImmediate, ~0), + res (XmNbottomShadowColor, XmCBottomShadowColor, XtRPixel, + Pixel, bottomShadowColor, XtRImmediate, ~0), - { XmNtroughColor, XmCTroughColor, XtRPixel, sizeof(Pixel), - offset(sb.troughColor), XtRImmediate, (XtPointer)~0 }, + res (XmNtopShadowPixmap, XmCTopShadowPixmap, XtRPixmap, + Pixmap, topShadowPixmap, XtRImmediate, None), + res (XmNbottomShadowPixmap, XmCBottomShadowPixmap, + XtRPixmap, Pixmap, bottomShadowPixmap, XtRImmediate, None), - { XmNshadowThickness, XmCShadowThickness, XtRInt, - sizeof(int), offset(sb.shadowThickness), XtRImmediate, (XtPointer)2 }, + res (XmNtroughColor, XmCTroughColor, XtRPixel, Pixel, troughColor, + XtRImmediate, ~0), - { XmNborderWidth, XmCBorderWidth, XtRDimension, - sizeof(Dimension), offset(core.border_width), XtRImmediate, - (XtPointer)0 }, + res (XmNshadowThickness, XmCShadowThickness, XtRInt, int, + shadowThickness, XtRImmediate, 2), - { XmNshowArrows, XmCShowArrows, XtRBoolean, - sizeof(Boolean), offset(sb.showArrows), XtRImmediate, (XtPointer)True }, + Xt_RESOURCE (XmNborderWidth, XmCBorderWidth, XtRDimension, Dimension, + offset(core.border_width), XtRImmediate, 0), - { XmNinitialDelay, XmCInitialDelay, XtRInt, sizeof(int), - offset(sb.initialDelay), XtRImmediate, (XtPointer) 250 }, - { XmNrepeatDelay, XmCRepeatDelay, XtRInt, sizeof(int), - offset(sb.repeatDelay), XtRImmediate, (XtPointer) 50 }, + res (XmNshowArrows, XmCShowArrows, XtRBoolean, Boolean, showArrows, + XtRImmediate, True), - { XmNorientation, XmCOrientation, XtROrientation, - sizeof(unsigned char), offset(sb.orientation), XtRImmediate, - (XtPointer) XmVERTICAL }, + res (XmNinitialDelay, XmCInitialDelay, XtRInt, int, initialDelay, + XtRImmediate, 250), + res (XmNrepeatDelay, XmCRepeatDelay, XtRInt, int, repeatDelay, + XtRImmediate, 50), + + res (XmNorientation, XmCOrientation, XtROrientation, + unsigned char, orientation, XtRImmediate, XmVERTICAL), - { XmNminimum, XmCMinimum, XtRInt, sizeof(int), - offset(sb.minimum), XtRImmediate, (XtPointer) 0}, - { XmNmaximum, XmCMaximum, XtRInt, sizeof(int), - offset(sb.maximum), XtRImmediate, (XtPointer) 100}, - { XmNvalue, XmCValue, XtRInt, sizeof(int), - offset(sb.value), XtRImmediate, (XtPointer) 0}, - { XmNsliderSize, XmCSliderSize, XtRInt, sizeof(int), - offset(sb.sliderSize), XtRImmediate, (XtPointer) 10}, - { XmNincrement, XmCIncrement, XtRInt, sizeof(int), - offset(sb.increment), XtRImmediate, (XtPointer) 1}, - { XmNpageIncrement, XmCPageIncrement, XtRInt, sizeof(int), - offset(sb.pageIncrement), XtRImmediate, (XtPointer) 10}, + res (XmNminimum, XmCMinimum, XtRInt, int, minimum, XtRImmediate, 0), + res (XmNmaximum, XmCMaximum, XtRInt, int, maximum, XtRImmediate, 100), + res (XmNvalue, XmCValue, XtRInt, int, value, XtRImmediate, 0), + res (XmNsliderSize, XmCSliderSize, XtRInt, int, sliderSize, XtRImmediate, 10), + res (XmNincrement, XmCIncrement, XtRInt, int, increment, XtRImmediate, 1), + res (XmNpageIncrement, XmCPageIncrement, XtRInt, int, + pageIncrement, XtRImmediate, 10), - { XmNvalueChangedCallback, XmCValueChangedCallback, - XtRCallback, sizeof(XtPointer), offset(sb.valueChangedCBL), - XtRCallback, NULL}, - { XmNincrementCallback, XmCIncrementCallback, - XtRCallback, sizeof(XtPointer), offset(sb.incrementCBL), - XtRCallback, NULL}, - { XmNdecrementCallback, XmCDecrementCallback, - XtRCallback, sizeof(XtPointer), offset(sb.decrementCBL), - XtRCallback, NULL}, - { XmNpageIncrementCallback, XmCPageIncrementCallback, - XtRCallback, sizeof(XtPointer), offset(sb.pageIncrementCBL), - XtRCallback, NULL}, - { XmNpageDecrementCallback, XmCPageDecrementCallback, - XtRCallback, sizeof(XtPointer), offset(sb.pageDecrementCBL), - XtRCallback, NULL}, - { XmNtoTopCallback, XmCToTopCallback, XtRCallback, - sizeof(XtPointer), offset(sb.toTopCBL), XtRCallback, NULL}, - { XmNtoBottomCallback, XmCToBottomCallback, XtRCallback, - sizeof(XtPointer), offset(sb.toBottomCBL), XtRCallback, NULL}, - { XmNdragCallback, XmCDragCallback, XtRCallback, - sizeof(XtPointer), offset(sb.dragCBL), XtRCallback, NULL}, + res (XmNvalueChangedCallback, XmCValueChangedCallback, + XtRCallback, XtPointer, valueChangedCBL, XtRCallback, NULL), + res (XmNincrementCallback, XmCIncrementCallback, + XtRCallback, XtPointer, incrementCBL, XtRCallback, NULL), + res (XmNdecrementCallback, XmCDecrementCallback, + XtRCallback, XtPointer, decrementCBL, XtRCallback, NULL), + res (XmNpageIncrementCallback, XmCPageIncrementCallback, + XtRCallback, XtPointer, pageIncrementCBL, XtRCallback, NULL), + res (XmNpageDecrementCallback, XmCPageDecrementCallback, + XtRCallback, XtPointer, pageDecrementCBL, XtRCallback, NULL), + res (XmNtoTopCallback, XmCToTopCallback, XtRCallback, + XtPointer, toTopCBL, XtRCallback, NULL), + res (XmNtoBottomCallback, XmCToBottomCallback, XtRCallback, + XtPointer, toBottomCBL, XtRCallback, NULL), + res (XmNdragCallback, XmCDragCallback, XtRCallback, + XtPointer, dragCBL, XtRCallback, NULL), /* "knob" is obsolete; use "slider" instead. */ - { XmNsliderStyle, XmCSliderStyle, XtRString, sizeof(char *), - offset(sb.sliderStyle), XtRImmediate, NULL}, - { XmNknobStyle, XmCKnobStyle, XtRString, sizeof(char *), - offset(sb.knobStyle), XtRImmediate, NULL}, + res (XmNsliderStyle, XmCSliderStyle, XtRString, char *, + sliderStyle, XtRImmediate, NULL), + res (XmNknobStyle, XmCKnobStyle, XtRString, char *, + knobStyle, XtRImmediate, NULL), - { XmNarrowPosition, XmCArrowPosition, XtRString, sizeof(char *), - offset(sb.arrowPosition), XtRImmediate, NULL}, + res (XmNarrowPosition, XmCArrowPosition, XtRString, char *, + arrowPosition, XtRImmediate, NULL), +#undef offset +#undef res }; /*-------------------------- Prototypes ---------------------------------*/ @@ -218,13 +208,13 @@ /*-------------------------- Actions Table ------------------------------*/ static XtActionsRec actions[] = { - {"Select", Select}, - {"PageDownOrRight", PageDownOrRight}, - {"PageUpOrLeft", PageUpOrLeft}, - {"Drag", Drag}, - {"Release", Release}, - {"Jump", Jump}, - {"Abort", Abort}, + { (String) "Select", Select}, + { (String) "PageDownOrRight", PageDownOrRight}, + { (String) "PageUpOrLeft", PageUpOrLeft}, + { (String) "Drag", Drag}, + { (String) "Release", Release}, + { (String) "Jump", Jump}, + { (String) "Abort", Abort}, }; /*--------------------- Default Translation Table -----------------------*/ @@ -243,7 +233,7 @@ /* core_class fields */ { /* superclass */ (WidgetClass) &coreClassRec, - /* class_name */ "XlwScrollBar", + /* class_name */ (String) "XlwScrollBar", /* widget_size */ sizeof(XlwScrollBarRec), /* class_initialize */ NULL, /* class_part_init */ NULL,
--- a/lwlib/xlwtabs.c Wed Oct 29 04:02:05 2008 +0900 +++ b/lwlib/xlwtabs.c Wed Oct 29 04:06:33 2008 +0900 @@ -142,64 +142,69 @@ " ; static XtAccelerators defaultAccelerators ; /* #### Never used */ +static XtResource resources[] = { #define offset(field) XtOffsetOf(TabsRec, tabs.field) -static XtResource resources[] = { +#define res(name,_class,intrepr,type,member,extrepr,value) \ + Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value) - {XtNselectInsensitive, XtCSelectInsensitive, XtRBoolean, sizeof(Boolean), - offset(selectInsensitive), XtRImmediate, (XtPointer) True}, - {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), - offset(font), XtRString, (XtPointer) XtDefaultFont}, + res (XtNselectInsensitive, XtCSelectInsensitive, XtRBoolean, Boolean, + selectInsensitive, XtRImmediate, True), + res (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, + font, XtRString, XtDefaultFont), #ifdef USE_XFT_TABS /* #### Maybe use "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1" here? or XtDefaultFont? */ - {XtNfcFontName, XtCFcFontName, XtRString, sizeof(String), - offset(fcFontName), XtRString, (XtPointer) NULL }, + res (XtNfcFontName, XtCFcFontName, XtRString, String, + fcFontName, XtRString, NULL), /* #### This needs to be fixed to give a proper type and converter for XftFonts. See also xlwmenu.c. */ - {XtNxftFont, XtCXftFont, XtRString, sizeof(String), - offset(xftFontName), XtRString, (XtPointer) "Helvetica-12" }, + res (XtNxftFont, XtCXftFont, XtRString, String, + xftFontName, XtRString, "Helvetica-12"), #endif - {XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension), - offset(internalWidth), XtRImmediate, (XtPointer)4 }, - {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension), - offset(internalHeight), XtRImmediate, (XtPointer)4 }, - {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), - XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, (XtPointer)0}, - {XtNtopWidget, XtCTopWidget, XtRWidget, sizeof(Widget), - offset(topWidget), XtRImmediate, NULL}, - {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(callbacks), XtRCallback, NULL}, - {XtNpopdownCallback, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(popdownCallbacks), XtRCallback, NULL}, - {XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, sizeof(Boolean), - offset(be_nice_to_cmap), XtRImmediate, (XtPointer) True}, - {XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, sizeof(int), - offset(top_shadow_contrast), XtRImmediate, (XtPointer) 20}, - {XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, sizeof(int), - offset(bot_shadow_contrast), XtRImmediate, (XtPointer) 40}, - {XtNinsensitiveContrast, XtCInsensitiveContrast, XtRInt, sizeof(int), - offset(insensitive_contrast), XtRImmediate, (XtPointer) 33}, - {XtNaccelerators, XtCAccelerators, XtRAcceleratorTable,sizeof(XtTranslations), - XtOffsetOf(TabsRec,core.accelerators), XtRString, accelTable}, + res (XtNinternalWidth, XtCWidth, XtRDimension, Dimension, + internalWidth, XtRImmediate, 4), + res (XtNinternalHeight, XtCHeight, XtRDimension, Dimension, + internalHeight, XtRImmediate, 4), + Xt_RESOURCE (XtNborderWidth, XtCBorderWidth, XtRDimension, Dimension, + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, 0), + res (XtNtopWidget, XtCTopWidget, XtRWidget, Widget, + topWidget, XtRImmediate, NULL), + res (XtNcallback, XtCCallback, XtRCallback, XtPointer, + callbacks, XtRCallback, NULL), + res (XtNpopdownCallback, XtCCallback, XtRCallback, XtPointer, + popdownCallbacks, XtRCallback, NULL), + res (XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, Boolean, + be_nice_to_cmap, XtRImmediate, True), + res (XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, int, + top_shadow_contrast, XtRImmediate, 20), + res (XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, int, + bot_shadow_contrast, XtRImmediate, 40), + res (XtNinsensitiveContrast, XtCInsensitiveContrast, XtRInt, int, + insensitive_contrast, XtRImmediate, 33), + Xt_RESOURCE (XtNaccelerators, XtCAccelerators, XtRAcceleratorTable, + XtTranslations, XtOffsetOf(TabsRec,core.accelerators), + XtRString, accelTable), +#undef offset +#undef res }; -#undef offset - /* constraint resources */ +static XtResource tabsConstraintResources[] = { #define offset(field) XtOffsetOf(TabsConstraintsRec, tabs.field) -static XtResource tabsConstraintResources[] = { - {XtNtabLabel, XtCLabel, XtRString, sizeof(String), - offset(label), XtRString, NULL}, - {XtNtabLeftBitmap, XtCLeftBitmap, XtRBitmap, sizeof(Pixmap), - offset(left_bitmap), XtRImmediate, None}, - {XtNtabForeground, XtCForeground, XtRPixel, sizeof(Pixel), - offset(foreground), XtRString, (XtPointer) XtDefaultForeground}, - {XtNresizable, XtCResizable, XtRBoolean, sizeof(Boolean), - offset(resizable), XtRImmediate, (XtPointer) True}, +#define res(name,_class,intrepr,type,member,extrepr,value) \ + Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value) + res (XtNtabLabel, XtCLabel, XtRString, String, label, XtRString, NULL), + res (XtNtabLeftBitmap, XtCLeftBitmap, XtRBitmap, Pixmap, left_bitmap, + XtRImmediate, None), + res (XtNtabForeground, XtCForeground, XtRPixel, Pixel, foreground, + XtRString, XtDefaultForeground), + res (XtNresizable, XtCResizable, XtRBoolean, Boolean, resizable, + XtRImmediate, True), +#undef offset +#undef res } ; -#undef offset @@ -318,10 +323,10 @@ static XtActionsRec actionsList[] = { - {"select", TabsSelect}, - {"page", TabsPage}, - {"highlight", TabsHighlight}, - {"unhighlight", TabsUnhighlight}, + { (String) "select", TabsSelect }, + { (String) "page", TabsPage }, + { (String) "highlight", TabsHighlight }, + { (String) "unhighlight", TabsUnhighlight }, } ; @@ -341,7 +346,7 @@ { /* core_class fields */ /* superclass */ (WidgetClass) SuperClass, - /* class_name */ "Tabs", + /* class_name */ (String) "Tabs", /* widget_size */ sizeof(TabsRec), /* class_initialize */ TabsClassInit, /* class_part_init */ NULL, /* TODO? */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lwlib/xt-wrappers.h Wed Oct 29 04:06:33 2008 +0900 @@ -0,0 +1,103 @@ +/* Wrappers for Xt functions and macros + + Copyright (C) 2008 Free Software Foundation + +This file is part of XEmacs. + +XEmacs 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) any +later version. + +XEmacs is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of 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 XEmacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Synched up with: Not in FSF. */ + +/* Original author: Stephen J. Turnbull for 21.5.29 */ + +/* Generic utility macros, including coping with G++ whining. + Used in lwlib via lwlib.h and X consoles via console-x.h. + + We would prefer to find another way to shut up G++. The issue is that + recent versions of the C++ standard deprecate implicit conversions + across function boundaries like + + typedef char *String; + void foo (String string); + foo ("bar"); + + because "bar" should be allowed to be a read-only array of chars. But of + course lots of legacy code (== X11) declares things as char * and expects + to assign literal strings to them. Now, the typedef in the example is + important because in G++ 4.3.2 at least, this + + void foo (const String string); + foo ("bar"); + + does not work as expected! G++ still warns about this construct. However, + if foo is declared + + void foo (const char *string); + + G++ does not complain. (#### There are two possibilities I can think of. + (a) G++ is buggy. (b) "const String" is interpreted as "char * const".) + + The upshot is that to avoid warnings with Xt's String typedef, we need to + arrange to cast literal strings to String, rather than use "const String" + in declarations. (My <X11/Intrinsic.h> says that the actual internal + typedef used is _XtString, so that String can be #define'd to something + else for the purposes of C++. But that doesn't really help us much.) + + It's not very satisfactory to do it this way -- it would be much better to + have const Strings where they make sense -- but it does eliminate a few + hundred warnings from the C++ build. And in any case we don't control the + many objects declared with String components in Intrinsic.h. The remaining + issues are the WEXTTEXT macro used in src/emacs.c, and Emacs.ad.h (where + instead of String we use const char * in src/event-Xt.c in the array that + #includes it). +*/ + +#ifndef INCLUDED_xt_wrappers_h_ +#define INCLUDED_xt_wrappers_h_ + +/* Wrap XtResource, with the same elements as arguments. + The cast to String shuts up G++ 4.3's whining about const char *. + The invocation of sizeof should be pretty safe, and the cast to XtPointer + surely is, since that's how that member of XtResource is declared. It + doesn't hide potential problems, because XtPointer is a "generic" type in + any case -- the actual object will have a different type, that will be + cast to XtPointer. */ + +#define Xt_RESOURCE(name,_class,intrepr,type,member,extrepr,value) \ + { (String) name, (String) _class, (String) intrepr, sizeof(type), \ + member, extrepr, (XtPointer) value } + +/* Wrap XtSetArg, with the same arguments. + The cast to String shuts up G++ 4.3's whining about const char *. */ + +#define Xt_SET_ARG(al, resource, x) do { \ + XtSetArg ((al), (String) (resource), (x)); \ + } while (0) + +/* Convenience macros for getting/setting one resource value. */ + +#define Xt_SET_VALUE(widget, resource, value) do { \ + Arg al; \ + Xt_SET_ARG (al, resource, value); \ + XtSetValues (widget, &al, 1); \ +} while (0) + +#define Xt_GET_VALUE(widget, resource, location) do { \ + Arg al; \ + Xt_SET_ARG (al, resource, location); \ + XtGetValues (widget, &al, 1); \ +} while (0) + +#endif /* INCLUDED_xt_wrappers_h_ */
--- a/src/EmacsFrame.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/EmacsFrame.c Wed Oct 29 04:06:33 2008 +0900 @@ -43,6 +43,7 @@ #include "EmacsFrameP.h" #include "EmacsManager.h" /* for EmacsManagerChangeSize */ #include "xmu.h" +#include "../lwlib/xt-wrappers.h" static void EmacsFrameClassInitialize (void); static void EmacsFrameInitialize (Widget, Widget, ArgList, Cardinal *); @@ -60,117 +61,83 @@ #define XtOffset(p_type,field) \ ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0))) #define offset(field) XtOffset (EmacsFrame, emacs_frame.field) - +#define res(name,_class,intrepr,type,member,extrepr,value) \ + Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value) static XtResource resources[] = { - { XtNgeometry, XtCGeometry, - XtRString, sizeof (String), - offset (geometry), XtRString, (XtPointer) 0 }, - { XtNiconic, XtCIconic, - XtRBoolean, sizeof (Boolean), - offset (iconic), XtRImmediate, (XtPointer) False }, + res (XtNgeometry, XtCGeometry, XtRString, String, geometry, XtRString, 0), + res (XtNiconic, XtCIconic, XtRBoolean, Boolean, iconic, XtRImmediate, False), - { XtNemacsFrame, XtCEmacsFrame, - XtRPointer, sizeof (XtPointer), - offset (frame), XtRImmediate, 0 }, - { XtNmenubar, XtCMenubar, - XtRBoolean, sizeof (Boolean), - offset (menubar_p), XtRImmediate, (XtPointer) True }, - { XtNinitiallyUnmapped, XtCInitiallyUnmapped, - XtRBoolean, sizeof (Boolean), - offset (initially_unmapped), XtRImmediate, (XtPointer) False }, - { XtNminibuffer, XtCMinibuffer, - XtRBoolean, sizeof (Boolean), - offset (minibuffer), XtRImmediate, (XtPointer) True }, - { XtNunsplittable, XtCUnsplittable, - XtRBoolean, sizeof (Boolean), - offset (unsplittable), XtRImmediate, (XtPointer) False }, - { XtNinternalBorderWidth, XtCInternalBorderWidth, - XtRInt, sizeof (int), - offset (internal_border_width), XtRImmediate, (XtPointer)4 }, + res (XtNemacsFrame, XtCEmacsFrame, XtRPointer, XtPointer, + frame, XtRImmediate, 0), + res (XtNmenubar, XtCMenubar, XtRBoolean, Boolean, + menubar_p, XtRImmediate, True), + res (XtNinitiallyUnmapped, XtCInitiallyUnmapped, XtRBoolean, Boolean, + initially_unmapped, XtRImmediate, False), + res (XtNminibuffer, XtCMinibuffer, XtRBoolean, Boolean, + minibuffer, XtRImmediate, True), + res (XtNunsplittable, XtCUnsplittable, XtRBoolean, Boolean, + unsplittable, XtRImmediate, False), + res (XtNinternalBorderWidth, XtCInternalBorderWidth, XtRInt, int, + internal_border_width, XtRImmediate, 4), #ifdef HAVE_SCROLLBARS - { XtNscrollBarWidth, XtCScrollBarWidth, - XtRInt, sizeof (int), - offset (scrollbar_width), XtRImmediate, (XtPointer)-1 }, - { XtNscrollBarHeight, XtCScrollBarHeight, - XtRInt, sizeof (int), - offset (scrollbar_height), XtRImmediate, (XtPointer)-1 }, - { XtNscrollBarPlacement, XtCScrollBarPlacement, - XtRScrollBarPlacement, sizeof (unsigned char), - offset (scrollbar_placement), XtRImmediate, + res (XtNscrollBarWidth, XtCScrollBarWidth, XtRInt, int, + scrollbar_width, XtRImmediate, -1), + res (XtNscrollBarHeight, XtCScrollBarHeight, XtRInt, int, + scrollbar_height, XtRImmediate, -1), + res (XtNscrollBarPlacement, XtCScrollBarPlacement, XtRScrollBarPlacement, + unsigned char, scrollbar_placement, XtRImmediate, #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \ defined (LWLIB_SCROLLBARS_ATHENA3D) - (XtPointer) XtBOTTOM_RIGHT + XtBOTTOM_RIGHT #else - (XtPointer) XtBOTTOM_LEFT + XtBOTTOM_LEFT #endif - }, + ), #endif /* HAVE_SCROLLBARS */ #ifdef HAVE_TOOLBARS - { XtNtopToolBarHeight, XtCTopToolBarHeight, - XtRInt, sizeof (int), - offset (top_toolbar_height), XtRImmediate, (XtPointer)-1 }, - { XtNbottomToolBarHeight, XtCBottomToolBarHeight, - XtRInt, sizeof (int), - offset (bottom_toolbar_height), XtRImmediate, (XtPointer)-1 }, - { XtNleftToolBarWidth, XtCLeftToolBarWidth, - XtRInt, sizeof (int), - offset (left_toolbar_width), XtRImmediate, (XtPointer)-1 }, - { XtNrightToolBarWidth, XtCRightToolBarWidth, - XtRInt, sizeof (int), - offset (right_toolbar_width), XtRImmediate, (XtPointer)-1 }, - { XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth, - XtRInt, sizeof (int), - offset (top_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, - { XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth, - XtRInt, sizeof (int), - offset (bottom_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, - { XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth, - XtRInt, sizeof (int), - offset (left_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, - { XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth, - XtRInt, sizeof (int), - offset (right_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, - { XtNtoolBarShadowThickness, XtCToolBarShadowThickness, - XtRDimension, sizeof (Dimension), - offset (toolbar_shadow_thickness), XtRImmediate, (XtPointer)2 }, + res (XtNtopToolBarHeight, XtCTopToolBarHeight, XtRInt, int, + top_toolbar_height, XtRImmediate, -1), + res (XtNbottomToolBarHeight, XtCBottomToolBarHeight, XtRInt, int, + bottom_toolbar_height, XtRImmediate, -1), + res (XtNleftToolBarWidth, XtCLeftToolBarWidth, XtRInt, int, + left_toolbar_width, XtRImmediate, -1), + res (XtNrightToolBarWidth, XtCRightToolBarWidth, XtRInt, int, + right_toolbar_width, XtRImmediate, -1), + res (XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth, XtRInt, int, + top_toolbar_border_width, XtRImmediate, -1), + res (XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth, XtRInt, int, + bottom_toolbar_border_width, XtRImmediate, -1), + res (XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth, XtRInt, + int, left_toolbar_border_width, XtRImmediate, -1), + res (XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth, XtRInt, + int, right_toolbar_border_width, XtRImmediate, -1), + res (XtNtoolBarShadowThickness, XtCToolBarShadowThickness, XtRDimension, + Dimension, toolbar_shadow_thickness, XtRImmediate, 2), #endif /* HAVE_TOOLBARS */ - { XtNinterline, XtCInterline, - XtRInt, sizeof (int), - offset (interline), XtRImmediate, (XtPointer)0 }, - { - XtNfont, XtCFont, - XtRFontStruct, sizeof (XFontStruct *), - offset(font), XtRImmediate, (XtPointer)0 - }, - { XtNforeground, XtCForeground, - XtRPixel, sizeof (Pixel), - offset(foreground_pixel), XtRString, (XtPointer) "Black" }, - { XtNbackground, XtCBackground, - XtRPixel, sizeof (Pixel), - offset(background_pixel), XtRString, (XtPointer) "Gray80" }, - { XtNcursorColor, XtCForeground, - XtRPixel, sizeof (Pixel), - offset(cursor_color), XtRString, (XtPointer) "XtDefaultForeground" }, - { XtNbarCursor, XtCBarCursor, - XtRBoolean, sizeof (Boolean), - offset (bar_cursor), XtRImmediate, (XtPointer)0 }, - { XtNvisualBell, XtCVisualBell, - XtRBoolean, sizeof (Boolean), - offset (visual_bell), XtRImmediate, (XtPointer)0 }, - { XtNbellVolume, XtCBellVolume, - XtRInt, sizeof (int), - offset (bell_volume), XtRImmediate, (XtPointer)0 }, - { XtNuseBackingStore, XtCUseBackingStore, - XtRBoolean, sizeof (Boolean), - offset (use_backing_store), XtRImmediate, (XtPointer)0 }, - { XtNpreferredWidth, XtCPreferredWidth, - XtRDimension, sizeof (Dimension), - offset (preferred_width), XtRImmediate, (XtPointer)0 }, - { XtNpreferredHeight, XtCPreferredHeight, - XtRDimension, sizeof (Dimension), - offset (preferred_height), XtRImmediate, (XtPointer)0 }, + res (XtNinterline, XtCInterline, XtRInt, int, + interline, XtRImmediate, 0), + res (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, + font, XtRImmediate, 0), + res (XtNforeground, XtCForeground, XtRPixel, Pixel, + foreground_pixel, XtRString, "Black"), + res (XtNbackground, XtCBackground, XtRPixel, Pixel, + background_pixel, XtRString, "Gray80"), + res (XtNcursorColor, XtCForeground, XtRPixel, Pixel, + cursor_color, XtRString, "XtDefaultForeground"), + res (XtNbarCursor, XtCBarCursor, XtRBoolean, Boolean, + bar_cursor, XtRImmediate, 0), + res (XtNvisualBell, XtCVisualBell, XtRBoolean, Boolean, + visual_bell, XtRImmediate, 0), + res (XtNbellVolume, XtCBellVolume, XtRInt, int, + bell_volume, XtRImmediate, 0), + res (XtNuseBackingStore, XtCUseBackingStore, XtRBoolean, Boolean, + use_backing_store, XtRImmediate, 0), + res (XtNpreferredWidth, XtCPreferredWidth, XtRDimension, Dimension, + preferred_width, XtRImmediate, 0), + res (XtNpreferredHeight, XtCPreferredHeight, XtRDimension, Dimension, + preferred_height, XtRImmediate, 0), }; #undef offset @@ -181,7 +148,7 @@ static XtActionsRec emacsFrameActionsTable [] = { - {"mapping", (XtActionProc) emacs_Xt_mapping_action}, + { (String) "mapping", (XtActionProc) emacs_Xt_mapping_action}, }; static char @@ -200,7 +167,7 @@ #else /* superclass */ &widgetClassRec, #endif - /* class_name */ "EmacsFrame", + /* class_name */ (String) "EmacsFrame", /* widget_size */ sizeof (EmacsFrameRec), /* class_initialize */ EmacsFrameClassInitialize, /* class_part_initialize */ 0, @@ -653,8 +620,8 @@ { Arg al [2]; - XtSetArg (al [0], XtNwidth, pixel_width); - XtSetArg (al [1], XtNheight, pixel_height); + Xt_SET_ARG (al [0], XtNwidth, pixel_width); + Xt_SET_ARG (al [1], XtNheight, pixel_height); XtSetValues ((Widget) ew, al, countof (al)); } }
--- a/src/EmacsManager.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/EmacsManager.c Wed Oct 29 04:06:33 2008 +0900 @@ -32,6 +32,7 @@ #include <Xm/RowColumn.h> #endif /* LWLIB_MENUBARS_MOTIF */ #include "compiler.h" +#include "../lwlib/xt-wrappers.h" /* For I, Emacs, am a kind god. Unlike the goddess Athena and the Titan Motif, I require no ritual sacrifices to placate the lesser @@ -39,15 +40,14 @@ static XtResource resources[] = { #define offset(field) XtOffset(EmacsManagerWidget, emacs_manager.field) - { XtNresizeCallback, XtCCallback, - XtRCallback, sizeof (XtCallbackList), - offset(resize_callback), XtRImmediate, (XtPointer) 0 }, - { XtNqueryGeometryCallback, XtCCallback, - XtRCallback, sizeof (XtCallbackList), - offset(query_geometry_callback), XtRImmediate, (XtPointer) 0 }, - { XtNuserData, XtCUserData, - XtRPointer, sizeof (XtPointer), - offset(user_data), XtRImmediate, (XtPointer) 0 }, +#define res(name,_class,intrepr,size,member,extrepr,value) \ + Xt_RESOURCE (name, _class, intrepr, size, offset(member), extrepr, value) + res (XtNresizeCallback, XtCCallback, XtRCallback, XtCallbackList, + resize_callback, XtRImmediate, 0), + res (XtNqueryGeometryCallback, XtCCallback, XtRCallback, XtCallbackList, + query_geometry_callback, XtRImmediate, 0), + res (XtNuserData, XtCUserData, XtRPointer, XtPointer, + user_data, XtRImmediate, 0), }; /**************************************************************** @@ -75,7 +75,7 @@ #else /* superclass */ (WidgetClass) &compositeClassRec, #endif - /* class_name */ "EmacsManager", + /* class_name */ (String) "EmacsManager", /* widget_size */ sizeof (EmacsManagerRec), /* class_initialize */ ClassInitialize, /* class_part_init */ NULL,
--- a/src/EmacsShell-sub.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/EmacsShell-sub.c Wed Oct 29 04:06:33 2008 +0900 @@ -89,6 +89,7 @@ #include <X11/Vendor.h> #include <X11/VendorP.h> #include "EmacsShellP.h" +#include "../lwlib/xt-wrappers.h" #define ABORT abort @@ -134,30 +135,28 @@ static XtResource resources[] = { #define offset(field) XtOffset(EMACS_SHELL_WIDGET, emacs_shell.field) #define coreoffset(field) XtOffset(EMACS_SHELL_WIDGET, core.field) +#define res(name,_class,member,size) \ + { (String) name, (String) _class, XtRInt, sizeof (int), \ + offset (member), XtRImmediate, (XtPointer)0 } +#define motifres(name,member) \ + { (String) name, XtCPosition, XtRPosition, sizeof (Position), \ + coreoffset (member), XtRImmediate, (XtPointer)BIGSIZE } #ifdef LWLIB_USES_MOTIF /* *** BOGOSITY^10! *** The Motif VendorShell fucks around with the default values for X and Y, for no obvious reason. This causes Shell to indicate that the defaults of (0,0) were program-specified, instead of letting the WM do what it wants. */ - { XtNx, XtCPosition, - XtRPosition, sizeof (Position), - coreoffset (x), XtRImmediate, (XtPointer)BIGSIZE }, - { XtNy, XtCPosition, - XtRPosition, sizeof (Position), - coreoffset (y), XtRImmediate, (XtPointer)BIGSIZE }, + motifres (XtNx, x), + motifres (XtNy, y), #endif - { XtNwidthCells, XtCWidthCells, - XtRInt, sizeof (int), - offset (width_cells), XtRImmediate, (XtPointer)0 }, - { XtNheightCells, XtCHeightCells, - XtRInt, sizeof (int), - offset (height_cells), XtRImmediate, (XtPointer)0 }, - { XtNminWidthCells, XtCMinWidthCells, - XtRInt, sizeof (int), - offset (min_width_cells), XtRImmediate, (XtPointer)0 }, - { XtNminHeightCells, XtCMinHeightCells, - XtRInt, sizeof (int), - offset (min_height_cells), XtRImmediate, (XtPointer)0 }, + res (XtNwidthCells, XtCWidthCells, width_cells, 0), + res (XtNheightCells, XtCHeightCells, height_cells, 0), + res (XtNminWidthCells, XtCMinWidthCells, min_width_cells, 0), + res (XtNminHeightCells, XtCMinHeightCells, min_height_cells, 0), +#undef offset +#undef coreoffset +#undef res +#undef motifres }; static CompositeClassExtensionRec compositeClassExtRec = { @@ -259,12 +258,12 @@ printf (" base size set to: %d %d\n", base_width, base_height); fflush (stdout); #endif - XtSetArg(al [0], XtNbaseWidth, base_width); - XtSetArg(al [1], XtNbaseHeight, base_height); - XtSetArg(al [2], XtNminWidth, base_width + - cell_width * w->emacs_shell.min_width_cells); - XtSetArg(al [3], XtNminHeight, base_height + - cell_height * w->emacs_shell.min_height_cells); + Xt_SET_ARG(al [0], XtNbaseWidth, base_width); + Xt_SET_ARG(al [1], XtNbaseHeight, base_height); + Xt_SET_ARG(al [2], XtNminWidth, base_width + + cell_width * w->emacs_shell.min_width_cells); + Xt_SET_ARG(al [3], XtNminHeight, base_height + + cell_height * w->emacs_shell.min_height_cells); XtSetValues ((Widget) w, al, 4); }
--- a/src/console-x.h Wed Oct 29 04:02:05 2008 +0900 +++ b/src/console-x.h Wed Oct 29 04:06:33 2008 +0900 @@ -66,18 +66,6 @@ # define XPointer char * #endif -#define Xt_SET_VALUE(widget, resource, value) do { \ - Arg al; \ - XtSetArg (al, resource, value); \ - XtSetValues (widget, &al, 1); \ -} while (0) - -#define Xt_GET_VALUE(widget, resource, location) do { \ - Arg al; \ - XtSetArg (al, resource, location); \ - XtGetValues (widget, &al, 1); \ -} while (0) - #ifdef __cplusplus #define X_CLASSFIELD c_class #else @@ -212,7 +200,7 @@ void describe_XIMStyles (XIMStyles *styles); void describe_XIC (XIC ic); void describe_event_mask (unsigned long mask); -void describe_XRectangle (char *name, XRectangle *rect); +void describe_XRectangle (const char *name, XRectangle *rect); void describe_Status (Status status); #endif /* DEBUG_XEMACS */ #endif /* XIM_XLIB */
--- a/src/device-x.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/device-x.c Wed Oct 29 04:06:33 2008 +0900 @@ -79,29 +79,33 @@ Lisp_Object Vx_initial_argv_list; /* #### ugh! */ +/* Shut up G++ 4.3. */ +#define Xrm_ODR(option,resource,type,default) \ + { (String) option, (String) resource, type, default } + static XrmOptionDescRec emacs_options[] = { - {"-geometry", ".geometry", XrmoptionSepArg, NULL}, - {"-iconic", ".iconic", XrmoptionNoArg, "yes"}, + Xrm_ODR ("-geometry", ".geometry", XrmoptionSepArg, NULL), + Xrm_ODR ("-iconic", ".iconic", XrmoptionNoArg, (String) "yes"), - {"-internal-border-width", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL}, - {"-ib", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL}, - {"-scrollbar-width", "*EmacsFrame.scrollBarWidth", XrmoptionSepArg, NULL}, - {"-scrollbar-height", "*EmacsFrame.scrollBarHeight", XrmoptionSepArg, NULL}, + Xrm_ODR ("-internal-border-width", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL), + Xrm_ODR ("-ib", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL), + Xrm_ODR ("-scrollbar-width", "*EmacsFrame.scrollBarWidth", XrmoptionSepArg, NULL), + Xrm_ODR ("-scrollbar-height", "*EmacsFrame.scrollBarHeight", XrmoptionSepArg, NULL), - {"-privatecolormap", ".privateColormap", XrmoptionNoArg, "yes"}, - {"-visual", ".EmacsVisual", XrmoptionSepArg, NULL}, + Xrm_ODR ("-privatecolormap", ".privateColormap", XrmoptionNoArg, (String) "yes"), + Xrm_ODR ("-visual", ".EmacsVisual", XrmoptionSepArg, NULL), /* #### Beware! If the type of the shell changes, update this. */ - {"-T", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, - {"-wn", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, - {"-title", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, + Xrm_ODR ("-T", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL), + Xrm_ODR ("-wn", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL), + Xrm_ODR ("-title", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL), - {"-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL}, - {"-in", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL}, - {"-mc", "*pointerColor", XrmoptionSepArg, NULL}, - {"-cr", "*cursorColor", XrmoptionSepArg, NULL}, - {"-fontset", "*FontSet", XrmoptionSepArg, NULL}, + Xrm_ODR ("-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL), + Xrm_ODR ("-in", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL), + Xrm_ODR ("-mc", "*pointerColor", XrmoptionSepArg, NULL), + Xrm_ODR ("-cr", "*cursorColor", XrmoptionSepArg, NULL), + Xrm_ODR ("-fontset", "*FontSet", XrmoptionSepArg, NULL), }; static const struct memory_description x_device_data_description_1 [] = { @@ -329,7 +333,7 @@ if (argc > 0 && argv[0] && *argv[0]) return (ptr = strrchr (argv[0], '/')) ? ++ptr : argv[0]; - return "xemacs"; + return (Extbyte *) "xemacs"; /* shut up g++ 4.3 */ } /* @@ -343,7 +347,7 @@ static int have_xemacs_resources_in_xrdb (Display *dpy) { - char *xdefs, *key; + const char *xdefs, *key; int len; #ifdef INFODOCK @@ -688,9 +692,9 @@ does not override resources defined elsewhere */ const Extbyte *data_dir; Extbyte *path; - Extbyte *format; + const Extbyte *format; XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */ - Extbyte *locale = xstrdup (XrmLocaleOfDatabase (db)); + const Extbyte *locale = xstrdup (XrmLocaleOfDatabase (db)); Extbyte *locale_end; if (STRINGP (Vx_app_defaults_directory) && @@ -739,7 +743,11 @@ } no_data_directory: - xfree (locale, Extbyte*); + { + /* Cast off const for G++ 4.3. */ + Extbyte *temp = (Extbyte *) locale; + xfree (temp, Extbyte*); + } } #endif /* MULE */ @@ -861,9 +869,9 @@ be the place. Make sure it doesn't conflict with GNOME. */ { Arg al[3]; - XtSetArg (al[0], XtNvisual, visual); - XtSetArg (al[1], XtNdepth, depth); - XtSetArg (al[2], XtNcolormap, cmap); + Xt_SET_ARG (al[0], XtNvisual, visual); + Xt_SET_ARG (al[1], XtNdepth, depth); + Xt_SET_ARG (al[2], XtNcolormap, cmap); app_shell = XtAppCreateShell (NULL, app_class, applicationShellWidgetClass, @@ -880,11 +888,13 @@ and set it to the size of the root window for child placement purposes */ { Arg al[5]; - XtSetArg (al[0], XtNmappedWhenManaged, False); - XtSetArg (al[1], XtNx, 0); - XtSetArg (al[2], XtNy, 0); - XtSetArg (al[3], XtNwidth, WidthOfScreen (ScreenOfDisplay (dpy, screen))); - XtSetArg (al[4], XtNheight, HeightOfScreen (ScreenOfDisplay (dpy, screen))); + Xt_SET_ARG (al[0], XtNmappedWhenManaged, False); + Xt_SET_ARG (al[1], XtNx, 0); + Xt_SET_ARG (al[2], XtNy, 0); + Xt_SET_ARG (al[3], XtNwidth, + WidthOfScreen (ScreenOfDisplay (dpy, screen))); + Xt_SET_ARG (al[4], XtNheight, + HeightOfScreen (ScreenOfDisplay (dpy, screen))); XtSetValues (app_shell, al, countof (al)); XtRealizeWidget (app_shell); }
--- a/src/emacs.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/emacs.c Wed Oct 29 04:06:33 2008 +0900 @@ -806,7 +806,7 @@ enough information to do it right. */ static int -argmatch (Wexttext **argv, int argc, Ascbyte *sstr, Ascbyte *lstr, +argmatch (Wexttext **argv, int argc, const Ascbyte *sstr, const Ascbyte *lstr, int minlen, Wexttext **valptr, int *skipptr) { Wexttext *p = NULL; @@ -862,7 +862,7 @@ } static void -check_compatible_window_system (Ascbyte *must) +check_compatible_window_system (const Ascbyte *must) { if (display_use && strcmp (display_use, must)) fatal ("Incompatible window system type `%s': `%s' already specified",
--- a/src/emodules.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/emodules.c Wed Oct 29 04:06:33 2008 +0900 @@ -96,7 +96,7 @@ */ (file, name, version)) { - CIbyte *mod, *mname, *mver; + const CIbyte *mod, *mname, *mver; int speccount = specpdl_depth(); CHECK_STRING(file); @@ -136,7 +136,7 @@ (file, name, version)) { int x; - CIbyte *mod, *mname, *mver; + const CIbyte *mod, *mname, *mver; Lisp_Object foundname = Qnil; struct gcpro gcpro1;
--- a/src/event-Xt.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/event-Xt.c Wed Oct 29 04:06:33 2008 +0900 @@ -109,7 +109,9 @@ extern SELECT_TYPE input_wait_mask, non_fake_input_wait_mask; extern SELECT_TYPE process_only_mask, tty_only_mask; -static const String x_fallback_resources[] = +/* #### This should be String, but G++ 4.3 doesn't apply the const + specifier the same way for String (typedef'd to char*) and char*. */ +static const char * x_fallback_resources[] = { /* This file is automatically generated from the app-defaults file in ../etc/Emacs.ad. These resources are consulted only if no @@ -3126,8 +3128,8 @@ static XtActionsRec widgetActionsList[] = { - {"widget-focus-in", emacs_Xt_event_widget_focus_in }, - {"widget-focus-out", emacs_Xt_event_widget_focus_out }, + { (String) "widget-focus-in", emacs_Xt_event_widget_focus_in }, + { (String) "widget-focus-out", emacs_Xt_event_widget_focus_out }, }; static void
--- a/src/event-stream.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/event-stream.c Wed Oct 29 04:06:33 2008 +0900 @@ -255,7 +255,7 @@ Fixnum debug_emacs_events; static void -external_debugging_print_event (char *event_description, Lisp_Object event) +external_debugging_print_event (const char *event_description, Lisp_Object event) { write_c_string (Qexternal_debugging_output, "("); write_c_string (Qexternal_debugging_output, event_description);
--- a/src/file-coding.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/file-coding.c Wed Oct 29 04:06:33 2008 +0900 @@ -897,8 +897,8 @@ struct subsidiary_type { - Ascbyte *extension; - Ascbyte *mnemonic_ext; + const Ascbyte *extension; + const Ascbyte *mnemonic_ext; enum eol_type eol; }; @@ -944,8 +944,8 @@ for (i = 0; i < countof (coding_subsidiary_list); i++) { - Ascbyte *extension = coding_subsidiary_list[i].extension; - Ascbyte *mnemonic_ext = coding_subsidiary_list[i].mnemonic_ext; + const Ascbyte *extension = coding_subsidiary_list[i].extension; + const Ascbyte *mnemonic_ext = coding_subsidiary_list[i].mnemonic_ext; enum eol_type eol = coding_subsidiary_list[i].eol; qxestrcpy_ascii (codesys_name + len, extension); @@ -1021,7 +1021,7 @@ */ static Lisp_Object -make_coding_system_1 (Lisp_Object name_or_existing, Ascbyte *prefix, +make_coding_system_1 (Lisp_Object name_or_existing, const Ascbyte *prefix, Lisp_Object type, Lisp_Object description, Lisp_Object props) { @@ -1192,7 +1192,7 @@ } Lisp_Object -make_internal_coding_system (Lisp_Object existing, Ascbyte *prefix, +make_internal_coding_system (Lisp_Object existing, const Ascbyte *prefix, Lisp_Object type, Lisp_Object description, Lisp_Object props) {
--- a/src/file-coding.h Wed Oct 29 04:02:05 2008 +0900 +++ b/src/file-coding.h Wed Oct 29 04:06:33 2008 +0900 @@ -1046,7 +1046,7 @@ Ichar decode_big5_char (int o1, int o2); void add_entry_to_coding_system_type_list (struct coding_system_methods *m); Lisp_Object make_internal_coding_system (Lisp_Object existing, - Ascbyte *prefix, + const Ascbyte *prefix, Lisp_Object type, Lisp_Object description, Lisp_Object props);
--- a/src/frame-x.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/frame-x.c Wed Oct 29 04:06:33 2008 +0900 @@ -280,8 +280,8 @@ if (cw <= 0 || ch <= 0) ABORT (); - XtSetArg (al[0], XtNwidthInc, cw); - XtSetArg (al[1], XtNheightInc, ch); + Xt_SET_ARG (al[0], XtNwidthInc, cw); + Xt_SET_ARG (al[1], XtNheightInc, ch); XtSetValues (wmshell, al, 2); } @@ -298,8 +298,8 @@ fflush (stdout); #endif - XtSetArg (al[0], XtNwidthCells, width); - XtSetArg (al[1], XtNheightCells, height); + Xt_SET_ARG (al[0], XtNwidthCells, width); + Xt_SET_ARG (al[1], XtNheightCells, height); XtSetValues (wmshell, al, 2); } @@ -668,8 +668,8 @@ if (!old_XtValue || strcmp (new_XtValue, old_XtValue)) { Arg al[2]; - XtSetArg (al[0], Xt_resource_name, new_XtValue); - XtSetArg (al[1], Xt_resource_encoding_name, encoding); + Xt_SET_ARG (al[0], Xt_resource_name, new_XtValue); + Xt_SET_ARG (al[1], Xt_resource_encoding_name, encoding); XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); } } @@ -1539,8 +1539,8 @@ if (! (frame_flags & (WidthValue | HeightValue))) { Arg al[2]; - XtSetArg (al [0], XtNwidth, &frame_w); - XtSetArg (al [1], XtNheight, &frame_h); + Xt_SET_ARG (al [0], XtNwidth, &frame_w); + Xt_SET_ARG (al [1], XtNheight, &frame_h); XtGetValues (ew, al, 2); if (!frame_w && !frame_h) { @@ -1554,8 +1554,8 @@ if (frame_flags & (XValue | YValue)) { Arg al[2]; - XtSetArg (al [0], XtNwidth, &frame_w); - XtSetArg (al [1], XtNheight, &frame_h); + Xt_SET_ARG (al [0], XtNwidth, &frame_w); + Xt_SET_ARG (al [1], XtNheight, &frame_h); XtGetValues (ew, al, 2); if (frame_flags & XNegative) @@ -1563,8 +1563,8 @@ if (frame_flags & YNegative) frame_y += frame_h; - XtSetArg (al [0], XtNx, frame_x); - XtSetArg (al [1], XtNy, frame_y); + Xt_SET_ARG (al [0], XtNx, frame_x); + Xt_SET_ARG (al [1], XtNy, frame_y); XtSetValues (ew, al, 2); } return; @@ -1869,40 +1869,40 @@ FRAME_X_TOP_LEVEL_FRAME_P (f) = 1; ac = 0; - XtSetArg (al[ac], XtNallowShellResize, True); ac++; + Xt_SET_ARG (al[ac], XtNallowShellResize, True); ac++; #ifdef LWLIB_USES_MOTIF /* Motif sucks beans. Without this in here, it will delete the window out from under us when it receives a WM_DESTROY_WINDOW message from the WM. */ - XtSetArg (al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++; + Xt_SET_ARG (al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++; #endif #ifdef EXTERNAL_WIDGET if (window_id) { - XtSetArg (al[ac], XtNwindow, window_id); ac++; + Xt_SET_ARG (al[ac], XtNwindow, window_id); ac++; } else #endif /* EXTERNAL_WIDGET */ { - XtSetArg (al[ac], XtNinput, True); ac++; - XtSetArg (al[ac], XtNminWidthCells, 10); ac++; - XtSetArg (al[ac], XtNminHeightCells, 1); ac++; - XtSetArg (al[ac], XtNvisual, visual); ac++; - XtSetArg (al[ac], XtNdepth, depth); ac++; - XtSetArg (al[ac], XtNcolormap, cmap); ac++; + Xt_SET_ARG (al[ac], XtNinput, True); ac++; + Xt_SET_ARG (al[ac], XtNminWidthCells, 10); ac++; + Xt_SET_ARG (al[ac], XtNminHeightCells, 1); ac++; + Xt_SET_ARG (al[ac], XtNvisual, visual); ac++; + Xt_SET_ARG (al[ac], XtNdepth, depth); ac++; + Xt_SET_ARG (al[ac], XtNcolormap, cmap); ac++; } if (!NILP (overridep)) { - XtSetArg (al[ac], XtNoverrideRedirect, True); ac++; + Xt_SET_ARG (al[ac], XtNoverrideRedirect, True); ac++; } /* #### maybe we should check for FRAMEP instead? */ if (!NILP (parent)) { parentwid = FRAME_X_SHELL_WIDGET (XFRAME (parent)); - XtSetArg (al[ac], XtNtransientFor, parentwid); ac++; + Xt_SET_ARG (al[ac], XtNtransientFor, parentwid); ac++; } shell = XtCreatePopupShell ("shell", @@ -1921,9 +1921,9 @@ /* Create the manager widget */ ac = 0; - XtSetArg (al[ac], XtNvisual, visual); ac++; - XtSetArg (al[ac], XtNdepth, depth); ac++; - XtSetArg (al[ac], XtNcolormap, cmap); ac++; + Xt_SET_ARG (al[ac], XtNvisual, visual); ac++; + Xt_SET_ARG (al[ac], XtNdepth, depth); ac++; + Xt_SET_ARG (al[ac], XtNcolormap, cmap); ac++; container = XtCreateWidget ("container", emacsManagerWidgetClass, shell, al, ac); @@ -1935,11 +1935,11 @@ /* Create the text area */ ac = 0; - XtSetArg (al[ac], XtNvisual, visual); ac++; - XtSetArg (al[ac], XtNdepth, depth); ac++; - XtSetArg (al[ac], XtNcolormap, cmap); ac++; - XtSetArg (al[ac], XtNborderWidth, 0); ac++; /* should this be settable? */ - XtSetArg (al[ac], XtNemacsFrame, f); ac++; + Xt_SET_ARG (al[ac], XtNvisual, visual); ac++; + Xt_SET_ARG (al[ac], XtNdepth, depth); ac++; + Xt_SET_ARG (al[ac], XtNcolormap, cmap); ac++; + Xt_SET_ARG (al[ac], XtNborderWidth, 0); ac++; /* should this be settable? */ + Xt_SET_ARG (al[ac], XtNemacsFrame, f); ac++; text = XtCreateWidget (name, emacsFrameClass, container, al, ac); FRAME_X_TEXT_WIDGET (f) = text; @@ -2198,8 +2198,8 @@ /* Store the X data into the widget. */ { Arg al[2]; - XtSetArg (al[0], XtNiconPixmap, x_pixmap); - XtSetArg (al[1], XtNiconMask, x_mask); + Xt_SET_ARG (al[0], XtNiconPixmap, x_pixmap); + Xt_SET_ARG (al[1], XtNiconMask, x_mask); XtSetValues (FRAME_X_SHELL_WIDGET (f), al, 2); } } @@ -2264,9 +2264,9 @@ int win_gravity; Arg al[3]; - XtSetArg (al[0], XtNwidth, &shell_w); - XtSetArg (al[1], XtNheight, &shell_h); - XtSetArg (al[2], XtNborderWidth, &shell_bord); + Xt_SET_ARG (al[0], XtNwidth, &shell_w); + Xt_SET_ARG (al[1], XtNheight, &shell_h); + Xt_SET_ARG (al[2], XtNborderWidth, &shell_bord); XtGetValues (w, al, 3); win_gravity = @@ -2283,9 +2283,9 @@ come back at the right place. We can't look at s->visible to determine whether it is iconified because it might not be up-to-date yet (the queue might not be processed). */ - XtSetArg (al[0], XtNwinGravity, win_gravity); - XtSetArg (al[1], XtNx, xoff); - XtSetArg (al[2], XtNy, yoff); + Xt_SET_ARG (al[0], XtNwinGravity, win_gravity); + Xt_SET_ARG (al[1], XtNx, xoff); + Xt_SET_ARG (al[2], XtNy, yoff); XtSetValues (w, al, 3); /* Sometimes you will find that @@ -2709,7 +2709,7 @@ if (!EQ (color, Vthe_null_color_instance)) { fgc = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color)); - XtSetArg (al[ac], XtNforeground, (void *) fgc.pixel); ac++; + Xt_SET_ARG (al[ac], XtNforeground, (void *) fgc.pixel); ac++; } } else if (EQ (name, Qbackground)) @@ -2720,7 +2720,7 @@ if (!EQ (color, Vthe_null_color_instance)) { bgc = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color)); - XtSetArg (al[ac], XtNbackground, (void *) bgc.pixel); ac++; + Xt_SET_ARG (al[ac], XtNbackground, (void *) bgc.pixel); ac++; } /* Really crappy way to force the modeline shadows to be @@ -2754,15 +2754,15 @@ #ifdef USE_XFT else if (FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))) { - XtSetArg (al[ac], XtNxftFont, + Xt_SET_ARG (al[ac], XtNxftFont, (void *) FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))); ac++; } #endif else if (FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font))) { - XtSetArg (al[ac], XtNfont, - (void *) FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font))); + Xt_SET_ARG (al[ac], XtNfont, + (void *) FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font))); ac++; } }
--- a/src/gif_io.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/gif_io.c Wed Oct 29 04:06:33 2008 +0900 @@ -140,7 +140,7 @@ return ((*(GifIO->CloseFunc))(GifIO->CloseFunc_data)); } -static char *GifErrorString[14] = { +static const char *GifErrorString[14] = { "Failed to open given file", /* D_GIF_ERR_OPEN_FAILED */ "Failed to read from given file", /* D_GIF_ERR_READ_FAILED */ "Given file is NOT a GIF file", /* D_GIF_ERR_NOT_GIF_FILE */ @@ -164,7 +164,7 @@ *****************************************************************************/ const char *GetGifError(int errore) { - char *Err; + const char *Err; switch(errore) { case D_GIF_ERR_OPEN_FAILED:
--- a/src/glyphs-x.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/glyphs-x.c Wed Oct 29 04:06:33 2008 +0900 @@ -2234,8 +2234,8 @@ if (XFRAME (IMAGE_INSTANCE_FRAME (p))->size_changed) { Arg al[2]; - XtSetArg (al [0], XtNx, &IMAGE_INSTANCE_X_WIDGET_XOFFSET (p)); - XtSetArg (al [1], XtNy, &IMAGE_INSTANCE_X_WIDGET_YOFFSET (p)); + Xt_SET_ARG (al [0], XtNx, &IMAGE_INSTANCE_X_WIDGET_XOFFSET (p)); + Xt_SET_ARG (al [1], XtNy, &IMAGE_INSTANCE_X_WIDGET_YOFFSET (p)); XtGetValues (FRAME_X_TEXT_WIDGET (XFRAME (IMAGE_INSTANCE_FRAME (p))), al, 2); } @@ -2424,7 +2424,7 @@ (IMAGE_INSTANCE_WIDGET_FACE (ii), domain); XColor fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (pixel)); - lw_add_widget_value_arg (val, XtNtabForeground, fcolor.pixel); + lw_add_widget_value_arg (val, (String) XtNtabForeground, fcolor.pixel); wv->change = VISIBLE_CHANGE; val->change = VISIBLE_CHANGE; @@ -2539,8 +2539,8 @@ offset the redisplay of the widget by the amount the text widget is inside the manager. */ ac = 0; - XtSetArg (al [ac], XtNx, &IMAGE_INSTANCE_X_WIDGET_XOFFSET (ii)); ac++; - XtSetArg (al [ac], XtNy, &IMAGE_INSTANCE_X_WIDGET_YOFFSET (ii)); ac++; + Xt_SET_ARG (al [ac], XtNx, &IMAGE_INSTANCE_X_WIDGET_XOFFSET (ii)); ac++; + Xt_SET_ARG (al [ac], XtNy, &IMAGE_INSTANCE_X_WIDGET_YOFFSET (ii)); ac++; XtGetValues (FRAME_X_TEXT_WIDGET (f), al, ac); XtSetMappedWhenManaged (wid, TRUE); @@ -2608,11 +2608,11 @@ Arg al [2]; int ac =0; #ifdef LWLIB_WIDGETS_MOTIF - XtSetArg (al [ac], XmNlabelType, XmPIXMAP); ac++; - XtSetArg (al [ac], XmNlabelPixmap, XIMAGE_INSTANCE_X_PIXMAP (glyph)); + Xt_SET_ARG (al [ac], XmNlabelType, XmPIXMAP); ac++; + Xt_SET_ARG (al [ac], XmNlabelPixmap, XIMAGE_INSTANCE_X_PIXMAP (glyph)); ac++; #else - XtSetArg (al [ac], XtNpixmap, XIMAGE_INSTANCE_X_PIXMAP (glyph)); ac++; + Xt_SET_ARG (al [ac], XtNpixmap, XIMAGE_INSTANCE_X_PIXMAP (glyph)); ac++; #endif XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, ac); } @@ -2683,11 +2683,9 @@ if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) { - Arg al [1]; Lisp_Object val; val = XGUI_ITEM (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p))->value; - XtSetArg (al[0], XtNvalue, XINT (val)); - XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (p), al, 1); + Xt_SET_VALUE (IMAGE_INSTANCE_X_WIDGET_ID (p), XtNvalue, XINT (val)); } } @@ -2773,7 +2771,6 @@ Lisp_Object old_selected = gui_item_list_find_selected (XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii))); - Arg al [1]; char* name; unsigned int num_children, i; Widget* children; @@ -2789,8 +2786,8 @@ { if (!strcmp (XtName (children [i]), name)) { - XtSetArg (al [0], XtNtopWidget, children [i]); - XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, 1); + Xt_SET_VALUE (IMAGE_INSTANCE_X_WIDGET_ID (ii), + XtNtopWidget, children [i]); break; } }
--- a/src/input-method-xlib.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/input-method-xlib.c Wed Oct 29 04:06:33 2008 +0900 @@ -286,19 +286,19 @@ xic_vars_t xic_vars; XIC xic; -#define res(name, class_, representation, field, default_value) \ - { name, class_, representation, sizeof(xic_vars.field), \ - XtOffsetOf(xic_vars_t, field), XtRString, default_value } +#define res(name, class_, representation, field, default_value) \ + Xt_RESOURCE (name, class_, representation, xic_vars.field, \ + XtOffsetOf(xic_vars_t, field), XtRString, default_value) static XtResource resources[] = { /* name class represent'n field default value */ - res(XtNximStyles, XtCXimStyles, XtRXimStyles, styles, (XtPointer) DefaultXIMStyles), - res(XtNfontSet, XtCFontSet, XtRFontSet, fontset, (XtPointer) XtDefaultFontSet), - res(XtNximForeground, XtCForeground, XtRPixel, fg, (XtPointer) XtDefaultForeground), - res(XtNximBackground, XtCBackground, XtRPixel, bg, (XtPointer) XtDefaultBackground) + res(XtNximStyles, XtCXimStyles, XtRXimStyles, styles, DefaultXIMStyles), + res(XtNfontSet, XtCFontSet, XtRFontSet, fontset, XtDefaultFontSet), + res(XtNximForeground, XtCForeground, XtRPixel, fg, XtDefaultForeground), + res(XtNximBackground, XtCBackground, XtRPixel, bg, XtDefaultBackground) }; - +#undef res xim = DEVICE_X_XIM (d); @@ -977,7 +977,7 @@ } void -describe_XRectangle (char *name, XRectangle *r) +describe_XRectangle (const char *name, XRectangle *r) { if (r == NULL) stderr_out ("%s: NULL\n", name);
--- a/src/menubar-x.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/menubar-x.c Wed Oct 29 04:06:33 2008 +0900 @@ -690,13 +690,13 @@ { Widget shell = XtParent (daddy); - XtSetArg (al [0], XtNx, &shellx); - XtSetArg (al [1], XtNy, &shelly); + Xt_SET_ARG (al [0], XtNx, &shellx); + Xt_SET_ARG (al [1], XtNy, &shelly); XtGetValues (shell, al, 2); } #endif - XtSetArg (al [0], XtNx, &framex); - XtSetArg (al [1], XtNy, &framey); + Xt_SET_ARG (al [0], XtNx, &framex); + Xt_SET_ARG (al [1], XtNy, &framey); XtGetValues (daddy, al, 2); btn->x_root = shellx + framex + btn->x; btn->y_root = shelly + framey + btn->y;
--- a/src/mule-coding.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/mule-coding.c Wed Oct 29 04:06:33 2008 +0900 @@ -3339,7 +3339,7 @@ { Lisp_Object sym; struct ccl_program test_ccl; - Ascbyte *suffix; + const Ascbyte *suffix; /* Check key first. */ if (EQ (key, Qdecode))
--- a/src/print.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/print.c Wed Oct 29 04:06:33 2008 +0900 @@ -1527,7 +1527,7 @@ static void printing_major_badness (Lisp_Object printcharfun, - Ascbyte *badness_string, int type, void *val, + const Ascbyte *badness_string, int type, void *val, enum printing_badness badness) { Ibyte buf[666];
--- a/src/redisplay.c Wed Oct 29 04:02:05 2008 +0900 +++ b/src/redisplay.c Wed Oct 29 04:06:33 2008 +0900 @@ -4447,7 +4447,7 @@ { invalid: { - char *str = GETTEXT ("*invalid*"); + const char *str = GETTEXT ("*invalid*"); Charcount size = (Charcount) strlen (str); /* is this ok ?? -- dv */ if (size <= *offset)