-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (51 loc) · 1.59 KB
/
Copy pathmain.cpp
File metadata and controls
57 lines (51 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "Polyweb/polyweb.hpp"
#include "icons/icon.h"
#include "theme.hpp"
#include "ui.hpp"
#include <FL/Fl.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_Window.H>
#include <cstdlib>
#include <gst/gst.h>
#include <rtc/rtc.hpp>
#ifdef _WIN32
#include <FL/x.H>
#include <ios>
#include <stdint.h>
#include <stdio.h>
#include <windows.h>
#endif
using nlohmann::json;
int main(int argc, char* argv[]) {
#ifdef _WIN32
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
FILE* fp;
freopen_s(&fp, "CONOUT$", "w", stdout);
freopen_s(&fp, "CONOUT$", "w", stderr);
freopen_s(&fp, "CONIN$", "r", stdin);
std::ios::sync_with_stdio();
}
#endif
Fl::lock();
Fl::visual(FL_DOUBLE | FL_INDEX);
configure_fltk_colors();
rtc::InitLogger(rtc::LogLevel::Debug);
(void)pn::init();
pw::thread_pool.resize(0); // The threadpool is only used by Polyweb in server applications
gst_init(&argc, &argv);
Fl_PNG_Image icon(nullptr, icons_icon_png, icons_icon_png_len);
Fl_Window::default_icon(&icon);
Fl_Window::default_xclass("lux-desktop");
MainWindow window;
window.show();
#ifdef _WIN32
Fl::flush();
set_window_dark_mode(fl_xid(&window));
#endif
int status = Fl::run();
// Everything that needs an orderly shutdown was torn down by MainWindow::hide().
// A detached login thread may still be inside a fetch, though, and running the
// static destructors underneath it (Polyweb's shared TLS context, the thread
// pool, GStreamer) would be a use-after-free, so leave the rest to the OS
std::_Exit(status);
}