From a540770ce238f0dd9b58d4b6419274d1541a5c0e Mon Sep 17 00:00:00 2001 From: nerix Date: Sat, 21 Dec 2024 11:25:21 +0100 Subject: [PATCH] fix: hide scrollbar highlights in overlay window (#5769) --- CHANGELOG.md | 2 ++ src/widgets/OverlayWindow.cpp | 1 + src/widgets/Scrollbar.cpp | 13 ++++++++++++- src/widgets/Scrollbar.hpp | 5 +++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c2fb46d..7aa471a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unversioned +- Bugfix: Fixed scrollbar highlights being visible in overlay windows. (#5769) + ## 2.5.2-beta.1 - Major: Add option to show pronouns in user card. (#5442, #5583) diff --git a/src/widgets/OverlayWindow.cpp b/src/widgets/OverlayWindow.cpp index c454843f..a32ffbb6 100644 --- a/src/widgets/OverlayWindow.cpp +++ b/src/widgets/OverlayWindow.cpp @@ -127,6 +127,7 @@ OverlayWindow::OverlayWindow(IndirectChannel channel, this->channelView_.setChannel(this->channel_.get()); }); this->channelView_.scrollbar()->setHideThumb(true); + this->channelView_.scrollbar()->setHideHighlights(true); this->setAutoFillBackground(false); this->resize(300, 500); diff --git a/src/widgets/Scrollbar.cpp b/src/widgets/Scrollbar.cpp index d860a241..f85f7084 100644 --- a/src/widgets/Scrollbar.cpp +++ b/src/widgets/Scrollbar.cpp @@ -495,9 +495,20 @@ bool Scrollbar::shouldShowThumb() const return !(this->hideThumb || this->settingHideThumb); } +void Scrollbar::setHideHighlights(bool hideHighlights) +{ + if (this->hideHighlights == hideHighlights) + { + return; + } + + this->hideHighlights = hideHighlights; + this->update(); +} + bool Scrollbar::shouldShowHighlights() const { - return !this->settingHideHighlights; + return !(this->hideHighlights || this->settingHideHighlights); } bool Scrollbar::shouldHandleMouseEvents() const diff --git a/src/widgets/Scrollbar.hpp b/src/widgets/Scrollbar.hpp index 5d3f1e63..ba02ac06 100644 --- a/src/widgets/Scrollbar.hpp +++ b/src/widgets/Scrollbar.hpp @@ -133,6 +133,8 @@ public: /// Returns true if we should show the thumb (the handle you can drag) bool shouldShowThumb() const; + void setHideHighlights(bool hideHighlights); + /// Returns true if we should show the highlights bool shouldShowHighlights() const; @@ -180,10 +182,13 @@ private: boost::circular_buffer highlights_; bool atBottom_{true}; + /// This takes precedence over `settingHideThumb` bool hideThumb{false}; /// Controlled by the "Hide scrollbar thumb" setting bool settingHideThumb{false}; + /// This takes precedence over `settingHideHighlights` + bool hideHighlights = false; /// Controlled by the "Hide scrollbar highlights" setting bool settingHideHighlights{false};