summaryrefslogtreecommitdiff
path: root/src/components/chatlist.hpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-04-06 19:58:41 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-04-06 19:58:41 -0400
commit56a74fb5dd8d42b96c00e3a8602221fabe5eadfe (patch)
treef5213db2e65e672931dcfac1ae8ab488edf38bdd /src/components/chatlist.hpp
parent49685c39895af67d7ffcc50fdc02150b6ee44f72 (diff)
downloadabaddon-portaudio-56a74fb5dd8d42b96c00e3a8602221fabe5eadfe.tar.gz
abaddon-portaudio-56a74fb5dd8d42b96c00e3a8602221fabe5eadfe.zip
improve scrolling behavior again, refactor
scrolling is almost exactly how i want it, but when an existing message's height allocation is changed it still causes the scroll position to change, but its not that bad and is better than what i had before anyways so it is good enough for now. ideally if you are scrolled in the middle it will stay put completely
Diffstat (limited to 'src/components/chatlist.hpp')
-rw-r--r--src/components/chatlist.hpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/components/chatlist.hpp b/src/components/chatlist.hpp
index 783474a..f77bbd6 100644
--- a/src/components/chatlist.hpp
+++ b/src/components/chatlist.hpp
@@ -26,8 +26,11 @@ public:
void ActuallyRemoveMessage(Snowflake id); // perhaps not the best method name
private:
- void OnUpperAdjustmentChanged();
+ void SetupMenu();
void ScrollToBottom();
+ void OnVAdjustmentValueChanged();
+ void OnVAdjustmentUpperChanged();
+ void OnListSizeAllocate(Gtk::Allocation &allocation);
void RemoveMessageAndHeader(Gtk::Widget *widget);
bool m_use_pinned_menu = false;
@@ -48,14 +51,14 @@ private:
int m_num_rows = 0;
std::map<Snowflake, Gtk::Widget *> m_id_to_widget;
+ bool m_ignore_next_upper = false;
+ double m_old_upper = -1.0;
bool m_should_scroll_to_bottom = true;
Gtk::ListBox m_list;
bool m_separate_all = false;
Glib::Timer m_history_timer;
- bool m_needs_upper_adjustment = false;
- double m_old_upper = -1.0;
public:
// these are all forwarded by the parent
@@ -93,7 +96,6 @@ private:
template<typename Iter>
inline void ChatList::SetMessages(Iter begin, Iter end) {
- m_needs_upper_adjustment = false;
Clear();
m_num_rows = 0;
m_num_messages = 0;
@@ -107,7 +109,6 @@ inline void ChatList::SetMessages(Iter begin, Iter end) {
template<typename Iter>
inline void ChatList::PrependMessages(Iter begin, Iter end) {
- m_needs_upper_adjustment = true;
for (Iter it = begin; it != end; it++)
ProcessNewMessage(*it, true);
}