diff options
-rw-r--r-- | include/Window.hpp | 8 | ||||
-rw-r--r-- | src/Window.cpp | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/include/Window.hpp b/include/Window.hpp index 236affa..4c67a68 100644 --- a/include/Window.hpp +++ b/include/Window.hpp @@ -4,6 +4,7 @@ #include "LoginWindow.hpp" #include <gtkmm/window.h> #include <gtkmm/stack.h> +#include <gtkmm/overlay.h> #include <odhtdb/Database.hpp> #include <mutex> #include <random> @@ -19,8 +20,15 @@ namespace dchat private: bool drawBackground(const Cairo::RefPtr<Cairo::Context> &cairo); private: + class OverlayDrawable : public Gtk::Overlay + { + public: + void draw(const Cairo::RefPtr<Cairo::Context> &cairo) { Gtk::Overlay::draw(cairo); } + }; + std::unique_ptr<odhtdb::Database> database; std::mutex databaseCallbackMutex; + OverlayDrawable overlay; Gtk::Stack stack; LoginWindow loginWindow; ChatWindow chatWindow; diff --git a/src/Window.cpp b/src/Window.cpp index 208c616..b1efc20 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -14,19 +14,18 @@ namespace dchat Window::Window() { set_border_width(0); - Gtk::Overlay *overlay = Gtk::manage(new Gtk::Overlay()); WindowNotification *windowNotification = Gtk::manage(new WindowNotification()); - overlay->add_overlay(*windowNotification); - overlay->set_overlay_pass_through(*windowNotification); - overlay->add(stack); - add(*overlay); + overlay.add_overlay(*windowNotification); + overlay.set_overlay_pass_through(*windowNotification); + overlay.add(stack); + add(overlay); stack.set_transition_type(Gtk::StackTransitionType::STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT); stack.set_transition_duration(250); stack.add(loginWindow, "login"); stack.add(chatWindow, "chat"); - overlay->show(); + overlay.show(); windowNotification->show_all(); stack.show(); chatWindow.show_all(); @@ -181,6 +180,7 @@ namespace dchat } prevTimeMillis = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - 5000; drawBackgroundConnection = signal_draw().connect(sigc::mem_fun(*this, &Window::drawBackground)); + set_size_request(640, 480); } Window::~Window() @@ -263,6 +263,7 @@ namespace dchat } } cairo->stroke(); + overlay.draw(cairo); queue_draw(); return true; |