From 0aabe419f68f18ac51ed162bc06f3079cd464fa3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 27 Oct 2018 16:39:11 +0200 Subject: Draw nodes behind login box --- include/Window.hpp | 8 ++++++++ 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 #include +#include #include #include #include @@ -19,8 +20,15 @@ namespace dchat private: bool drawBackground(const Cairo::RefPtr &cairo); private: + class OverlayDrawable : public Gtk::Overlay + { + public: + void draw(const Cairo::RefPtr &cairo) { Gtk::Overlay::draw(cairo); } + }; + std::unique_ptr 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::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; -- cgit v1.2.3