looper/backends/ui/haiku/main.cpp
Zachary Hall 8fdf30878b
Some checks failed
Build / build-gentoo (push) Successful in 1m22s
Build / download-system-deps (push) Successful in 1m37s
Build / get-source-code (push) Successful in 4m30s
Build / build-appimage (push) Successful in 1m15s
Build / build-android (push) Failing after 4m34s
Build / build-windows (push) Failing after 4m33s
Add Haiku frontend
2024-11-12 14:53:44 -08:00

38 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;
}