From 27891fc4be699341ce93e75198a17556c76d765e Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
Date: Sat, 26 Aug 2017 11:41:09 +0200
Subject: [PATCH] Fix WebPositive drawing glitches.
* Introduced with recent BTabView changes.
* Adjust drawing tabs a bit.
* Remove trailing whitespace.
---
src/apps/webpositive/tabview/TabContainerView.cpp | 4 ----
src/apps/webpositive/tabview/TabManager.cpp | 9 ++++-----
src/apps/webpositive/tabview/TabView.cpp | 5 ++---
src/kits/interface/ControlLook.cpp | 2 +-
src/kits/interface/TabView.cpp | 14 --------------
5 files changed, 7 insertions(+), 27 deletions(-)
diff --git a/src/apps/webpositive/tabview/TabContainerView.cpp b/src/apps/webpositive/tabview/TabContainerView.cpp
index 9ce130f701..300173759a 100644
a
|
b
|
TabContainerView::MessageReceived(BMessage* message)
|
75 | 75 | void |
76 | 76 | TabContainerView::Draw(BRect updateRect) |
77 | 77 | { |
78 | | // Stroke separator line at bottom. |
79 | 78 | rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); |
80 | 79 | BRect frame(Bounds()); |
81 | | SetHighColor(tint_color(base, B_DARKEN_2_TINT)); |
82 | | StrokeLine(frame.LeftBottom(), frame.RightBottom()); |
83 | | frame.bottom--; |
84 | 80 | |
85 | 81 | // Draw empty area before first tab. |
86 | 82 | uint32 borders = BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER; |
diff --git a/src/apps/webpositive/tabview/TabManager.cpp b/src/apps/webpositive/tabview/TabManager.cpp
index e9e3da8468..dff37ca7b0 100644
a
|
b
|
public:
|
64 | 64 | { |
65 | 65 | BRect bounds(Bounds()); |
66 | 66 | rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); |
67 | | SetHighColor(tint_color(base, B_DARKEN_2_TINT)); |
68 | | StrokeLine(bounds.LeftBottom(), bounds.RightBottom()); |
69 | | bounds.bottom--; |
70 | 67 | uint32 flags = be_control_look->Flags(this); |
71 | 68 | uint32 borders = BControlLook::B_TOP_BORDER |
72 | 69 | | BControlLook::B_BOTTOM_BORDER; |
… |
… |
public:
|
182 | 179 | bigtime_t clickSpeed = 2000000; |
183 | 180 | get_click_speed(&clickSpeed); |
184 | 181 | bigtime_t clickTime = Window()->CurrentMessage()->FindInt64("when"); |
185 | | if (!IsEnabled() || (Value() == B_CONTROL_ON) |
| 182 | if (!IsEnabled() || (Value() == B_CONTROL_ON) |
186 | 183 | || clickTime < fCloseTime + clickSpeed) { |
187 | 184 | return; |
188 | 185 | } |
… |
… |
public:
|
284 | 281 | } |
285 | 282 | fTabMenuButton->MenuClosed(); |
286 | 283 | delete tabMenu; |
287 | | |
| 284 | |
288 | 285 | break; |
289 | 286 | } |
290 | 287 | default: |
… |
… |
WebTabView::DrawContents(BView* owner, BRect frame, const BRect& updateRect,
|
513 | 510 | iconBounds.bottom = (fIcon->Bounds().Height() + 1) / scale - 1; |
514 | 511 | } |
515 | 512 | } |
| 513 | // account for borders |
| 514 | frame.top -= 2.0f; |
516 | 515 | BPoint iconPos(frame.left + kIconInset - 1, |
517 | 516 | frame.top + floorf((frame.Height() - iconBounds.Height()) / 2)); |
518 | 517 | iconBounds.OffsetTo(iconPos); |
diff --git a/src/apps/webpositive/tabview/TabView.cpp b/src/apps/webpositive/tabview/TabView.cpp
index af56ef5673..350bed59b9 100644
a
|
b
|
TabView::Draw(BRect updateRect)
|
77 | 77 | frame.left--; |
78 | 78 | if (!fIsLast) |
79 | 79 | frame.right++; |
80 | | |
81 | | frame.bottom++; |
82 | 80 | } |
| 81 | frame.bottom++; |
83 | 82 | |
84 | 83 | DrawBackground(fContainerView, frame, updateRect, fIsFirst, fIsLast, |
85 | 84 | fIsFront); |
… |
… |
TabView::Update(bool isFirst, bool isLast, bool isFront)
|
180 | 179 | fIsFirst = isFirst; |
181 | 180 | fIsLast = isLast; |
182 | 181 | fIsFront = isFront; |
183 | | |
| 182 | |
184 | 183 | fLayoutItem->InvalidateContainer(); |
185 | 184 | } |
186 | 185 | |
diff --git a/src/kits/interface/ControlLook.cpp b/src/kits/interface/ControlLook.cpp
index 60ab9ae405..e6c76d12ab 100644
a
|
b
|
BControlLook::DrawActiveTab(BView* view, BRect& rect, const BRect& updateRect,
|
1506 | 1506 | |
1507 | 1507 | // draw the rest of frame and fill |
1508 | 1508 | _DrawFrame(view, rect, edgeShadowColor, edgeShadowColor, edgeLightColor, |
1509 | | edgeLightColor, borders & bordersToDraw); |
| 1509 | edgeLightColor, borders); |
1510 | 1510 | if (side == B_TOP_BORDER || side == B_BOTTOM_BORDER) { |
1511 | 1511 | if ((borders & B_LEFT_BORDER) == 0) |
1512 | 1512 | rect.left++; |
diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp
index 271bc5f66e..8a35cd0a57 100644
a
|
b
|
BTab::DrawTab(BView* owner, BRect frame, tab_position position, bool full)
|
340 | 340 | } |
341 | 341 | |
342 | 342 | if (position == B_TAB_FRONT) { |
343 | | switch (fTabView->TabSide()) { |
344 | | case BTabView::kTopSide: |
345 | | frame.bottom -= 1.0f; |
346 | | break; |
347 | | case BTabView::kBottomSide: |
348 | | frame.top += 1.0f; |
349 | | break; |
350 | | case BTabView::kLeftSide: |
351 | | frame.right -= 1.0f; |
352 | | break; |
353 | | case BTabView::kRightSide: |
354 | | frame.left += 1.0f; |
355 | | break; |
356 | | } |
357 | 343 | be_control_look->DrawActiveTab(owner, frame, frame, no_tint, 0, |
358 | 344 | borders, fTabView->TabSide()); |
359 | 345 | } else { |