[haiku-commits] haiku: hrev44234 - in src/servers/app: . decorator

  • From: leavengood@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 10 Jun 2012 06:17:11 +0200 (CEST)

hrev44234 adds 2 changesets to branch 'master'
old head: 20b3f78f8d7e5a2df62aa59c7e15bc5ffd7431ab
new head: 585d44f283e2d07d855f18b2f0573a4243b33844

----------------------------------------------------------------------------

70a5df3: Use the correct color for the tab border for inactive windows.
  
  Before this the active window border color was used, resulting in ugly 
inactive
  window tabs if the active and inactive border colors were quite different.
  
  This was not noticed before because the defaults are two very similar grays.

585d44f: Improve the workspace view tab rendering.
  
  Before this the height and width of the tab would jump around as the window 
was
  moved. In addition there was an off-by-one error which caused right-aligned
  tabs to not be drawn right (as reported in ticket #4615, which this fixes.)

                                  [ Ryan Leavengood <leavengood@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 34 insertions(+), 16 deletions(-)
src/servers/app/WorkspacesView.cpp             |   38 +++++++++++++-------
src/servers/app/decorator/DefaultDecorator.cpp |   12 ++++---

############################################################################

Commit:      70a5df3878c7778c8342a268f62176f15245ab35
URL:         http://cgit.haiku-os.org/haiku/commit/?id=70a5df3
Author:      Ryan Leavengood <leavengood@xxxxxxxxx>
Date:        Sun Jun 10 02:27:29 2012 UTC

Use the correct color for the tab border for inactive windows.

Before this the active window border color was used, resulting in ugly inactive
window tabs if the active and inactive border colors were quite different.

This was not noticed before because the defaults are two very similar grays.

----------------------------------------------------------------------------

diff --git a/src/servers/app/decorator/DefaultDecorator.cpp 
b/src/servers/app/decorator/DefaultDecorator.cpp
index 05e693d..4e1b245 100644
--- a/src/servers/app/decorator/DefaultDecorator.cpp
+++ b/src/servers/app/decorator/DefaultDecorator.cpp
@@ -1490,17 +1490,21 @@ DefaultDecorator::GetComponentColors(Component 
component, uint8 highlight,
        DefaultDecorator::Tab* tab = static_cast<DefaultDecorator::Tab*>(_tab);
        switch (component) {
                case COMPONENT_TAB:
-                       _colors[COLOR_TAB_FRAME_LIGHT]
-                               = tint_color(kFocusFrameColor, B_DARKEN_2_TINT);
-                       _colors[COLOR_TAB_FRAME_DARK]
-                               = tint_color(kFocusFrameColor, B_DARKEN_3_TINT);
                        if (tab && tab->buttonFocus) {
+                               _colors[COLOR_TAB_FRAME_LIGHT]
+                                       = tint_color(kFocusFrameColor, 
B_DARKEN_2_TINT);
+                               _colors[COLOR_TAB_FRAME_DARK]
+                                       = tint_color(kFocusFrameColor, 
B_DARKEN_3_TINT);
                                _colors[COLOR_TAB] = kFocusTabColor;
                                _colors[COLOR_TAB_LIGHT] = kFocusTabColorLight;
                                _colors[COLOR_TAB_BEVEL] = kFocusTabColorBevel;
                                _colors[COLOR_TAB_SHADOW] = 
kFocusTabColorShadow;
                                _colors[COLOR_TAB_TEXT] = kFocusTextColor;
                        } else {
+                               _colors[COLOR_TAB_FRAME_LIGHT]
+                                       = tint_color(kNonFocusFrameColor, 
B_DARKEN_2_TINT);
+                               _colors[COLOR_TAB_FRAME_DARK]
+                                       = tint_color(kNonFocusFrameColor, 
B_DARKEN_3_TINT);
                                _colors[COLOR_TAB] = kNonFocusTabColor;
                                _colors[COLOR_TAB_LIGHT] = 
kNonFocusTabColorLight;
                                _colors[COLOR_TAB_BEVEL] = 
kNonFocusTabColorBevel;

############################################################################

Revision:    hrev44234
Commit:      585d44f283e2d07d855f18b2f0573a4243b33844
URL:         http://cgit.haiku-os.org/haiku/commit/?id=585d44f
Author:      Ryan Leavengood <leavengood@xxxxxxxxx>
Date:        Sun Jun 10 04:14:21 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/4615

Improve the workspace view tab rendering.

Before this the height and width of the tab would jump around as the window was
moved. In addition there was an off-by-one error which caused right-aligned
tabs to not be drawn right (as reported in ticket #4615, which this fixes.)

----------------------------------------------------------------------------

diff --git a/src/servers/app/WorkspacesView.cpp 
b/src/servers/app/WorkspacesView.cpp
index a475aad..60df6d8 100644
--- a/src/servers/app/WorkspacesView.cpp
+++ b/src/servers/app/WorkspacesView.cpp
@@ -214,18 +214,32 @@ WorkspacesView::_DrawWindow(DrawingEngine* drawingEngine,
                _DarkenColor(white);
        }
 
-       if (tabFrame.left < frame.left)
-               tabFrame.left = frame.left;
-       if (tabFrame.right >= frame.right)
-               tabFrame.right = frame.right - 1;
-
-       tabFrame.bottom = frame.top - 1;
-       tabFrame.top = min_c(tabFrame.top, tabFrame.bottom);
-       tabFrame = tabFrame & workspaceFrame;
-
-       if (decorator != NULL && tabFrame.IsValid()) {
-               drawingEngine->FillRect(tabFrame, tabColor);
-               backgroundRegion.Exclude(tabFrame);
+       if (tabFrame.Height() > 0 && tabFrame.Width() > 0) {
+               float width = tabFrame.Width();
+               if (tabFrame.left < frame.left) {
+                       // Shift the tab right
+                       tabFrame.left = frame.left;
+                       tabFrame.right = tabFrame.left + width;
+               }
+               if (tabFrame.right > frame.right) {
+                       // Shift the tab left
+                       tabFrame.right = frame.right;
+                       tabFrame.left = tabFrame.right - width;
+               }
+
+               if (tabFrame.Height() > 0 && tabFrame.bottom >= tabFrame.top) {
+                       // Shift the tab up
+                       float tabHeight = tabFrame.Height();
+                       tabFrame.bottom = frame.top - 1;
+                       tabFrame.top = tabFrame.bottom - tabHeight;
+               }
+
+               tabFrame = tabFrame & workspaceFrame;
+
+               if (decorator != NULL && tabFrame.IsValid()) {
+                       drawingEngine->FillRect(tabFrame, tabColor);
+                       backgroundRegion.Exclude(tabFrame);
+               }
        }
 
        drawingEngine->StrokeRect(frame, frameColor);


Other related posts:

  • » [haiku-commits] haiku: hrev44234 - in src/servers/app: . decorator - leavengood