Add kwin full source tree, greeter login, zsh, pcid service, and build system improvements

This commit is contained in:
2026-04-26 22:31:07 +01:00
parent d4a6b356eb
commit 70a84cefee
3416 changed files with 1360518 additions and 10522 deletions
@@ -0,0 +1,10 @@
set(kwindowsystem_plugin_SRCS
plugin.cpp
windoweffects.cpp
windowshadow.cpp
windowsystem.cpp
)
add_library(KF6WindowSystemKWinPlugin OBJECT ${kwindowsystem_plugin_SRCS})
target_compile_definitions(KF6WindowSystemKWinPlugin PRIVATE QT_STATICPLUGIN)
target_link_libraries(KF6WindowSystemKWinPlugin kwin)
@@ -0,0 +1,3 @@
{
"platforms": ["wayland-org.kde.kwin.qpa"]
}
@@ -0,0 +1,40 @@
/*
SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "plugin.h"
#include "windoweffects.h"
#include "windowshadow.h"
#include "windowsystem.h"
KWindowSystemKWinPlugin::KWindowSystemKWinPlugin(QObject *parent)
: KWindowSystemPluginInterface(parent)
{
}
KWindowSystemKWinPlugin::~KWindowSystemKWinPlugin()
{
}
KWindowEffectsPrivate *KWindowSystemKWinPlugin::createEffects()
{
return new KWin::WindowEffects();
}
KWindowSystemPrivate *KWindowSystemKWinPlugin::createWindowSystem()
{
return new KWin::WindowSystem();
}
KWindowShadowTilePrivate *KWindowSystemKWinPlugin::createWindowShadowTile()
{
return new KWin::WindowShadowTile();
}
KWindowShadowPrivate *KWindowSystemKWinPlugin::createWindowShadow()
{
return new KWin::WindowShadow();
}
#include "moc_plugin.cpp"
@@ -0,0 +1,24 @@
/*
SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <private/kwindowsystemplugininterface_p.h>
class KWindowSystemKWinPlugin : public KWindowSystemPluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID KWindowSystemPluginInterface_iid FILE "kwindowsystem.json")
Q_INTERFACES(KWindowSystemPluginInterface)
public:
explicit KWindowSystemKWinPlugin(QObject *parent = nullptr);
~KWindowSystemKWinPlugin() override;
KWindowEffectsPrivate *createEffects() override;
KWindowSystemPrivate *createWindowSystem() override;
KWindowShadowTilePrivate *createWindowShadowTile() override;
KWindowShadowPrivate *createWindowShadow() override;
};
@@ -0,0 +1,75 @@
/*
SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "windoweffects.h"
#include "effect/effecthandler.h"
#include <QGuiApplication>
#include <QWidget>
#include <QWindow>
Q_DECLARE_METATYPE(KWindowEffects::SlideFromLocation)
namespace KWin
{
WindowEffects::WindowEffects()
: QObject()
, KWindowEffectsPrivate()
{
}
WindowEffects::~WindowEffects()
{
}
bool WindowEffects::isEffectAvailable(KWindowEffects::Effect effect)
{
if (!effects) {
return false;
}
switch (effect) {
case KWindowEffects::BackgroundContrast:
return effects->isEffectLoaded(QStringLiteral("contrast"));
case KWindowEffects::BlurBehind:
return effects->isEffectLoaded(QStringLiteral("blur"));
case KWindowEffects::Slide:
return effects->isEffectLoaded(QStringLiteral("slidingpopups"));
default:
// plugin does not provide integration for other effects
return false;
}
}
void WindowEffects::slideWindow(QWindow *window, KWindowEffects::SlideFromLocation location, int offset)
{
window->setProperty("kwin_slide", QVariant::fromValue(location));
window->setProperty("kwin_slide_offset", offset);
}
void WindowEffects::enableBlurBehind(QWindow *window, bool enable, const QRegion &region)
{
if (enable) {
window->setProperty("kwin_blur", region);
} else {
window->setProperty("kwin_blur", {});
}
}
void WindowEffects::enableBackgroundContrast(QWindow *window, bool enable, qreal contrast, qreal intensity, qreal saturation, const QRegion &region)
{
if (enable) {
window->setProperty("kwin_background_region", region);
window->setProperty("kwin_background_contrast", contrast);
window->setProperty("kwin_background_intensity", intensity);
window->setProperty("kwin_background_saturation", saturation);
} else {
window->setProperty("kwin_background_region", {});
window->setProperty("kwin_background_contrast", {});
window->setProperty("kwin_background_intensity", {});
window->setProperty("kwin_background_saturation", {});
}
}
}
@@ -0,0 +1,26 @@
/*
SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <QObject>
#include <kwindowsystem_version.h>
#include <private/kwindoweffects_p.h>
namespace KWin
{
class WindowEffects : public QObject, public KWindowEffectsPrivate
{
public:
WindowEffects();
~WindowEffects() override;
bool isEffectAvailable(KWindowEffects::Effect effect) override;
void slideWindow(QWindow *window, KWindowEffects::SlideFromLocation location, int offset) override;
void enableBlurBehind(QWindow *window, bool enable = true, const QRegion &region = QRegion()) override;
void enableBackgroundContrast(QWindow *window, bool enable = true, qreal contrast = 1, qreal intensity = 1, qreal saturation = 1, const QRegion &region = QRegion()) override;
};
}
@@ -0,0 +1,81 @@
/*
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
@@ -0,0 +1,28 @@
/*
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
*/
#pragma once
#include <private/kwindowshadow_p.h>
namespace KWin
{
class WindowShadowTile final : public KWindowShadowTilePrivate
{
public:
bool create() override;
void destroy() override;
};
class WindowShadow final : public KWindowShadowPrivate
{
public:
bool create() override;
void destroy() override;
};
} // namespace KWin
@@ -0,0 +1,88 @@
/*
SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "windowsystem.h"
#include <KWaylandExtras>
#include <KWindowSystem>
#include <QGuiApplication>
#include <QWindow>
#include <wayland/display.h>
#include <wayland/seat.h>
#include <wayland_server.h>
#include <window.h>
#include <workspace.h>
#include <xdgactivationv1.h>
Q_DECLARE_METATYPE(NET::WindowType)
namespace KWin
{
WindowSystem::WindowSystem()
: QObject()
, KWindowSystemPrivateV2()
{
}
void WindowSystem::activateWindow(QWindow *win, long int time)
{
// KWin cannot activate own windows
}
void WindowSystem::setShowingDesktop(bool showing)
{
// KWin should not use KWindowSystem to set showing desktop state
}
bool WindowSystem::showingDesktop()
{
// KWin should not use KWindowSystem for showing desktop state
return false;
}
void WindowSystem::requestToken(QWindow *win, uint32_t serial, const QString &appId)
{
auto seat = KWin::waylandServer()->seat();
auto token = KWin::waylandServer()->xdgActivationIntegration()->requestPrivilegedToken(nullptr, seat->display()->serial(), seat, appId);
// Ensure that xdgActivationTokenArrived is always emitted asynchronously
QTimer::singleShot(0, [serial, token] {
Q_EMIT KWaylandExtras::self()->xdgActivationTokenArrived(serial, token);
});
}
void WindowSystem::setCurrentToken(const QString &token)
{
// KWin cannot activate own windows
}
quint32 WindowSystem::lastInputSerial(QWindow *window)
{
auto w = workspace()->findInternal(window);
if (!w) {
return 0;
}
return w->lastUsageSerial();
}
void WindowSystem::exportWindow(QWindow *window)
{
Q_UNUSED(window);
}
void WindowSystem::unexportWindow(QWindow *window)
{
Q_UNUSED(window);
}
void WindowSystem::setMainWindow(QWindow *window, const QString &handle)
{
Q_UNUSED(window);
Q_UNUSED(handle);
}
}
#include "moc_windowsystem.cpp"
@@ -0,0 +1,31 @@
/*
SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <private/kwindowsystem_p.h>
#include <QObject>
namespace KWin
{
class WindowSystem : public QObject, public KWindowSystemPrivateV2
{
Q_OBJECT
public:
WindowSystem();
void activateWindow(QWindow *win, long time) override;
bool showingDesktop() override;
void setShowingDesktop(bool showing) override;
void requestToken(QWindow *win, uint32_t serial, const QString &app_id) override;
void setCurrentToken(const QString &token) override;
quint32 lastInputSerial(QWindow *window) override;
void exportWindow(QWindow *window) override;
void unexportWindow(QWindow *window) override;
void setMainWindow(QWindow *window, const QString &handle) override;
};
}