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>
Published at
2024-04-12 17:25:41Event JSON
{
"id": "2194f9f6c86709d40dcef91a1a8aa25e60b2b6594c12be21911bc8e0f42c6d2a",
"pubkey": "04f8915424c713657ad6ce59443d28dbdcf5832687c9af560ae388f59276a137",
"created_at": 1712942741,
"kind": 1,
"tags": [
[
"proxy",
"https://studio8502.ca/users/mos_8502/statuses/112259415494167760",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://studio8502.ca/users/mos_8502/statuses/112259415494167760",
"pink.momostr"
]
],
"content": "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.\n\nI mean, which would you rather deal with:\n\nOld style:\n\n```XtAppContext app; /* Application Context */\n Widget toplevel; /* Top Level Button */\n Widget drawing_area; /* Empty Drawing Area Widget */\n\n/* RESOURCE VALUE ARRAYS/COUNT */\n Arg al[10];\n int ac;\n\n/* INITIALIZE TOP LEVEL WINDOW */\n XtSetLanguageProc(NULL, NULL, NULL);\n toplevel = XtVaOpenApplication( \n \u0026app, argv[0], NULL, 0, \u0026argc, argv, NULL, sessionShellWidgetClass,\n XmNwidth, 400, XmNheight, 300, NULL\n );\n\n/* CREATE AND MANAGE DRAWING CANVAS WIDGET */\n ac=0; \n drawing_area = XmCreateDrawingArea(toplevel, \"name\", al, ac);\n\n XtManageChild(drawing_area);\n\n/* REALIZE TOPLEVEL WINDOW AND LAUNCH APPLICATION LOOP */\n XtRealizeWidget(toplevel);\n XtAppMainLoop(app);\n\nreturn 0;\u003ccode\u003e\u003cbr\u003eHypothetical new style:\u003cbr\u003e\u003cbr\u003e\u003c/code\u003e\n\nMotifApplication app;\nToplevelWindow toplevel;\nDrawingArea drawing_area;\n\nmotif_init(argc, argv)\nmotif_app_init(app)\n\ntoplevel = motif_window_new(nullptr);\nmotif_widget_set_width(toplevel, 400);\nmotif_widget_set_height(toplevel, 300);\n\ndrawing_area = motif_drawing_area_new(toplevel);\nmotif_widget_manage(drawing_area);\n\nmotif_widget_realize(toplevel);\nmotif_main(app);\n\nreturn 0;\u003ccode\u003e\u003c/code\u003e",
"sig": "810cf60a52cb6cd13ebf19c76177631a463a0a0af3aee94cddef6778938218fa43a838c784c1739f7a7a5e6a06939d52503fbf70c80fa860487c70b6ef262117"
}