[haiku-commits] Change in haiku[master]: Teammonitor: Respect system colors

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 22 Sep 2020 18:35:27 +0000

From Adrien Destugues <pulkomandy@xxxxxxxxx>:

Adrien Destugues has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3261 ;)


Change subject: Teammonitor: Respect system colors
......................................................................

Teammonitor: Respect system colors
---
M src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
1 file changed, 25 insertions(+), 25 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/61/3261/1

diff --git a/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp 
b/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
index 20f2264..52f947a 100644
--- a/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
+++ b/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp
@@ -66,26 +66,23 @@
 void
 TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
 {
-       rgb_color kHighlight = { 140, 140, 140, 0 };
-       rgb_color kBlack = { 0, 0, 0, 0 };
-       rgb_color kBlue = { 0, 0, 255, 0 };
-       rgb_color kRed = { 255, 0, 0, 0 };
+       rgb_color kHighlight = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
+       rgb_color kHighlightText = ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
+       rgb_color kText = ui_color(B_LIST_ITEM_TEXT_COLOR);
+
+       rgb_color kIdealRed = { 255, 0, 0, 0 };
+       rgb_color kIdealBlue = { 0, 0, 255, 0 };
+       rgb_color kRed = mix_color(kIdealRed, kText, 191);
+       rgb_color kBlue = mix_color(kIdealBlue, kText, 191);
+       rgb_color kHighlightRed = mix_color(kIdealRed, kHighlightText, 191);
+       rgb_color kHighlightBlue = mix_color(kIdealBlue, kHighlightText, 191);

        BRect r(frame);

        if (IsSelected() || complete) {
-               rgb_color color;
-               if (IsSelected())
-                       color = kHighlight;
-               else
-                       color = owner->ViewColor();
-
-               owner->SetHighColor(color);
-               owner->SetLowColor(color);
+               owner->SetHighColor(kHighlight);
+               owner->SetLowColor(kHighlight);
                owner->FillRect(r);
-               owner->SetHighColor(kBlack);
-       } else {
-               owner->SetLowColor(owner->ViewColor());
        }

        frame.left += 4;
@@ -99,10 +96,13 @@

        frame.left += 16;
        if (fRefusingToQuit)
-               owner->SetHighColor(kRed);
-       else
-               owner->SetHighColor(IsSystemServer() ? kBlue : kBlack);
-
+               owner->SetHighColor(IsSelected() ? kHighlightRed : kRed);
+       else {
+               if (IsSystemServer())
+                       owner->SetHighColor(IsSelected() ? kHighlightBlue : 
kBlue);
+               else
+                       owner->SetHighColor(IsSelected() ? kHighlightText : 
kText);
+       }
        BFont font = be_plain_font;
        font_height     finfo;
        font.GetHeight(&finfo);
@@ -150,19 +150,19 @@
        static BPath systemServersPath;
        static BPath trackerPath;
        static BPath deskbarPath;
-
+
        if (firstCall) {
                find_directory(B_SYSTEM_SERVERS_DIRECTORY, &systemServersPath);

                find_directory(B_SYSTEM_DIRECTORY, &trackerPath);
                trackerPath.Append("Tracker");
-
+
                find_directory(B_SYSTEM_DIRECTORY, &deskbarPath);
                deskbarPath.Append("Deskbar");
-
+
                firstCall = false;
        }
-
+
        if (strncmp(systemServersPath.Path(), fTeamInfo.args,
                        strlen(systemServersPath.Path())) == 0)
                return true;
@@ -174,8 +174,8 @@
        if (strncmp(deskbarPath.Path(), fTeamInfo.args,
                        strlen(deskbarPath.Path())) == 0)
                return true;
-
-       return false;
+
+       return false;
 }



--
To view, visit https://review.haiku-os.org/c/haiku/+/3261
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I5cc69376ade425c46bc76f8179f93bb74428da68
Gerrit-Change-Number: 3261
Gerrit-PatchSet: 1
Gerrit-Owner: Adrien Destugues <pulkomandy@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: Teammonitor: Respect system colors - Gerrit