#pragma once #include "ChatWindow.hpp" #include "LoginWindow.hpp" #include "WindowNotification.hpp" #include #include #include #include #include #include #include #include #include namespace dchat { class Window : public Gtk::Window { public: Window(); virtual ~Window(); void refresh(); std::shared_ptr rooms; WindowNotification *windowNotification; private: using DispatcherHandler = std::function; bool drawBackground(const Cairo::RefPtr &cairo); void dispatchFunction(DispatcherHandler func); private: class OverlayDrawable : public Gtk::Overlay { public: void draw(const Cairo::RefPtr &cairo) { Gtk::Overlay::draw(cairo); } }; std::thread::id mainThreadId; std::mutex databaseCallbackMutex; OverlayDrawable overlay; Gtk::Stack stack; LoginWindow loginWindow; ChatWindow chatWindow; struct Node { double radius; double originalPosX; double originalPosY; double currentPosX; double currentPosY; double targetPosX; double targetPosY; }; std::mt19937 backgroundRng; std::vector backgroundNodes; int prevTimeMillis; sigc::connection drawBackgroundConnection; Glib::Dispatcher dispatcher; std::recursive_mutex dispatcherMutex; std::vector dispatcherHandlers; bool needUpdate; }; }