39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
|
#include "main.h"
|
||
|
#include "main_window.h"
|
||
|
#include <chrono>
|
||
|
using namespace std::chrono_literals;
|
||
|
bool quitting = false;
|
||
|
std::string HaikuUIBackend::get_id() {
|
||
|
return "haiku";
|
||
|
}
|
||
|
std::string HaikuUIBackend::get_name() {
|
||
|
return "Haiku Native";
|
||
|
}
|
||
|
void HaikuUIBackend::QuitHandler() {
|
||
|
LooperWindow *app = (LooperWindow*)main_loop;
|
||
|
app->Hide();
|
||
|
}
|
||
|
static bool about_window_shown = false;
|
||
|
static bool prefs_window_shown = false;
|
||
|
int HaikuUIBackend::run(std::vector<std::string> realArgs, int argc, char **argv) {
|
||
|
int ret = UIBackend::run(realArgs, argc, argv);
|
||
|
if (ret != 0) return ret;
|
||
|
LooperWindow *app = new LooperWindow(playback);
|
||
|
main_loop = (void*)app;
|
||
|
app->Show();
|
||
|
while (!app->IsHidden()) {
|
||
|
for (auto *subwindow : Subwindow::windows) {
|
||
|
if (subwindow->Showing.exchange(false)) {
|
||
|
subwindow->window->Show();
|
||
|
subwindow->ShownEver.store(true);
|
||
|
}
|
||
|
}
|
||
|
std::this_thread::sleep_for(100ms);
|
||
|
}
|
||
|
quitting = true;
|
||
|
for (auto *subwindow : Subwindow::windows) {
|
||
|
if (!subwindow->ShownEver) subwindow->window->Run();
|
||
|
}
|
||
|
return 0;
|
||
|
}
|