NULL);
// load settings
- if(load_settings()) {
+ if(load_config()) {
return 1;
}
-
+
MainWindow *window = WindowCreate(display);
toplevel_window = window->window;
- // random numbers only used for creating tmp dirs
+ // random numbers used for creating tmp dirs and for random playback
srand(time(NULL));
WindowShow(window);
- XtAppMainLoop(app);
+ AppMainLoop(app);
return 0;
}
void CleanOpenFileArg(void) {
open_file_arg = NULL;
}
+
+static Window app_player_window = 0;
+
+void SetPlayerWindow(Window w) {
+ app_player_window = w;
+}
+
+/*
+ * Extended Xt main loop, that also handles external window events
+ */
+void AppMainLoop(XtAppContext app) {
+ while(!XtAppGetExitFlag(app)) {
+ XEvent event;
+ XtAppNextEvent(app, &event);
+
+ if(app_player_window != 0 && event.xany.window == app_player_window) {
+ WindowHandlePlayerEvent(GetMainWindow(), &event);
+ } else {
+ XtDispatchEvent(&event);
+ }
+ }
+}