From: Olaf Wintermann Date: Tue, 28 Oct 2025 20:12:36 +0000 (+0100) Subject: use toolkit functions to init the app X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=bf99a84715e7723e1c6c057514849668826d0701;p=uwplayer.git use toolkit functions to init the app --- diff --git a/application/Makefile b/application/Makefile index f0ea68a..011717c 100644 --- a/application/Makefile +++ b/application/Makefile @@ -29,7 +29,7 @@ BUILD_ROOT = .. include $(BUILD_ROOT)/config.mk -CFLAGS += -I../ucx -I.. +CFLAGS += -I../ui/ -I../ucx -I.. SRC = main.c SRC += Fsb.c diff --git a/application/main.c b/application/main.c index 1205d4d..163e557 100644 --- a/application/main.c +++ b/application/main.c @@ -37,6 +37,8 @@ #include #include +#include + static XtAppContext app; static Display *display; static Widget toplevel_window; @@ -87,6 +89,9 @@ static void input_proc(XtPointer data, int *source, XtInputId *iid) { } } +XtAppContext ui_motif_get_app(void); +Display* ui_motif_get_display(void); + int main(int argc, char** argv) { // disable stdout buffering, because the netbeans's internal terminal // has a bug on freebsd and doesn't flush the output after a newline @@ -97,14 +102,18 @@ int main(int argc, char** argv) { perror("pipe"); return 2; } - + // initialize toolkit - XtToolkitInitialize(); - XtSetLanguageProc(NULL, langProc, NULL); - app = XtCreateApplicationContext(); - XtAppSetFallbackResources(app, fallback); + //XtToolkitInitialize(); + //XtSetLanguageProc(NULL, langProc, NULL); + ui_init("uwplayer", argc, argv); + //app = XtCreateApplicationContext(); + app = ui_motif_get_app(); + // TODO: add tooltip API for fallback resources + //XtAppSetFallbackResources(app, fallback); - display = XtOpenDisplay(app, NULL, APP_NAME, APP_CLASS, NULL, 0, &argc, argv); + //display = XtOpenDisplay(app, NULL, APP_NAME, APP_CLASS, NULL, 0, &argc, argv); + display = ui_motif_get_display(); PlaybackMode playback = PLAYBACK_STOP; bool fullscreen = FALSE; @@ -224,7 +233,13 @@ int main(int argc, char** argv) { } WindowShow(window); + +#ifndef UI_MOTIF + ui_main(); +#else AppMainLoop(app); +#endif + return 0; } diff --git a/ui/motif/toolkit.c b/ui/motif/toolkit.c index c2a1f2a..1b432c6 100644 --- a/ui/motif/toolkit.c +++ b/ui/motif/toolkit.c @@ -120,6 +120,10 @@ const char* ui_appname() { return application_name; } +XtAppContext ui_motif_get_app(void) { + return app; +} + Display* ui_motif_get_display() { return display; } diff --git a/ui/motif/toolkit.h b/ui/motif/toolkit.h index a2397e8..5f3d440 100644 --- a/ui/motif/toolkit.h +++ b/ui/motif/toolkit.h @@ -84,6 +84,7 @@ enum UiOrientation { UI_HORIZONTAL = 0, UI_VERTICAL }; void ui_exit_mainloop(); +XtAppContext ui_motif_get_app(void); Display* ui_motif_get_display(void); void ui_set_active_window(Widget w);