Skip to content

Commit

Permalink
Use a translucent background in PE_Widget if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujan committed Nov 4, 2024
1 parent 43a4940 commit faee077
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 14 deletions.
1 change: 1 addition & 0 deletions Kvantum/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
V1.1.4
---------
* Exclude the opaque list from blurring of hard-coded translucency.
* Use a translucent background in "PE_Widget" if needed and existing.

V1.1.3
---------
Expand Down
2 changes: 1 addition & 1 deletion Kvantum/NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Latest version:

3 Nov 2024, V1.1.4
4 Nov 2024, V1.1.4

See "ChangeLog" for changes.
57 changes: 49 additions & 8 deletions Kvantum/style/Kvantum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ void Style::drawPrimitive(QStyle::PrimitiveElement element,
}
if (widget) // it's NULL with QML
{
if (widget->windowType() == Qt::ToolTip)
if (widget->windowType() == Qt::ToolTip && !translucentWidgets_.contains(widget))
{
painter->fillRect(option->rect, standardPalette().color(QPalette::Window));
break;
Expand All @@ -1834,24 +1834,65 @@ void Style::drawPrimitive(QStyle::PrimitiveElement element,
QPalette::Window));
}

interior_spec ispec = getInteriorSpec(KSL("Dialog"));
size_spec sspec = getSizeSpec(KSL("Dialog"));
interior_spec ispec;
size_spec sspec;
if (widget && translucentWidgets_.contains(widget))
{
ispec = getInteriorSpec(KSL("DialogTranslucent"));
sspec = getSizeSpec(KSL("DialogTranslucent"));
if (ispec.element.isEmpty())
{
ispec = getInteriorSpec(KSL("Dialog"));
sspec = getSizeSpec(KSL("Dialog"));
}
}
else
{
ispec = getInteriorSpec(KSL("Dialog"));
sspec = getSizeSpec(KSL("Dialog"));
}
if (widget && !ispec.element.isEmpty()
&& !widget->windowFlags().testFlag(Qt::FramelessWindowHint)) // not a panel)
&& !widget->windowFlags().testFlag(Qt::FramelessWindowHint)) // not a panel
{
if (QWidget *child = widget->childAt(0,0))
{
if (qobject_cast<QMenuBar*>(child) || qobject_cast<QToolBar*>(child))
{
ispec = getInteriorSpec(KSL("Window"));
sspec = getSizeSpec(KSL("Window"));
if (widget && translucentWidgets_.contains(widget))
{
ispec = getInteriorSpec(KSL("WindowTranslucent"));
sspec = getSizeSpec(KSL("WindowTranslucent"));
if (ispec.element.isEmpty())
{
ispec = getInteriorSpec(KSL("Window"));
sspec = getSizeSpec(KSL("Window"));
}
}
else
{
ispec = getInteriorSpec(KSL("Window"));
sspec = getSizeSpec(KSL("Window"));
}
}
}
}
else
{
ispec = getInteriorSpec(KSL("Window"));
sspec = getSizeSpec(KSL("Window"));
if (widget && translucentWidgets_.contains(widget))
{
ispec = getInteriorSpec(KSL("WindowTranslucent"));
sspec = getSizeSpec(KSL("WindowTranslucent"));
if (ispec.element.isEmpty())
{
ispec = getInteriorSpec(KSL("Window"));
sspec = getSizeSpec(KSL("Window"));
}
}
else
{
ispec = getInteriorSpec(KSL("Window"));
sspec = getSizeSpec(KSL("Window"));
}
}
frame_spec fspec;
default_frame_spec(fspec);
Expand Down
8 changes: 3 additions & 5 deletions Kvantum/style/polishing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ void Style::polish(QWidget *widget)
but exclude the opaque list */
|| (!isOpaque_ && tspec_now.composite
&& (hspec_.blur_translucent
/* let unusual tooltips with hard-coded translucency
have shadow (like in LXQtGroupPopup or KDE system settings) */
/* include unusual tooltips with hard-coded translucency (like in
LXQtGroupPopup or KDE system settings) into translucentWidgets_ */
|| (widget->windowFlags() & Qt::WindowType_Mask) == Qt::ToolTip)
&& widget->testAttribute(Qt::WA_TranslucentBackground)))
{
Expand All @@ -407,9 +407,7 @@ void Style::polish(QWidget *widget)
}

/* enable blurring */
if ((!makeTranslucent
&& (hspec_.blur_translucent || tspec_now.popup_blurring))
|| tspec_now.blurring)
if (makeTranslucent ? tspec_now.blurring : hspec_.blur_translucent)
{
if (blurHelper_ == nullptr)
{
Expand Down

0 comments on commit faee077

Please sign in to comment.