aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-01-27 17:09:52 +0100
committerdec05eba <dec05eba@protonmail.com>2020-08-19 00:14:44 +0200
commitb143297961e93329d2c522194602e0850147e693 (patch)
tree20d3285886d125c80070ccead63dc4379594fb26
parent61c3ec1e6e8f26f6d1efc271794e791ecde8f1e2 (diff)
FUCK GTK GARBAGE DO NOT EVER USE AGAIN
-rw-r--r--README.md1
-rw-r--r--include/Window.hpp3
-rw-r--r--src/Window.cpp19
3 files changed, 22 insertions, 1 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4277aec
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+GTK IS GARBAGE. DO NOT USE IT!!!!!!!!!!!
diff --git a/include/Window.hpp b/include/Window.hpp
index b33605b..bff2e48 100644
--- a/include/Window.hpp
+++ b/include/Window.hpp
@@ -21,6 +21,8 @@ namespace dchat
Window();
virtual ~Window();
+ void refresh();
+
std::shared_ptr<Rooms> rooms;
WindowNotification *windowNotification;
private:
@@ -62,5 +64,6 @@ namespace dchat
Glib::Dispatcher dispatcher;
std::recursive_mutex dispatcherMutex;
std::vector<DispatcherHandler> dispatcherHandlers;
+ bool needUpdate;
};
}
diff --git a/src/Window.cpp b/src/Window.cpp
index 1344429..5991bb3 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -42,7 +42,8 @@ namespace dchat
}
Window::Window() :
- chatWindow(this)
+ chatWindow(this),
+ needUpdate(false)
{
set_border_width(0);
windowNotification = Gtk::manage(new WindowNotification());
@@ -239,6 +240,13 @@ namespace dchat
{
dispatcherHandler();
}
+
+ if(needUpdate)
+ {
+ needUpdate = false;
+ fprintf(stderr, "Redraw!\n");
+ queue_draw();
+ }
});
Rooms::connect(bootstrapNode->c_str(), 27130, roomCallbackFuncs);
@@ -281,6 +289,15 @@ namespace dchat
}
+ void Window::refresh()
+ {
+ if(needUpdate)
+ return;
+
+ needUpdate = true;
+ dispatcher.emit();
+ }
+
void Window::dispatchFunction(DispatcherHandler func)
{
std::lock_guard<std::recursive_mutex> lock(dispatcherMutex);