centralize theme enable/disable
This commit is contained in:
parent
38bcec95b0
commit
c7d16008d7
@ -162,17 +162,33 @@ void DialogPrivate::syncBorders()
|
|||||||
|
|
||||||
void DialogPrivate::updateTheme()
|
void DialogPrivate::updateTheme()
|
||||||
{
|
{
|
||||||
KWindowEffects::enableBackgroundContrast(q->winId(), theme.backgroundContrastEnabled(),
|
if (backgroundHints == Dialog::NoBackground) {
|
||||||
theme.backgroundContrast(),
|
frameSvgItem->setImagePath(QString());
|
||||||
theme.backgroundIntensity(),
|
KWindowEffects::enableBlurBehind(q->winId(), false);
|
||||||
theme.backgroundSaturation(),
|
KWindowEffects::enableBackgroundContrast(q->winId(), false);
|
||||||
frameSvgItem->frameSvg()->mask());
|
|
||||||
|
|
||||||
if (KWindowSystem::compositingActive()) {
|
|
||||||
q->setMask(QRegion());
|
q->setMask(QRegion());
|
||||||
} else {
|
} else {
|
||||||
q->setMask(frameSvgItem->frameSvg()->mask());
|
if (type == Dialog::Tooltip) {
|
||||||
|
frameSvgItem->setImagePath("widgets/tooltip");
|
||||||
|
} else {
|
||||||
|
frameSvgItem->setImagePath("dialogs/background");
|
||||||
|
}
|
||||||
|
|
||||||
|
KWindowEffects::enableBlurBehind(q->winId(), true, frameSvgItem->frameSvg()->mask());
|
||||||
|
|
||||||
|
KWindowEffects::enableBackgroundContrast(q->winId(), theme.backgroundContrastEnabled(),
|
||||||
|
theme.backgroundContrast(),
|
||||||
|
theme.backgroundIntensity(),
|
||||||
|
theme.backgroundSaturation(),
|
||||||
|
frameSvgItem->frameSvg()->mask());
|
||||||
|
|
||||||
|
if (KWindowSystem::compositingActive()) {
|
||||||
|
q->setMask(QRegion());
|
||||||
|
} else {
|
||||||
|
q->setMask(frameSvgItem->frameSvg()->mask());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
updateInputShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogPrivate::updateVisibility(bool visible)
|
void DialogPrivate::updateVisibility(bool visible)
|
||||||
@ -312,7 +328,12 @@ void DialogPrivate::updateInputShape()
|
|||||||
if (!q->isVisible()) {
|
if (!q->isVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_XCB_SHAPE
|
#if HAVE_XCB_SHAPE
|
||||||
|
if (backgroundHints == Dialog::NoBackground) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
|
if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
|
||||||
xcb_connection_t *c = QX11Info::connection();
|
xcb_connection_t *c = QX11Info::connection();
|
||||||
static bool s_shapeExtensionChecked = false;
|
static bool s_shapeExtensionChecked = false;
|
||||||
@ -350,7 +371,6 @@ void DialogPrivate::syncMainItemToSize()
|
|||||||
{
|
{
|
||||||
syncBorders();
|
syncBorders();
|
||||||
|
|
||||||
KWindowEffects::enableBlurBehind(q->winId(), true, frameSvgItem->frameSvg()->mask());
|
|
||||||
updateTheme();
|
updateTheme();
|
||||||
|
|
||||||
if (mainItem) {
|
if (mainItem) {
|
||||||
@ -397,7 +417,7 @@ void DialogPrivate::syncToMainItemSize()
|
|||||||
syncBorders();
|
syncBorders();
|
||||||
mainItem.data()->setX(frameSvgItem->margins()->left());
|
mainItem.data()->setX(frameSvgItem->margins()->left());
|
||||||
mainItem.data()->setY(frameSvgItem->margins()->top());
|
mainItem.data()->setY(frameSvgItem->margins()->top());
|
||||||
KWindowEffects::enableBlurBehind(q->winId(), true, frameSvgItem->frameSvg()->mask());
|
|
||||||
updateTheme();
|
updateTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -856,15 +876,7 @@ void Dialog::classBegin()
|
|||||||
|
|
||||||
void Dialog::componentComplete()
|
void Dialog::componentComplete()
|
||||||
{
|
{
|
||||||
if (d->backgroundHints == NoBackground) {
|
d->updateTheme();
|
||||||
d->frameSvgItem->setImagePath(QString());
|
|
||||||
} else {
|
|
||||||
if (d->type == Tooltip) {
|
|
||||||
d->frameSvgItem->setImagePath("widgets/tooltip");
|
|
||||||
} else {
|
|
||||||
d->frameSvgItem->setImagePath("dialogs/background");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
d->componentComplete = true;
|
d->componentComplete = true;
|
||||||
d->syncToMainItemSize();
|
d->syncToMainItemSize();
|
||||||
}
|
}
|
||||||
@ -909,15 +921,7 @@ void Dialog::setBackgroundHints(Dialog::BackgroundHints hints)
|
|||||||
}
|
}
|
||||||
|
|
||||||
d->backgroundHints = hints;
|
d->backgroundHints = hints;
|
||||||
if (hints == NoBackground) {
|
d->updateTheme();
|
||||||
d->frameSvgItem->setImagePath(QString());
|
|
||||||
} else {
|
|
||||||
if (d->type == Tooltip) {
|
|
||||||
d->frameSvgItem->setImagePath("widgets/tooltip");
|
|
||||||
} else {
|
|
||||||
d->frameSvgItem->setImagePath("dialogs/background");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
emit backgroundHintsChanged();
|
emit backgroundHintsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user