diff --git a/src/motif_test.c b/src/motif_test.c index a93fd67..4236433 100644 --- a/src/motif_test.c +++ b/src/motif_test.c @@ -199,6 +199,19 @@ int main(int argc, char *argv[]) { XmMainWindowSetAreas(mainwin, menubar, NULL, NULL, NULL, form); XtRealizeWidget(toplevel); - XtAppMainLoop(app); + + /* 自定义事件循环 */ + XEvent event; + while (1) { + if (XtAppPending(app)) { + XtAppNextEvent(app, &event); + XtDispatchEvent(&event); + } else { + /* 空闲时可以执行后台逻辑 */ + printf("Idle...\n"); + usleep(500000); /* 0.5秒 */ + } + } + return 0; }