summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/chatlist.cpp4
-rw-r--r--components/chatlist.hpp13
2 files changed, 13 insertions, 4 deletions
diff --git a/components/chatlist.cpp b/components/chatlist.cpp
index ba10de9..01f1629 100644
--- a/components/chatlist.cpp
+++ b/components/chatlist.cpp
@@ -1,7 +1,7 @@
#include "chatmessage.hpp"
#include "chatlist.hpp"
-#include "../abaddon.hpp"
-#include "../constants.hpp"
+#include "abaddon.hpp"
+#include "constants.hpp"
ChatList::ChatList() {
m_list.get_style_context()->add_class("messages");
diff --git a/components/chatlist.hpp b/components/chatlist.hpp
index 2122e49..e5afb80 100644
--- a/components/chatlist.hpp
+++ b/components/chatlist.hpp
@@ -2,7 +2,7 @@
#include <gtkmm.h>
#include <map>
#include <vector>
-#include "../discord/snowflake.hpp"
+#include "discord/snowflake.hpp"
class ChatList : public Gtk::ScrolledWindow {
public:
@@ -21,7 +21,7 @@ public:
void SetFailedByNonce(const std::string &nonce);
std::vector<Snowflake> GetRecentAuthors();
void SetSeparateAll(bool separate);
- void SetUsePinnedMenu(); // i think i need a better way to do menus
+ void SetUsePinnedMenu(); // i think i need a better way to do menus
void ActuallyRemoveMessage(Snowflake id); // perhaps not the best method name
private:
@@ -101,6 +101,15 @@ inline void ChatList::SetMessages(Iter begin, Iter end) {
template<typename Iter>
inline void ChatList::PrependMessages(Iter begin, Iter end) {
+ const auto old_upper = get_vadjustment()->get_upper();
+ const auto old_value = get_vadjustment()->get_value();
for (Iter it = begin; it != end; it++)
ProcessNewMessage(*it, true);
+ // force everything to process before getting new values
+ while (Gtk::Main::events_pending())
+ Gtk::Main::iteration();
+ const auto new_upper = get_vadjustment()->get_upper();
+ if (old_value == 0.0 && (new_upper - old_upper) > 0.0)
+ get_vadjustment()->set_value(new_upper - old_upper);
+ // this isn't ideal
}