sxirc

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit d2ba45f615344cc8725e8c34878a431eda858a1c
parent 1d4045a1532e5f66b2758417b925c646d943852b
Author: aabacchus <ben@bvnf.space>
Date:   Tue, 29 Nov 2022 15:12:36 +0000

cleanup

Diffstat:
MMakefile | 2+-
Ma.c | 19+++++++++----------
2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile @@ -2,7 +2,7 @@ BIN = sxtest LIBS = -lsx -lXt -CFLAGS = -Wall -Wextra -pedantic -Wno-unused-parameter -Og -g +CFLAGS = -Wall -Wextra -pedantic -Wno-unused-parameter -Og -g $(EXTRA_CFLAGS) $(BIN): a.c $(CC) a.c $(CFLAGS) -o $(BIN) $(LIBS) diff --git a/a.c b/a.c @@ -69,7 +69,8 @@ pollin_cb(XtPointer client_data, int *source, XtInputId *id) { } int -main(int argc, char **argv) { +setup_sx(int argc, char **argv) { + XtAppContext app; Widget w[4]; if (OpenDisplay(argc, argv) == 0) { @@ -78,7 +79,6 @@ main(int argc, char **argv) { } w[0] = MakeTextWidget("", 0, 0, 300, 200); - //w[1] = MakeTextWidget("", 0, 1, 300, 30); w[1] = MakeStringEntry(NULL, 200, string_cb, w[0]); struct textpair tp = {w[1], w[0]}; @@ -93,20 +93,19 @@ main(int argc, char **argv) { if (!w[0] || !w[1]) return 1; - XtAppContext app = XtWidgetToApplicationContext(w[0]); + app = XtWidgetToApplicationContext(w[0]); if (app == NULL) return 1; XtAppAddInput(app, /* stdin */ 0, XtInputReadMask, pollin_cb, w[0]); - Widget parent, oldparent; - oldparent = w[0]; - do { - parent = oldparent; - oldparent = XtParent(oldparent); - } while (oldparent != NULL && parent != oldparent); - fprintf(stderr, "widget %p is toplevel shell: %d\n", parent, XtIsTopLevelShell(parent)); + return 0; +} +int +main(int argc, char **argv) { + if (setup_sx(argc, argv) != 0) + return 1; ShowDisplay(); GetStandardColors(); MainLoop();