93e0265e4e
Once in a while, we receive complaints from other fellow KDE developers about the file organization of kwin. This change addresses some of those complaints by moving all of source code in a separate directory, src/, thus making the project structure more traditional. Things such as tests are kept in their own toplevel directories. This change may wreak havoc on merge requests that add new files to kwin, but if a patch modifies an already existing file, git should be smart enough to figure out that the file has been relocated. We may potentially split the src/ directory further to make navigating the source code easier, but hopefully this is good enough already.
81 lines
2.6 KiB
C++
81 lines
2.6 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
*/
|
|
|
|
#include "windowshadow.h"
|
|
|
|
#include <QVariant>
|
|
|
|
Q_DECLARE_METATYPE(QMargins)
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
bool WindowShadowTile::create()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void WindowShadowTile::destroy()
|
|
{
|
|
}
|
|
|
|
bool WindowShadow::create()
|
|
{
|
|
// TODO: Perhaps we set way too many properties here. Alternatively we could put all shadow tiles
|
|
// in one big image and attach it rather than 8 separate images.
|
|
if (leftTile) {
|
|
window->setProperty("kwin_shadow_left_tile", QVariant::fromValue(leftTile->image()));
|
|
}
|
|
if (topLeftTile) {
|
|
window->setProperty("kwin_shadow_top_left_tile", QVariant::fromValue(topLeftTile->image()));
|
|
}
|
|
if (topTile) {
|
|
window->setProperty("kwin_shadow_top_tile", QVariant::fromValue(topTile->image()));
|
|
}
|
|
if (topRightTile) {
|
|
window->setProperty("kwin_shadow_top_right_tile", QVariant::fromValue(topRightTile->image()));
|
|
}
|
|
if (rightTile) {
|
|
window->setProperty("kwin_shadow_right_tile", QVariant::fromValue(rightTile->image()));
|
|
}
|
|
if (bottomRightTile) {
|
|
window->setProperty("kwin_shadow_bottom_right_tile", QVariant::fromValue(bottomRightTile->image()));
|
|
}
|
|
if (bottomTile) {
|
|
window->setProperty("kwin_shadow_bottom_tile", QVariant::fromValue(bottomTile->image()));
|
|
}
|
|
if (bottomLeftTile) {
|
|
window->setProperty("kwin_shadow_bottom_left_tile", QVariant::fromValue(bottomLeftTile->image()));
|
|
}
|
|
window->setProperty("kwin_shadow_padding", QVariant::fromValue(padding));
|
|
|
|
// Notice that the enabled property must be set last.
|
|
window->setProperty("kwin_shadow_enabled", QVariant::fromValue(true));
|
|
|
|
return true;
|
|
}
|
|
|
|
void WindowShadow::destroy()
|
|
{
|
|
// Attempting to uninstall the shadow after the decorated window has been destroyed. It's doomed.
|
|
if (!window) {
|
|
return;
|
|
}
|
|
|
|
// Remove relevant shadow properties.
|
|
window->setProperty("kwin_shadow_left_tile", {});
|
|
window->setProperty("kwin_shadow_top_left_tile", {});
|
|
window->setProperty("kwin_shadow_top_tile", {});
|
|
window->setProperty("kwin_shadow_top_right_tile", {});
|
|
window->setProperty("kwin_shadow_right_tile", {});
|
|
window->setProperty("kwin_shadow_bottom_right_tile", {});
|
|
window->setProperty("kwin_shadow_bottom_tile", {});
|
|
window->setProperty("kwin_shadow_bottom_left_tile", {});
|
|
window->setProperty("kwin_shadow_padding", {});
|
|
window->setProperty("kwin_shadow_enabled", {});
|
|
}
|
|
|
|
} // namespace KWin
|