How to kill XtAppMainLoop (Motif)?

[亡魂溺海] 提交于 2019-12-11 06:33:29

问题


I want to use XmCreate{Error|Warning|Info}Dialog to display some message in screen in my SDL based application before its main window is open and any program data is available. I want the dialog to open, print the intended message, and when the user clicks on the OK button, the dialog plus the top widget I had to create for it should be closed/removed. Now afaik XtAppMainLoop will loop and process top widget messages (a window?) until the user closes it. I want to close it when the dialog returns though. How can I do that?


回答1:


After hours and hours of googling and reading I have found out that you can use XtAppSetExitFlag (XtAppContext).




回答2:


It's easy, in the XtAppContext that is returned from XtAppMainLoop, just do p->exit_flag = 1;.

It's also common for applications to simply include their own main loop and do whatever they want. All XtAppMainLoop does is call XtAppNextEvent(app, &event) and then XtDispatchEvent(&event).



来源:https://stackoverflow.com/questions/1386319/how-to-kill-xtappmainloop-motif

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!