Tracker: fix invisible selection text in disabled windows
Regression introduced in hrev54742 which used DeskTextColor() on a non-desktop view. The view color isn't set anywhere in that case and does not match the background color, which led to drawing white text on a white background. Moreover, a second bug was stacked on that: the selection is drawn in "reverse video" (using the document color for the text and document text color for the background) only for active windows. For inactive ones, it is drawn normally, and then a middle-grey rectangle is alpha blended on top. Add a comment to clarify that and reintroduce the ckeck that had been removed. Also replace the hardcoded black for the selection background, so it will be more easily visible for people using dark mode. Fixes #16627.
This commit is contained in:
parent
e3927d6ad4
commit
61282f9574
@ -603,9 +603,9 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView,
|
||||
&& windowActive;
|
||||
|
||||
if (index == 0 && selectDuringDraw) {
|
||||
// draw with dark background to select text
|
||||
// draw with "reverse video" to select text
|
||||
drawView->PushState();
|
||||
drawView->SetLowColor(0, 0, 0);
|
||||
drawView->SetLowColor(ui_color(B_DOCUMENT_TEXT_COLOR));
|
||||
}
|
||||
|
||||
if (index == 0) {
|
||||
|
@ -9044,7 +9044,11 @@ BPoseView::DeskTextColor() const
|
||||
// So here we check if the colors are different enough, and otherwise,
|
||||
// force the text to be either white or black.
|
||||
rgb_color textColor = ui_color(B_DOCUMENT_TEXT_COLOR);
|
||||
rgb_color viewColor = ViewColor();
|
||||
rgb_color viewColor;
|
||||
if (IsDesktopWindow())
|
||||
viewColor = ViewColor();
|
||||
else
|
||||
viewColor = ui_color(B_DOCUMENT_BACKGROUND_COLOR);
|
||||
|
||||
int textBrightness = BPrivate::perceptual_brightness(textColor);
|
||||
int viewBrightness = BPrivate::perceptual_brightness(viewColor);
|
||||
|
@ -544,7 +544,13 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
|
||||
|
||||
// set high color
|
||||
rgb_color highColor;
|
||||
if (selected)
|
||||
// for active views, the selection is drawn as inverse text (background color for the text,
|
||||
// solid black for the background).
|
||||
// For inactive windows, the text is drawn normally, then the selection rect is
|
||||
// alpha-blended on top of it.
|
||||
// This all happens in BPose::Draw before and after calling this function, here we are
|
||||
// only concerned with setting the correct color for the text.
|
||||
if (selected && view->Window()->IsActive())
|
||||
highColor = ui_color(B_DOCUMENT_BACKGROUND_COLOR);
|
||||
else
|
||||
highColor = view->DeskTextColor();
|
||||
|
Loading…
Reference in New Issue
Block a user