kstyle: make inactive windows more visibly inactive

- buttons now flatten
- default buttons don't show their blue colour, because, they aren't the
  button that'll get triggered on enter if their window isn't active
wilder
Janet Blackquill 4 years ago committed by Jan Blackquill
parent 901392c6f1
commit 37e44cf31a
  1. 9
      kstyle/breezehelper.cpp
  2. 1
      kstyle/breezestyle.cpp

@ -623,6 +623,7 @@ namespace Breeze
bool flat = stateProperties.value("flat");
bool defaultButton = stateProperties.value("defaultButton");
bool hasNeutralHighlight = stateProperties.value("hasNeutralHighlight");
bool isActiveWindow = stateProperties.value("isActiveWindow");
// don't render background if flat and not hovered, down, checked, or given visual focus
if (flat && !(hovered || down || checked || visualFocus)
@ -649,7 +650,7 @@ namespace Breeze
: alphaColor(palette.buttonText().color(), 0.125);
penBrush = hasNeutralHighlight ? neutralText(palette)
: KColorUtils::mix(palette.button().color(), palette.buttonText().color(), 0.3);
} else if (defaultButton) {
} else if (isActiveWindow && defaultButton) {
bgBrush = alphaColor(highlightColor, 0.125);
penBrush = KColorUtils::mix(
highlightColor,
@ -668,7 +669,7 @@ namespace Breeze
: KColorUtils::mix(palette.button().color(), palette.buttonText().color(), 0.125);
penBrush = hasNeutralHighlight ? neutralText(palette)
: KColorUtils::mix(palette.button().color(), palette.buttonText().color(), 0.3);
} else if (defaultButton) {
} else if (isActiveWindow && defaultButton) {
bgBrush = KColorUtils::mix(palette.button().color(), highlightColor, 0.2);
penBrush = KColorUtils::mix(
highlightColor,
@ -700,7 +701,7 @@ namespace Breeze
}
// Gradient
if (!(flat || down || hovered || checked) && enabled) {
if (isActiveWindow && !(flat || down || hovered || checked) && enabled) {
QLinearGradient bgGradient(frameRect.topLeft(), frameRect.bottomLeft());
bgGradient.setColorAt(0, KColorUtils::mix(bgBrush.color(), Qt::white, 0.03125));
bgGradient.setColorAt(0.5, bgBrush.color());
@ -713,7 +714,7 @@ namespace Breeze
}
// Shadow
if (!(flat || down || checked) && enabled) {
if (isActiveWindow && !(flat || down || checked) && enabled) {
renderRoundedRectShadow(painter, shadowedRect, shadowColor(palette));
}

@ -3862,6 +3862,7 @@ namespace Breeze
stateProperties["hasMenu"] = hasMenu;
stateProperties["defaultButton"] = defaultButton;
stateProperties["hasNeutralHighlight"] = hasNeutralHighlight;
stateProperties["isActiveWindow"] = widget ? widget->isActiveWindow() : true;
_helper->renderButtonFrame(painter, option->rect, option->palette, stateProperties, bgAnimation, penAnimation);

Loading…
Cancel
Save