]> uap-core.de Git - uwplayer.git/commitdiff
use toolkit functions to init the app default
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 28 Oct 2025 20:12:36 +0000 (21:12 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 28 Oct 2025 20:12:36 +0000 (21:12 +0100)
application/Makefile
application/main.c
ui/motif/toolkit.c
ui/motif/toolkit.h

index f0ea68ad0379c5230abe88548c466452e20914be..011717cb6dc892863423722db52e725da408597d 100644 (file)
@@ -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
index 1205d4dc8b128f22412d2c7a38e49d997775860e..163e557fa1b720aa464db40a843c28f4560393ba 100644 (file)
@@ -37,6 +37,8 @@
 #include <cx/buffer.h>
 #include <cx/array_list.h>
 
+#include <ui/ui.h>
+
 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;
 }
index c2a1f2abd4506062cd604e72502c9205b73d2e17..1b432c6b5fff64bb51f72a534370175444f114eb 100644 (file)
@@ -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;
 }
index a2397e81a2d4f3fdd0f748238611870bc479dc20..5f3d4405f44069ea674bdc51901b8cf42cd55328 100644 (file)
@@ -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);