Commit 7f3ae29b authored by Vlad Zahorodnii's avatar Vlad Zahorodnii Committed by Vlad Zahorodnii

[kstyle] Port to KWindowSystem shadows API

The primary task of a compositor is to take a bunch of buffers from
different clients and present them on the screen. However, the compositor
may need to present its own stuff on the screen as well.

On X11, internal clients (the ones created by KWin) are backed by real
windows. This looks a bit clumsy since KWin uses X11 to communicate with

On Wayland, we use our own QPA that talks to KWin directly. Given that
internal clients with the custom QPA are no longer backed by wayland
surfaces or x11 windows, things like blur, background contrast, and
shadows must be set through KWindowSystem APIs so KWin can catch the
relevant API calls and handle them accordingly.

The good thing is that we get rid of a good portion of platform-specific
code. The bad thing is that we still need to be cautious about QPAs that
destroy the underlying platform resources upon a window becoming hidden.

Reviewers: #kwin, #plasma, mart

Reviewed By: #plasma, mart

Subscribers: mart, plasma-devel

Tags: #plasma

Maniphest Tasks: T12496

Differential Revision:
parent 2df91ac9
This diff is collapsed.
......@@ -3,6 +3,7 @@
* Copyright (C) 2014 by Hugo Pereira Da Costa <> *
* Copyright (C) 2020 by Vlad Zahorodnii <> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -21,28 +22,14 @@
#include "breezetileset.h"
#include "config-breeze.h"
#include <KWindowShadow>
#include <QObject>
#include <QPointer>
#include <QMap>
#include <QMargins>
#include <xcb/xcb.h>
namespace KWayland
namespace Client
class ShadowManager;
class ShmPool;
class Surface;
#include <QSet>
namespace Breeze
......@@ -131,9 +118,6 @@ namespace Breeze
//* unregister widget
void objectDeleted( QObject* );
//* initializes the Wayland specific parts
void initializeWayland();
//* true if widget is a menu
......@@ -151,33 +135,17 @@ namespace Breeze
//* accept widget
bool acceptWidget( QWidget* ) const;
// create pixmap handles from tileset
const QVector<quint32>& createPixmapHandles();
// create shared shadow tiles from tileset
const QVector<KWindowShadowTile::Ptr>& createShadowTiles();
// create pixmap handle from pixmap
quint32 createPixmap( const QPixmap& );
// create shadow tile from pixmap
KWindowShadowTile::Ptr createTile( const QPixmap& );
//* installs shadow on given widget in a platform independent way
bool installShadows( QWidget * );
void installShadows( QWidget * );
//* uninstalls shadow on given widget in a platform independent way
void uninstallShadows( QWidget * ) const;
//* install shadow X11 property on given widget
shadow atom and property specification available at
bool installX11Shadows( QWidget* );
//* uninstall shadow X11 property on given widget
void uninstallX11Shadows( QWidget* ) const;
//* install shadow on given widget for Wayland
bool installWaylandShadows( QWidget * );
//* uninstall shadow on given widget for Wayland
void uninstallWaylandShadows( QWidget* ) const;
void uninstallShadows( QWidget * );
//* gets the shadow margins for the given widget
QMargins shadowMargins( QWidget* ) const;
......@@ -188,38 +156,19 @@ namespace Breeze
Helper& _helper;
//* registered widgets
QMap<QWidget*, WId> _widgets;
QSet<QWidget*> _widgets;
//* managed shadows
QMap<QWidget*, KWindowShadow*> _shadows;
//* tileset
TileSet _shadowTiles;
//* number of pixmaps
enum { numPixmaps = 8 };
//* pixmaps
QVector<quint32> _pixmaps;
//* graphical context
xcb_gcontext_t _gc = 0;
//* shadow atom
xcb_atom_t _atom = 0;
//* registered widgets to wayland surface mappings
QMap<QWidget*, KWayland::Client::Surface *> _widgetSurfaces;
//* The Wayland shadow manager to create Shadows for Surfaces (QWindow)
QPointer<KWayland::Client::ShadowManager> _shadowManager;
//* number of tiles
enum { numTiles = 8 };
//* The Wayland Shared memory pool to share the shadow pixmaps with compositor
QPointer<KWayland::Client::ShmPool> _shmPool;
//* shared shadow tiles
QVector<KWindowShadowTile::Ptr> _tiles;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment