2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
|
|
|
XlibDisplay* pApplication::display = nullptr;
|
|
|
|
|
|
|
|
void pApplication::run() {
|
|
|
|
if(Application::main) {
|
|
|
|
while(applicationState.quit == false) {
|
|
|
|
processEvents();
|
|
|
|
Application::main();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
QApplication::exec();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool pApplication::pendingEvents() {
|
|
|
|
return QApplication::hasPendingEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pApplication::processEvents() {
|
|
|
|
while(pendingEvents()) QApplication::processEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pApplication::quit() {
|
|
|
|
QApplication::quit();
|
|
|
|
//note: QApplication cannot be deleted; or libQtGui will crash
|
|
|
|
qtApplication = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pApplication::syncX() {
|
|
|
|
for(unsigned n = 0; n < 8; n++) {
|
|
|
|
QApplication::syncX();
|
|
|
|
Application::processEvents();
|
|
|
|
usleep(2000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void pApplication::initialize() {
|
|
|
|
display = XOpenDisplay(0);
|
|
|
|
|
|
|
|
settings = new Settings;
|
|
|
|
settings->load();
|
|
|
|
|
|
|
|
static int argc = 1;
|
2013-05-02 11:25:45 +00:00
|
|
|
static char* argv[] = {new char[8], nullptr};
|
2013-03-15 13:11:33 +00:00
|
|
|
strcpy(argv[0], "phoenix");
|
2013-05-02 11:25:45 +00:00
|
|
|
char** argvp = argv;
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
qtApplication = new QApplication(argc, argvp);
|
|
|
|
|
|
|
|
pKeyboard::initialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|