Skip to content

Commit

Permalink
Fix regression in rendering titlebar on vanilla Qt (#126)
Browse files Browse the repository at this point in the history
Don't use `window()->windowStates()` for checking active window state
on vanilla Qt5, this works only on Qt6 or with KDE's patchset for Qt5.

Fixes #125

Signed-off-by: Pavel Artsishevsky <[email protected]>

Signed-off-by: Pavel Artsishevsky <[email protected]>
  • Loading branch information
polter-rnd authored Jan 2, 2023
1 parent 6a3e8ff commit ba82069
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/decoration/qgnomeplatformdecoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ QMargins QGnomePlatformDecoration::margins() const

void QGnomePlatformDecoration::paint(QPaintDevice *device)
{
Qt::WindowStates windowStates;
#ifdef DECORATION_SHADOWS_SUPPORT // Qt 6.2.0+ or patched QtWayland
windowStates = waylandWindow()->windowStates();
const Qt::WindowStates windowStates = waylandWindow()->windowStates();
const bool active = windowStates & Qt::WindowActive;
#else
windowStates = window()->windowStates();
const Qt::WindowStates windowStates = window()->windowStates();
const bool active = window()->handle()->isActive();
#endif

const bool active = windowStates & Qt::WindowActive;
const QRect surfaceRect = windowContentGeometry();
const QColor borderColor = active ? m_borderColor : m_borderInactiveColor;

Expand Down Expand Up @@ -783,14 +783,14 @@ void QGnomePlatformDecoration::processMouseRight(QWaylandInputDevice *inputDevic

void QGnomePlatformDecoration::renderButton(QPainter *painter, const QRectF &rect, Adwaita::ButtonType button, bool renderFrame, bool sunken)
{
Qt::WindowStates windowStates;
#ifdef DECORATION_SHADOWS_SUPPORT // Qt 6.2.0+ or patched QtWayland
windowStates = waylandWindow()->windowStates();
const Qt::WindowStates windowStates = waylandWindow()->windowStates();
const bool active = windowStates & Qt::WindowActive;
#else
windowStates = window()->windowStates();
const Qt::WindowStates windowStates = window()->windowStates();
const bool active = window()->handle()->isActive();
#endif

const bool active = windowStates & Qt::WindowActive;
Adwaita::StyleOptions decorationButtonStyle(painter, QRect());
decorationButtonStyle.setColor(active ? m_foregroundColor : m_foregroundInactiveColor);

Expand Down

0 comments on commit ba82069

Please sign in to comment.