looper/backends/ui/haiku/main.cpp
Zachary Hall 1756fb40a1
Some checks failed
Build / build-appimage (push) Successful in 3m21s
Build / build-android (push) Failing after 2m52s
Build / build-gentoo (push) Failing after 1m14s
Build / download-system-deps (push) Successful in 3m29s
Build / get-source-code (push) Successful in 7m1s
Build / build-windows (push) Failing after 6m40s
Fix Haiku backend build
2024-11-21 10:43:50 -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() {
HaikuLooperWindow *app = (HaikuLooperWindow*)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;
HaikuLooperWindow *app = new HaikuLooperWindow(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;
}