From: Eric S. Raymond Date: Wed, 13 Sep 2006 18:05:53 +0000 (+0000) Subject: Begin moving resource declarations into the fallback. X-Git-Tag: 2.0~282 X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=commitdiff_plain;h=6804507f66d59ffb74687439b09abdc2376f3a5d;ds=sidebyside Begin moving resource declarations into the fallback. --- diff --git a/src/xio.c b/src/xio.c index 63facea..0c5b225 100644 --- a/src/xio.c +++ b/src/xio.c @@ -9,7 +9,12 @@ XtAppContext app_context; Widget toplevel, form, buttons, quit, destruct, text; -void quit_proc (Widget w, XtPointer client_data, XtPointer call_data) +String fallback[] = { + "*destruct.fromHoriz: quit", + NULL, +}; + +static void quit_proc (Widget w, XtPointer client_data, XtPointer call_data) { XtDestroyApplicationContext (app_context); exit (0); @@ -18,21 +23,24 @@ void quit_proc (Widget w, XtPointer client_data, XtPointer call_data) int main (int argc, char **argv) { toplevel = XtVaOpenApplication (&app_context, "XThird", NULL, 0, &argc, - argv, NULL, applicationShellWidgetClass, + argv, fallback, + applicationShellWidgetClass, XtNallowShellResize, True, NULL); - form = XtVaCreateManagedWidget ("form", formWidgetClass, toplevel, NULL); - buttons = XtVaCreateManagedWidget ("form", formWidgetClass, form, NULL); + form = XtVaCreateManagedWidget ("form", formWidgetClass, toplevel, NULL); + /* The button panel */ + buttons = XtVaCreateManagedWidget ("form", formWidgetClass, form, NULL); quit = XtVaCreateManagedWidget("quit", commandWidgetClass, buttons, XtNlabel, "Quit", NULL); + XtAddCallback (quit, XtNcallback, quit_proc, NULL); destruct = XtVaCreateManagedWidget("destruct", commandWidgetClass, buttons, - XtNfromHoriz, quit, XtNlabel, "Destruct", NULL); + /* the command window */ text = XtVaCreateManagedWidget ("text", asciiTextWidgetClass, form, - XtNfromVert, buttons, XtNresize, - XawtextResizeBoth, XtNresizable, True, NULL); - XtAddCallback (quit, XtNcallback, quit_proc, NULL); + XtNfromVert, buttons, + XtNresize, XawtextResizeBoth, + XtNresizable, True, NULL); /* sample text so the widget will be identifiable */ XtVaSetValues (text, XtNtype, XawAsciiString, @@ -40,5 +48,7 @@ int main (int argc, char **argv) XtVaSetValues (text, XtNeditType, XawtextRead, XtNdisplayCaret, False, NULL); XtRealizeWidget (toplevel); XtAppMainLoop (app_context); + /* loop may be interrupted */ + XtDestroyApplicationContext (app_context); exit(0); }