mos_8502 :verified: on Nostr: What I actually think the Motif toolkit needs to be more usable is just a simple ...
What I actually think the Motif toolkit needs to be more usable is just a simple library of wrapper functions and types to better organize and expose the programmer-facing API surface. The existing API is in a very… we'll say "classical" C style, as far as the names of things go, and it does some things that make a lot of sense when every CPU cycle counts, but which are a major pain to do *now* in 2024.
I mean, which would you rather deal with:
Old style:
```XtAppContext app; /* Application Context */
Widget toplevel; /* Top Level Button */
Widget drawing_area; /* Empty Drawing Area Widget */
/* RESOURCE VALUE ARRAYS/COUNT */
Arg al[10];
int ac;
/* INITIALIZE TOP LEVEL WINDOW */
XtSetLanguageProc(NULL, NULL, NULL);
toplevel = XtVaOpenApplication(
&app, argv[0], NULL, 0, &argc, argv, NULL, sessionShellWidgetClass,
XmNwidth, 400, XmNheight, 300, NULL
);
/* CREATE AND MANAGE DRAWING CANVAS WIDGET */
ac=0;
drawing_area = XmCreateDrawingArea(toplevel, "name", al, ac);
XtManageChild(drawing_area);
/* REALIZE TOPLEVEL WINDOW AND LAUNCH APPLICATION LOOP */
XtRealizeWidget(toplevel);
XtAppMainLoop(app);
return 0;<code><br>Hypothetical new style:<br><br></code>
MotifApplication app;
ToplevelWindow toplevel;
DrawingArea drawing_area;
motif_init(argc, argv)
motif_app_init(app)
toplevel = motif_window_new(nullptr);
motif_widget_set_width(toplevel, 400);
motif_widget_set_height(toplevel, 300);
drawing_area = motif_drawing_area_new(toplevel);
motif_widget_manage(drawing_area);
motif_widget_realize(toplevel);
motif_main(app);
return 0;<code></code>
I mean, which would you rather deal with:
Old style:
```XtAppContext app; /* Application Context */
Widget toplevel; /* Top Level Button */
Widget drawing_area; /* Empty Drawing Area Widget */
/* RESOURCE VALUE ARRAYS/COUNT */
Arg al[10];
int ac;
/* INITIALIZE TOP LEVEL WINDOW */
XtSetLanguageProc(NULL, NULL, NULL);
toplevel = XtVaOpenApplication(
&app, argv[0], NULL, 0, &argc, argv, NULL, sessionShellWidgetClass,
XmNwidth, 400, XmNheight, 300, NULL
);
/* CREATE AND MANAGE DRAWING CANVAS WIDGET */
ac=0;
drawing_area = XmCreateDrawingArea(toplevel, "name", al, ac);
XtManageChild(drawing_area);
/* REALIZE TOPLEVEL WINDOW AND LAUNCH APPLICATION LOOP */
XtRealizeWidget(toplevel);
XtAppMainLoop(app);
return 0;<code><br>Hypothetical new style:<br><br></code>
MotifApplication app;
ToplevelWindow toplevel;
DrawingArea drawing_area;
motif_init(argc, argv)
motif_app_init(app)
toplevel = motif_window_new(nullptr);
motif_widget_set_width(toplevel, 400);
motif_widget_set_height(toplevel, 300);
drawing_area = motif_drawing_area_new(toplevel);
motif_widget_manage(drawing_area);
motif_widget_realize(toplevel);
motif_main(app);
return 0;<code></code>