From 6b0a7f507e63636d44fecea4a04869a9009d310e Mon Sep 17 00:00:00 2001 From: fourtf Date: Thu, 17 Aug 2017 16:43:19 +0200 Subject: [PATCH 1/2] tabs now grey out when the window loses focus --- src/colorscheme.cpp | 3 +++ src/colorscheme.hpp | 3 +++ src/widgets/notebookpage.cpp | 11 +++++++---- src/widgets/notebooktab.cpp | 10 ++++++++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/colorscheme.cpp b/src/colorscheme.cpp index 36f1d3970..e83975e01 100644 --- a/src/colorscheme.cpp +++ b/src/colorscheme.cpp @@ -90,6 +90,9 @@ void ColorScheme::setColors(double hue, double multiplier) TabSelectedText = QColor(255, 255, 255); TabSelectedBackground = getColor(hue, 0.5, 0.5); + TabSelectedUnfocusedText = QColor(255, 255, 255); + TabSelectedUnfocusedBackground = getColor(hue, 0, 0.5); + TabHighlightedText = QColor(0, 0, 0); TabHighlightedBackground = getColor(hue, 0.5, 0.2); diff --git a/src/colorscheme.hpp b/src/colorscheme.hpp index 2a49f9643..99280e932 100644 --- a/src/colorscheme.hpp +++ b/src/colorscheme.hpp @@ -68,6 +68,9 @@ public: QColor TabHighlightedText; QColor TabHighlightedBackground; + QColor TabSelectedUnfocusedText; + QColor TabSelectedUnfocusedBackground; + QBrush TabNewMessageBackground; const int HighlightColorCount = 3; diff --git a/src/widgets/notebookpage.cpp b/src/widgets/notebookpage.cpp index e5121f625..51c14c7b8 100644 --- a/src/widgets/notebookpage.cpp +++ b/src/widgets/notebookpage.cpp @@ -4,6 +4,7 @@ #include "widgets/notebook.hpp" #include "widgets/notebooktab.hpp" +#include #include #include #include @@ -364,15 +365,17 @@ void NotebookPage::paintEvent(QPaintEvent *) if (this->ui.hbox.count() == 0) { painter.fillRect(rect(), this->colorScheme.ChatBackground); - painter.fillRect(0, 0, width(), 2, this->colorScheme.TabSelectedBackground); - painter.setPen(this->colorScheme.Text); painter.drawText(rect(), "Add Chat", QTextOption(Qt::AlignCenter)); } else { painter.fillRect(rect(), this->colorScheme.ChatSeperator); - - painter.fillRect(0, 0, width(), 2, this->colorScheme.TabSelectedBackground); } + + QColor accentColor = (QApplication::activeWindow() == this->window() + ? this->colorScheme.TabSelectedBackground + : this->colorScheme.TabSelectedUnfocusedBackground); + + painter.fillRect(0, 0, width(), 2, accentColor); } void NotebookPage::showEvent(QShowEvent *event) diff --git a/src/widgets/notebooktab.cpp b/src/widgets/notebooktab.cpp index 79caf4ab9..9bf833c47 100644 --- a/src/widgets/notebooktab.cpp +++ b/src/widgets/notebooktab.cpp @@ -6,6 +6,7 @@ #include #include +#include namespace chatterino { namespace widgets { @@ -154,8 +155,13 @@ void NotebookTab::paintEvent(QPaintEvent *) QColor fg = QColor(0, 0, 0); if (this->selected) { - painter.fillRect(rect(), this->colorScheme.TabSelectedBackground); - fg = this->colorScheme.TabSelectedText; + if (this->window() == QApplication::activeWindow()) { + painter.fillRect(rect(), this->colorScheme.TabSelectedBackground); + fg = this->colorScheme.TabSelectedText; + } else { + painter.fillRect(rect(), this->colorScheme.TabSelectedUnfocusedBackground); + fg = this->colorScheme.TabSelectedUnfocusedText; + } } else if (this->mouseOver) { painter.fillRect(rect(), this->colorScheme.TabHoverBackground); fg = this->colorScheme.TabHoverText; From 6bc99a9ba6bf43ee53cc831cf60c6a914f0aafc4 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 17 Aug 2017 17:02:10 +0200 Subject: [PATCH 2/2] hopefully fixed black screen issue on mac --- src/widgets/chatwidgetview.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/chatwidgetview.cpp b/src/widgets/chatwidgetview.cpp index 0aa537741..37735f9ef 100644 --- a/src/widgets/chatwidgetview.cpp +++ b/src/widgets/chatwidgetview.cpp @@ -26,7 +26,9 @@ ChatWidgetView::ChatWidgetView(ChatWidget *_chatWidget) , scrollBar(this) , userPopupWidget(_chatWidget->getChannelRef()) { +#ifndef Q_OS_MAC this->setAttribute(Qt::WA_OpaquePaintEvent); +#endif this->setMouseTracking(true); QObject::connect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged, this, @@ -152,6 +154,7 @@ void ChatWidgetView::paintEvent(QPaintEvent * /*event*/) _painter.setRenderHint(QPainter::SmoothPixmapTransform); // only update gif emotes +#ifndef Q_OS_MAC if (this->onlyUpdateEmotes) { this->onlyUpdateEmotes = false; @@ -163,6 +166,7 @@ void ChatWidgetView::paintEvent(QPaintEvent * /*event*/) return; } +#endif // update all messages this->gifEmotes.clear();