[prev in list] [next in list] [prev in thread] [next in thread]
List: haiku-commits
Subject: [haiku-commits] Change in haiku[master]: AboutSystem: Upddate replicant colors on workspace activate
From: Gerrit <review () review ! haiku-os ! org>
Date: 2022-07-30 18:18:33
Message-ID: 5c734493f62a06edaef4e7a9ffab0eb409b5c5ff-HTML () review ! haiku-os ! org
[Download RAW message or body]
From John Scipione <jscipione@gmail.com>:
John Scipione has uploaded this change for review. ( https://review.haiku-os.org/c/haiku/+/5514 )
Change subject: AboutSystem: Upddate replicant colors on workspace activated
......................................................................
AboutSystem: Upddate replicant colors on workspace activated
Change-Id: I23bc998df8c9cc8894accc475cab8eec69db7c21
---
M src/apps/aboutsystem/AboutSystem.cpp
1 file changed, 40 insertions(+), 3 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/14/5514/1
diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp
index b90fd35..6274cd9 100644
--- a/src/apps/aboutsystem/AboutSystem.cpp
+++ b/src/apps/aboutsystem/AboutSystem.cpp
@@ -242,7 +242,7 @@
private:
void _AdjustColors();
void _AdjustTextColors() const;
- rgb_color _DesktopTextColor() const;
+ rgb_color _DesktopTextColor(int32 workspace = -1) const;
bool _OnDesktop() const;
BStringView* _CreateLabel(const char*, const char*);
@@ -1857,6 +1857,39 @@
break;
}
+ case B_WORKSPACE_ACTIVATED:
+ {
+ if (!_OnDesktop())
+ break;
+
+ int32 workspace;
+ bool active;
+ if (message->FindBool("active", &active) == B_OK && active
+ && message->FindInt32("workspace", &workspace) == B_OK) {
+ BLayout* layout = GetLayout();
+ int32 itemCount = layout->CountItems() - 2;
+ // leave out dragger and uptime
+
+ rgb_color textColor = _DesktopTextColor(workspace);
+ SetHighColor(textColor);
+ for (int32 index = 0; index < itemCount; index++) {
+ BView* view = layout->ItemAt(index)->View();
+ if (view == NULL)
+ continue;
+
+ view->SetDrawingMode(B_OP_ALPHA);
+ view->SetHighColor(textColor);
+ }
+
+ fUptimeView->SetDrawingMode(B_OP_ALPHA);
+ fUptimeView->SetFontAndColor(NULL, 0, &textColor);
+
+ Invalidate();
+ }
+
+ break;
+ }
+
default:
BView::MessageReceived(message);
break;
@@ -1965,11 +1998,15 @@
rgb_color
-SysInfoView::_DesktopTextColor() const
+SysInfoView::_DesktopTextColor(int32 workspace) const
{
// set text color to black or white depending on desktop background color
BScreen screen(Window());
- rgb_color color = screen.DesktopColor();
+ rgb_color color;
+ if (workspace > -1)
+ color = screen.DesktopColor(workspace);
+ else
+ color = screen.DesktopColor();
float limit = color.red + (color.green * 1.25f) + (color.blue * 0.45f);
if (limit >= 360)
--
To view, visit https://review.haiku-os.org/c/haiku/+/5514
To unsubscribe, or for help writing mail filters, visit https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I23bc998df8c9cc8894accc475cab8eec69db7c21
Gerrit-Change-Number: 5514
Gerrit-PatchSet: 1
Gerrit-Owner: John Scipione <jscipione@gmail.com>
Gerrit-MessageType: newchange
[Attachment #3 (text/html)]
<p>John Scipione has uploaded this change for <strong>review</strong>.</p><p><a \
href="https://review.haiku-os.org/c/haiku/+/5514">View Change</a></p><pre \
style="font-family: monospace,monospace; white-space: pre-wrap;">AboutSystem: Upddate \
replicant colors on workspace activated<br><br>Change-Id: \
I23bc998df8c9cc8894accc475cab8eec69db7c21<br>---<br>M \
src/apps/aboutsystem/AboutSystem.cpp<br>1 file changed, 40 insertions(+), 3 \
deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: \
pre-wrap;">git pull ssh://git.haiku-os.org:22/haiku refs/changes/14/5514/1</pre><pre \
style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git \
a/src/apps/aboutsystem/AboutSystem.cpp \
b/src/apps/aboutsystem/AboutSystem.cpp</span><br><span>index b90fd35..6274cd9 \
100644</span><br><span>--- a/src/apps/aboutsystem/AboutSystem.cpp</span><br><span>+++ \
b/src/apps/aboutsystem/AboutSystem.cpp</span><br><span>@@ -242,7 +242,7 \
@@</span><br><span> private:</span><br><span> \
void _AdjustColors();</span><br><span> void _AdjustTextColors() \
const;</span><br><span style="color: hsl(0, 100%, \
40%);">- rgb_color _DesktopTextColor() const;</span><br><span style="color: \
hsl(120, 100%, 40%);">+ rgb_color _DesktopTextColor(int32 workspace = -1) \
const;</span><br><span> bool _OnDesktop() const;</span><br><span> \
</span><br><span> BStringView* _CreateLabel(const char*, const \
char*);</span><br><span>@@ -1857,6 +1857,39 @@</span><br><span> \
break;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, \
100%, 40%);">+ case B_WORKSPACE_ACTIVATED:</span><br><span style="color: hsl(120, \
100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ if \
(!_OnDesktop())</span><br><span style="color: hsl(120, 100%, \
40%);">+ break;</span><br><span style="color: hsl(120, 100%, \
40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ int32 \
workspace;</span><br><span style="color: hsl(120, 100%, 40%);">+ bool \
active;</span><br><span style="color: hsl(120, 100%, 40%);">+ if \
(message->FindBool("active", &active) == B_OK && \
active</span><br><span style="color: hsl(120, 100%, 40%);">+ && \
message->FindInt32("workspace", &workspace) == B_OK) \
{</span><br><span style="color: hsl(120, 100%, 40%);">+ BLayout* layout = \
GetLayout();</span><br><span style="color: hsl(120, 100%, 40%);">+ int32 itemCount \
= layout->CountItems() - 2;</span><br><span style="color: hsl(120, 100%, \
40%);">+ // leave out dragger and uptime</span><br><span style="color: hsl(120, \
100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ rgb_color \
textColor = _DesktopTextColor(workspace);</span><br><span style="color: hsl(120, \
100%, 40%);">+ SetHighColor(textColor);</span><br><span style="color: hsl(120, \
100%, 40%);">+ for (int32 index = 0; index < itemCount; index++) \
{</span><br><span style="color: hsl(120, 100%, 40%);">+ BView* view = \
layout->ItemAt(index)->View();</span><br><span style="color: hsl(120, 100%, \
40%);">+ if (view == NULL)</span><br><span style="color: hsl(120, 100%, \
40%);">+ continue;</span><br><span style="color: hsl(120, 100%, \
40%);">+</span><br><span style="color: hsl(120, 100%, \
40%);">+ view->SetDrawingMode(B_OP_ALPHA);</span><br><span style="color: \
hsl(120, 100%, 40%);">+ view->SetHighColor(textColor);</span><br><span \
style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, \
100%, 40%);">+</span><br><span style="color: hsl(120, 100%, \
40%);">+ fUptimeView->SetDrawingMode(B_OP_ALPHA);</span><br><span style="color: \
hsl(120, 100%, 40%);">+ fUptimeView->SetFontAndColor(NULL, 0, \
&textColor);</span><br><span style="color: hsl(120, 100%, \
40%);">+</span><br><span style="color: hsl(120, 100%, \
40%);">+ Invalidate();</span><br><span style="color: hsl(120, 100%, \
40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span \
style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, \
100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, \
40%);">+</span><br><span> default:</span><br><span> \
BView::MessageReceived(message);</span><br><span> break;</span><br><span>@@ \
-1965,11 +1998,15 @@</span><br><span> </span><br><span> </span><br><span> \
rgb_color</span><br><span style="color: hsl(0, 100%, \
40%);">-SysInfoView::_DesktopTextColor() const</span><br><span style="color: hsl(120, \
100%, 40%);">+SysInfoView::_DesktopTextColor(int32 workspace) const</span><br><span> \
{</span><br><span> // set text color to black or white depending on desktop \
background color</span><br><span> BScreen screen(Window());</span><br><span \
style="color: hsl(0, 100%, 40%);">- rgb_color color = \
screen.DesktopColor();</span><br><span style="color: hsl(120, 100%, \
40%);">+ rgb_color color;</span><br><span style="color: hsl(120, 100%, 40%);">+ if \
(workspace > -1)</span><br><span style="color: hsl(120, 100%, 40%);">+ color = \
screen.DesktopColor(workspace);</span><br><span style="color: hsl(120, 100%, \
40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+ color = \
screen.DesktopColor();</span><br><span> </span><br><span> float limit = color.red + \
(color.green * 1.25f) + (color.blue * 0.45f);</span><br><span> if (limit >= \
360)</span><br><span></span><br></pre><p>To view, visit <a \
href="https://review.haiku-os.org/c/haiku/+/5514">change 5514</a>. To unsubscribe, or \
for help writing mail filters, visit <a \
href="https://review.haiku-os.org/settings">settings</a>.</p><div itemscope \
itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" \
itemtype="http://schema.org/ViewAction"><link itemprop="url" \
href="https://review.haiku-os.org/c/haiku/+/5514"/><meta itemprop="name" \
content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: haiku </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: \
I23bc998df8c9cc8894accc475cab8eec69db7c21 </div> <div style="display:none"> \
Gerrit-Change-Number: 5514 </div> <div style="display:none"> Gerrit-PatchSet: 1 \
</div> <div style="display:none"> Gerrit-Owner: John Scipione \
<jscipione@gmail.com> </div> <div style="display:none"> Gerrit-MessageType: \
newchange </div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic