Merge EffectsHandlerImpl and EffectsHandler

This commit is contained in:
Vlad Zahorodnii 2023-11-15 11:51:56 +02:00
parent d0158ec588
commit 15b47ce7fc
53 changed files with 1975 additions and 2284 deletions

View file

@ -10,7 +10,7 @@
#include "compositor.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "scripting/scriptedeffect.h"
#include "wayland_server.h"
#include "window.h"
@ -80,7 +80,7 @@ void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
QVERIFY(QMetaObject::invokeMethod(*it, "effectLoaded", Q_ARG(KWin::Effect *, effect), Q_ARG(QString, QStringLiteral("crashy"))));
break;
}
QVERIFY(static_cast<EffectsHandlerImpl *>(effects)->isEffectLoaded(QStringLiteral("crashy")));
QVERIFY(effects->isEffectLoaded(QStringLiteral("crashy")));
// create a window
std::unique_ptr<KWayland::Client::Surface> surface{Test::createSurface()};

View file

@ -12,7 +12,7 @@
#include "compositor.h"
#include "core/output.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "wayland_server.h"
#include "window.h"
#include "workspace.h"
@ -81,10 +81,8 @@ void DontCrashReinitializeCompositorTest::init()
void DontCrashReinitializeCompositorTest::cleanup()
{
// Unload all effects.
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
effectsImpl->unloadAllEffects();
QVERIFY(effectsImpl->loadedEffects().isEmpty());
effects->unloadAllEffects();
QVERIFY(effects->loadedEffects().isEmpty());
Test::destroyWaylandConnection();
}
@ -104,10 +102,6 @@ void DontCrashReinitializeCompositorTest::testReinitializeCompositor()
// have been changed while a scripted effect animates the disappearing of
// a window.
// Make sure that we have the right effects ptr.
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
// Create the test window.
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
@ -118,10 +112,10 @@ void DontCrashReinitializeCompositorTest::testReinitializeCompositor()
// Make sure that only the test effect is loaded.
QFETCH(QString, effectName);
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());

View file

@ -10,7 +10,7 @@
#include "kwin_wayland_test.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "virtualdesktops.h"
#include "wayland_server.h"
#include "window.h"
@ -74,10 +74,9 @@ void DesktopSwitchingAnimationTest::init()
void DesktopSwitchingAnimationTest::cleanup()
{
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
effectsImpl->unloadAllEffects();
QVERIFY(effectsImpl->loadedEffects().isEmpty());
QVERIFY(effects);
effects->unloadAllEffects();
QVERIFY(effects->loadedEffects().isEmpty());
VirtualDesktopManager::self()->setCount(1);
@ -115,12 +114,11 @@ void DesktopSwitchingAnimationTest::testSwitchDesktops()
// Load effect that will be tested.
QFETCH(QString, effectName);
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());

View file

@ -11,7 +11,7 @@
#include "compositor.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "scene/workspacescene.h"
#include "wayland_server.h"
#include "window.h"
@ -74,10 +74,9 @@ void MaximizeAnimationTest::init()
void MaximizeAnimationTest::cleanup()
{
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
effectsImpl->unloadAllEffects();
QVERIFY(effectsImpl->loadedEffects().isEmpty());
QVERIFY(effects);
effects->unloadAllEffects();
QVERIFY(effects->loadedEffects().isEmpty());
Test::destroyWaylandConnection();
}
@ -123,12 +122,11 @@ void MaximizeAnimationTest::testMaximizeRestore()
// Load effect that will be tested.
const QString effectName = QStringLiteral("maximize");
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());

View file

@ -10,7 +10,7 @@
#include "kwin_wayland_test.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "wayland_server.h"
#include "window.h"
#include "workspace.h"
@ -74,10 +74,9 @@ void MinimizeAnimationTest::init()
void MinimizeAnimationTest::cleanup()
{
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
effectsImpl->unloadAllEffects();
QVERIFY(effectsImpl->loadedEffects().isEmpty());
QVERIFY(effects);
effects->unloadAllEffects();
QVERIFY(effects->loadedEffects().isEmpty());
Test::destroyWaylandConnection();
}
@ -134,12 +133,11 @@ void MinimizeAnimationTest::testMinimizeUnminimize()
// Load effect that will be tested.
QFETCH(QString, effectName);
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());

View file

@ -10,8 +10,8 @@
#include "kwin_wayland_test.h"
#include "effectloader.h"
#include "effects.h"
#include "internalwindow.h"
#include "libkwineffects/kwineffects.h"
#include "useractions.h"
#include "wayland_server.h"
#include "window.h"
@ -76,10 +76,9 @@ void PopupOpenCloseAnimationTest::init()
void PopupOpenCloseAnimationTest::cleanup()
{
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
effectsImpl->unloadAllEffects();
QVERIFY(effectsImpl->loadedEffects().isEmpty());
QVERIFY(effects);
effects->unloadAllEffects();
QVERIFY(effects->loadedEffects().isEmpty());
Test::destroyWaylandConnection();
}
@ -89,10 +88,6 @@ void PopupOpenCloseAnimationTest::testAnimatePopups()
// This test verifies that popup open/close animation effects try
// to animate popups(e.g. popup menus, tooltips, etc).
// Make sure that we have the right effects ptr.
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
// Create the main window.
std::unique_ptr<KWayland::Client::Surface> mainWindowSurface(Test::createSurface());
QVERIFY(mainWindowSurface != nullptr);
@ -103,10 +98,10 @@ void PopupOpenCloseAnimationTest::testAnimatePopups()
// Load effect that will be tested.
const QString effectName = QStringLiteral("fadingpopups");
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());
@ -149,10 +144,6 @@ void PopupOpenCloseAnimationTest::testAnimateUserActionsPopup()
// This test verifies that popup open/close animation effects try
// to animate the user actions popup.
// Make sure that we have the right effects ptr.
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
// Create the test window.
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
@ -163,10 +154,10 @@ void PopupOpenCloseAnimationTest::testAnimateUserActionsPopup()
// Load effect that will be tested.
const QString effectName = QStringLiteral("fadingpopups");
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());
@ -200,10 +191,6 @@ void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
// This test verifies that popup open/close animation effects try
// to animate decoration tooltips.
// Make sure that we have the right effects ptr.
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
// Create the test window.
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
QVERIFY(surface != nullptr);
@ -224,10 +211,10 @@ void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
// Load effect that will be tested.
const QString effectName = QStringLiteral("fadingpopups");
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());

View file

@ -10,8 +10,8 @@
#include "kwin_wayland_test.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/anidata_p.h"
#include "libkwineffects/kwineffects.h"
#include "scripting/scriptedeffect.h"
#include "virtualdesktops.h"
#include "wayland_server.h"
@ -104,7 +104,7 @@ bool ScriptedEffectWithDebugSpy::load(const QString &name)
return false;
}
// inject our newly created effect to be registered with the EffectsHandlerImpl::loaded_effects
// inject our newly created effect to be registered with the EffectsHandler::loaded_effects
// this is private API so some horrible code is used to find the internal effectloader
// and register ourselves
auto children = effects->children();
@ -116,7 +116,7 @@ bool ScriptedEffectWithDebugSpy::load(const QString &name)
break;
}
return (static_cast<EffectsHandlerImpl *>(effects)->isEffectLoaded(name));
return effects->isEffectLoaded(name);
}
void ScriptedEffectsTest::initTestCase()
@ -159,9 +159,8 @@ void ScriptedEffectsTest::cleanup()
{
Test::destroyWaylandConnection();
auto effectsImpl = static_cast<EffectsHandlerImpl *>(effects);
effectsImpl->unloadAllEffects();
QVERIFY(effectsImpl->loadedEffects().isEmpty());
effects->unloadAllEffects();
QVERIFY(effects->loadedEffects().isEmpty());
KWin::VirtualDesktopManager::self()->setCurrent(1);
}

View file

@ -7,8 +7,8 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "effectloader.h"
#include "effects.h"
#include "kwin_wayland_test.h"
#include "libkwineffects/kwineffects.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11window.h"
@ -85,11 +85,10 @@ void SlidingPopupsTest::init()
void SlidingPopupsTest::cleanup()
{
Test::destroyWaylandConnection();
EffectsHandlerImpl *e = static_cast<EffectsHandlerImpl *>(effects);
while (!e->loadedEffects().isEmpty()) {
const QString effect = e->loadedEffects().first();
e->unloadEffect(effect);
QVERIFY(!e->isEffectLoaded(effect));
while (!effects->loadedEffects().isEmpty()) {
const QString effect = effects->loadedEffects().first();
effects->unloadEffect(effect);
QVERIFY(!effects->isEffectLoaded(effect));
}
}
@ -117,9 +116,8 @@ void SlidingPopupsTest::testWithOtherEffect()
// this test verifies that slidingpopups effect grabs the window added role
// independently of the sequence how the effects are loaded.
// see BUG 336866
EffectsHandlerImpl *e = static_cast<EffectsHandlerImpl *>(effects);
// find the effectsloader
auto effectloader = e->findChild<AbstractEffectLoader *>();
auto effectloader = effects->findChild<AbstractEffectLoader *>();
QVERIFY(effectloader);
QSignalSpy effectLoadedSpy(effectloader, &AbstractEffectLoader::effectLoaded);
@ -127,9 +125,9 @@ void SlidingPopupsTest::testWithOtherEffect()
Effect *otherEffect = nullptr;
QFETCH(QStringList, effectsToLoad);
for (const QString &effectName : effectsToLoad) {
QVERIFY(!e->isEffectLoaded(effectName));
QVERIFY(e->loadEffect(effectName));
QVERIFY(e->isEffectLoaded(effectName));
QVERIFY(!effects->isEffectLoaded(effectName));
QVERIFY(effects->loadEffect(effectName));
QVERIFY(effects->isEffectLoaded(effectName));
QCOMPARE(effectLoadedSpy.count(), 1);
Effect *effect = effectLoadedSpy.first().first().value<Effect *>();
@ -245,9 +243,8 @@ void SlidingPopupsTest::testWithOtherEffectWayland()
// independently of the sequence how the effects are loaded.
// see BUG 336866
// the test is like testWithOtherEffect, but simulates using a Wayland window
EffectsHandlerImpl *e = static_cast<EffectsHandlerImpl *>(effects);
// find the effectsloader
auto effectloader = e->findChild<AbstractEffectLoader *>();
auto effectloader = effects->findChild<AbstractEffectLoader *>();
QVERIFY(effectloader);
QSignalSpy effectLoadedSpy(effectloader, &AbstractEffectLoader::effectLoaded);
@ -255,9 +252,9 @@ void SlidingPopupsTest::testWithOtherEffectWayland()
Effect *otherEffect = nullptr;
QFETCH(QStringList, effectsToLoad);
for (const QString &effectName : effectsToLoad) {
QVERIFY(!e->isEffectLoaded(effectName));
QVERIFY(e->loadEffect(effectName));
QVERIFY(e->isEffectLoaded(effectName));
QVERIFY(!effects->isEffectLoaded(effectName));
QVERIFY(effects->loadEffect(effectName));
QVERIFY(effects->isEffectLoaded(effectName));
QCOMPARE(effectLoadedSpy.count(), 1);
Effect *effect = effectLoadedSpy.first().first().value<Effect *>();

View file

@ -10,7 +10,7 @@
#include "kwin_wayland_test.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "wayland_server.h"
#include "window.h"
#include "workspace.h"
@ -75,10 +75,8 @@ void ToplevelOpenCloseAnimationTest::init()
void ToplevelOpenCloseAnimationTest::cleanup()
{
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
effectsImpl->unloadAllEffects();
QVERIFY(effectsImpl->loadedEffects().isEmpty());
effects->unloadAllEffects();
QVERIFY(effects->loadedEffects().isEmpty());
Test::destroyWaylandConnection();
}
@ -97,16 +95,12 @@ void ToplevelOpenCloseAnimationTest::testAnimateToplevels()
// This test verifies that window open/close animation effects try to
// animate the appearing and the disappearing of toplevel windows.
// Make sure that we have the right effects ptr.
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
// Load effect that will be tested.
QFETCH(QString, effectName);
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());
@ -148,10 +142,6 @@ void ToplevelOpenCloseAnimationTest::testDontAnimatePopups()
// This test verifies that window open/close animation effects don't try
// to animate popups(e.g. popup menus, tooltips, etc).
// Make sure that we have the right effects ptr.
auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
QVERIFY(effectsImpl);
// Create the main window.
std::unique_ptr<KWayland::Client::Surface> mainWindowSurface(Test::createSurface());
QVERIFY(mainWindowSurface != nullptr);
@ -162,10 +152,10 @@ void ToplevelOpenCloseAnimationTest::testDontAnimatePopups()
// Load effect that will be tested.
QFETCH(QString, effectName);
QVERIFY(effectsImpl->loadEffect(effectName));
QCOMPARE(effectsImpl->loadedEffects().count(), 1);
QCOMPARE(effectsImpl->loadedEffects().first(), effectName);
Effect *effect = effectsImpl->findEffect(effectName);
QVERIFY(effects->loadEffect(effectName));
QCOMPARE(effects->loadedEffects().count(), 1);
QCOMPARE(effects->loadedEffects().first(), effectName);
Effect *effect = effects->findEffect(effectName);
QVERIFY(effect);
QVERIFY(!effect->isActive());

View file

@ -10,7 +10,7 @@
#include "compositor.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "pointer_input.h"
#include "virtualdesktops.h"
#include "wayland_server.h"
@ -73,16 +73,14 @@ void TranslucencyTest::initTestCase()
void TranslucencyTest::init()
{
// load the translucency effect
EffectsHandlerImpl *e = static_cast<EffectsHandlerImpl *>(effects);
// find the effectsloader
auto effectloader = e->findChild<AbstractEffectLoader *>();
auto effectloader = effects->findChild<AbstractEffectLoader *>();
QVERIFY(effectloader);
QSignalSpy effectLoadedSpy(effectloader, &AbstractEffectLoader::effectLoaded);
QVERIFY(!e->isEffectLoaded(QStringLiteral("translucency")));
QVERIFY(e->loadEffect(QStringLiteral("translucency")));
QVERIFY(e->isEffectLoaded(QStringLiteral("translucency")));
QVERIFY(!effects->isEffectLoaded(QStringLiteral("translucency")));
QVERIFY(effects->loadEffect(QStringLiteral("translucency")));
QVERIFY(effects->isEffectLoaded(QStringLiteral("translucency")));
QCOMPARE(effectLoadedSpy.count(), 1);
m_translucencyEffect = effectLoadedSpy.first().first().value<Effect *>();
@ -91,11 +89,10 @@ void TranslucencyTest::init()
void TranslucencyTest::cleanup()
{
EffectsHandlerImpl *e = static_cast<EffectsHandlerImpl *>(effects);
if (e->isEffectLoaded(QStringLiteral("translucency"))) {
e->unloadEffect(QStringLiteral("translucency"));
if (effects->isEffectLoaded(QStringLiteral("translucency"))) {
effects->unloadEffect(QStringLiteral("translucency"));
}
QVERIFY(!e->isEffectLoaded(QStringLiteral("translucency")));
QVERIFY(!effects->isEffectLoaded(QStringLiteral("translucency")));
m_translucencyEffect = nullptr;
}

View file

@ -10,7 +10,7 @@
#include "cursor.h"
#include "effectloader.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11window.h"
@ -80,17 +80,15 @@ void WobblyWindowsShadeTest::cleanup()
{
Test::destroyWaylandConnection();
auto effectsImpl = static_cast<EffectsHandlerImpl *>(effects);
effectsImpl->unloadAllEffects();
QVERIFY(effectsImpl->loadedEffects().isEmpty());
effects->unloadAllEffects();
QVERIFY(effects->loadedEffects().isEmpty());
}
void WobblyWindowsShadeTest::testShadeMove()
{
// this test simulates the condition from BUG 390953
EffectsHandlerImpl *e = static_cast<EffectsHandlerImpl *>(effects);
QVERIFY(e->loadEffect(QStringLiteral("wobblywindows")));
QVERIFY(e->isEffectLoaded(QStringLiteral("wobblywindows")));
QVERIFY(effects->loadEffect(QStringLiteral("wobblywindows")));
QVERIFY(effects->isEffectLoaded(QStringLiteral("wobblywindows")));
Test::XcbConnectionPtr c = Test::createX11Connection();
QVERIFY(!xcb_connection_has_error(c.get()));

View file

@ -9,7 +9,6 @@
#include "kwin_wayland_test.h"
#include "core/output.h"
#include "effects.h"
#include "inputmethod.h"
#include "keyboard_input.h"
#include "pointer_input.h"

View file

@ -9,8 +9,8 @@
#include "kwin_wayland_test.h"
#include "core/output.h"
#include "effects.h"
#include "internalwindow.h"
#include "libkwineffects/kwineffects.h"
#include "pointer_input.h"
#include "wayland/surface.h"
#include "wayland_server.h"

View file

@ -11,8 +11,8 @@
#include "backends/virtual/virtual_backend.h"
#include "compositor_wayland.h"
#include "core/session.h"
#include "effects.h"
#include "inputmethod.h"
#include "libkwineffects/kwineffects.h"
#include "placement.h"
#include "pluginmanager.h"
#include "utils/xcbutils.h"
@ -82,7 +82,7 @@ WaylandTestApplication::~WaylandTestApplication()
// need to unload all effects prior to destroying X connection as they might do X calls
// also before destroy Workspace, as effects might call into Workspace
if (effects) {
static_cast<EffectsHandlerImpl *>(effects)->unloadAllEffects();
effects->unloadAllEffects();
}
m_xwayland.reset();
destroyVirtualInputDevices();

View file

@ -12,7 +12,6 @@
#include "atoms.h"
#include "core/output.h"
#include "cursor.h"
#include "effects.h"
#include "placement.h"
#include "pointer_input.h"
#include "wayland_server.h"

View file

@ -12,7 +12,6 @@
#include "compositor.h"
#include "cursor.h"
#include "effectloader.h"
#include "effects.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11window.h"

View file

@ -12,7 +12,6 @@
#include "core/output.h"
#include "decorations/decorationbridge.h"
#include "decorations/settings.h"
#include "effects.h"
#include "pointer_input.h"
#include "virtualdesktops.h"
#include "wayland/clientconnection.h"

View file

@ -82,7 +82,6 @@ target_sources(kwin PRIVATE
decorations/settings.cpp
dpmsinputeventfilter.cpp
effectloader.cpp
effects.cpp
events.cpp
focuschain.cpp
ftrace.cpp
@ -295,7 +294,7 @@ set(kwin_dbus_SRCS)
qt_add_dbus_adaptor(kwin_dbus_SRCS scripting/org.kde.kwin.Script.xml scripting/scripting.h KWin::AbstractScript)
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface)
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface)
qt_add_dbus_adaptor(kwin_dbus_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsHandlerImpl)
qt_add_dbus_adaptor(kwin_dbus_SRCS ${kwin_effects_dbus_xml} libkwineffects/kwineffects.h KWin::EffectsHandler)
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface)
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager)
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.Plugins.xml dbusinterface.h KWin::PluginManagerDBusInterface)

View file

@ -254,7 +254,7 @@ std::unique_ptr<OutlineVisual> X11StandaloneBackend::createOutline(Outline *outl
void X11StandaloneBackend::createEffectsHandler(Compositor *compositor, WorkspaceScene *scene)
{
new EffectsHandlerImplX11(compositor, scene);
new EffectsHandlerX11(compositor, scene);
}
QList<CompositingType> X11StandaloneBackend::supportedCompositors() const

View file

@ -20,19 +20,19 @@
namespace KWin
{
EffectsHandlerImplX11::EffectsHandlerImplX11(Compositor *compositor, WorkspaceScene *scene)
: EffectsHandlerImpl(compositor, scene)
EffectsHandlerX11::EffectsHandlerX11(Compositor *compositor, WorkspaceScene *scene)
: EffectsHandler(compositor, scene)
{
connect(this, &EffectsHandlerImpl::virtualScreenGeometryChanged, this, [this]() {
connect(this, &EffectsHandler::virtualScreenGeometryChanged, this, [this]() {
if (m_mouseInterceptionWindow.isValid()) {
m_mouseInterceptionWindow.setGeometry(virtualScreenGeometry());
}
});
}
EffectsHandlerImplX11::~EffectsHandlerImplX11()
EffectsHandlerX11::~EffectsHandlerX11()
{
// EffectsHandlerImpl tries to unload all effects when it's destroyed.
// EffectsHandler tries to unload all effects when it's destroyed.
// The routine that unloads effects makes some calls (indirectly) to
// doUngrabKeyboard and doStopMouseInterception, which are virtual.
// Given that any call to a virtual function in the destructor of a base
@ -42,7 +42,7 @@ EffectsHandlerImplX11::~EffectsHandlerImplX11()
unloadAllEffects();
}
bool EffectsHandlerImplX11::doGrabKeyboard()
bool EffectsHandlerX11::doGrabKeyboard()
{
auto keyboard = static_cast<X11StandaloneBackend *>(kwinApp()->outputBackend())->keyboard();
if (!keyboard->xkbKeymap()) {
@ -56,13 +56,13 @@ bool EffectsHandlerImplX11::doGrabKeyboard()
return ret;
}
void EffectsHandlerImplX11::doUngrabKeyboard()
void EffectsHandlerX11::doUngrabKeyboard()
{
ungrabXKeyboard();
m_x11KeyboardInterception.reset();
}
void EffectsHandlerImplX11::doStartMouseInterception(Qt::CursorShape shape)
void EffectsHandlerX11::doStartMouseInterception(Qt::CursorShape shape)
{
// NOTE: it is intended to not perform an XPointerGrab on X11. See documentation in kwineffects.h
// The mouse grab is implemented by using a full screen input only window
@ -86,14 +86,14 @@ void EffectsHandlerImplX11::doStartMouseInterception(Qt::CursorShape shape)
workspace()->screenEdges()->ensureOnTop();
}
void EffectsHandlerImplX11::doStopMouseInterception()
void EffectsHandlerX11::doStopMouseInterception()
{
m_mouseInterceptionWindow.unmap();
m_x11MouseInterception.reset();
Workspace::self()->stackScreenEdgesUnderOverrideRedirect();
}
void EffectsHandlerImplX11::defineCursor(Qt::CursorShape shape)
void EffectsHandlerX11::defineCursor(Qt::CursorShape shape)
{
const xcb_cursor_t c = Cursors::self()->mouse()->x11Cursor(shape);
if (c != XCB_CURSOR_NONE) {
@ -101,7 +101,7 @@ void EffectsHandlerImplX11::defineCursor(Qt::CursorShape shape)
}
}
void EffectsHandlerImplX11::doCheckInputWindowStacking()
void EffectsHandlerX11::doCheckInputWindowStacking()
{
m_mouseInterceptionWindow.raise();
// Raise electric border windows above the input windows

View file

@ -9,7 +9,7 @@
*/
#pragma once
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "utils/xcbutils.h"
#include <memory.h>
@ -19,12 +19,12 @@ namespace KWin
class EffectsMouseInterceptionX11Filter;
class EffectsKeyboardInterceptionX11Filter;
class EffectsHandlerImplX11 : public EffectsHandlerImpl
class EffectsHandlerX11 : public EffectsHandler
{
Q_OBJECT
public:
explicit EffectsHandlerImplX11(Compositor *compositor, WorkspaceScene *scene);
~EffectsHandlerImplX11() override;
explicit EffectsHandlerX11(Compositor *compositor, WorkspaceScene *scene);
~EffectsHandlerX11() override;
void defineCursor(Qt::CursorShape shape) override;

View file

@ -15,7 +15,7 @@
namespace KWin
{
EffectsKeyboardInterceptionX11Filter::EffectsKeyboardInterceptionX11Filter(EffectsHandlerImpl *effects, X11Keyboard *keyboard)
EffectsKeyboardInterceptionX11Filter::EffectsKeyboardInterceptionX11Filter(EffectsHandler *effects, X11Keyboard *keyboard)
: X11EventFilter(QList<int>{XCB_KEY_PRESS, XCB_KEY_RELEASE})
, m_effects(effects)
, m_keyboard(keyboard)

View file

@ -11,20 +11,20 @@
namespace KWin
{
class EffectsHandlerImpl;
class EffectsHandler;
class X11Keyboard;
class EffectsKeyboardInterceptionX11Filter : public X11EventFilter
{
public:
explicit EffectsKeyboardInterceptionX11Filter(EffectsHandlerImpl *effects, X11Keyboard *keyboard);
explicit EffectsKeyboardInterceptionX11Filter(EffectsHandler *effects, X11Keyboard *keyboard);
bool event(xcb_generic_event_t *event) override;
private:
void processKey(bool press, xcb_keycode_t keycode, xcb_timestamp_t timestamp);
EffectsHandlerImpl *m_effects;
EffectsHandler *m_effects;
X11Keyboard *m_keyboard;
};

View file

@ -7,15 +7,16 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "x11_standalone_effects_mouse_interception_filter.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "utils/common.h"
#include <QCursor>
#include <QMouseEvent>
namespace KWin
{
EffectsMouseInterceptionX11Filter::EffectsMouseInterceptionX11Filter(xcb_window_t window, EffectsHandlerImpl *effects)
EffectsMouseInterceptionX11Filter::EffectsMouseInterceptionX11Filter(xcb_window_t window, EffectsHandler *effects)
: X11EventFilter(QList<int>{XCB_BUTTON_PRESS, XCB_BUTTON_RELEASE, XCB_MOTION_NOTIFY})
, m_effects(effects)
, m_window(window)

View file

@ -12,17 +12,17 @@
namespace KWin
{
class EffectsHandlerImpl;
class EffectsHandler;
class EffectsMouseInterceptionX11Filter : public X11EventFilter
{
public:
explicit EffectsMouseInterceptionX11Filter(xcb_window_t window, EffectsHandlerImpl *effects);
explicit EffectsMouseInterceptionX11Filter(xcb_window_t window, EffectsHandler *effects);
bool event(xcb_generic_event_t *event) override;
private:
EffectsHandlerImpl *m_effects;
EffectsHandler *m_effects;
xcb_window_t m_window;
};

View file

@ -43,7 +43,7 @@ Q_DECLARE_FLAGS(LoadEffectFlags, LoadEffectFlag)
*
* The AbstractEffectLoader specifies the methods a concrete loader has to implement and how
* those methods are expected to perform. Also it provides an interface to the outside world
* (that is EffectsHandlerImpl).
* (that is EffectsHandler).
*
* The abstraction is used because there are multiple types of Effects which need to be loaded:
* @li Built-In Effects

File diff suppressed because it is too large Load diff

View file

@ -1,324 +0,0 @@
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
SPDX-FileCopyrightText: 2010, 2011 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "libkwineffects/kwineffects.h"
#include "scene/workspacescene.h"
#include <QHash>
#include <memory>
class QMouseEvent;
class QWheelEvent;
class QDBusPendingCallWatcher;
class QDBusServiceWatcher;
namespace KWin
{
class Display;
class Window;
class Compositor;
class EffectLoader;
class Unmanaged;
class WindowPropertyNotifyX11Filter;
class TabletEvent;
class TabletPadId;
class TabletToolId;
class KWIN_EXPORT EffectsHandlerImpl : public EffectsHandler
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Effects")
Q_PROPERTY(QStringList activeEffects READ activeEffects)
Q_PROPERTY(QStringList loadedEffects READ loadedEffects)
Q_PROPERTY(QStringList listOfEffects READ listOfEffects)
public:
EffectsHandlerImpl(Compositor *compositor, WorkspaceScene *scene);
~EffectsHandlerImpl() override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void postPaintScreen() override;
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) override;
void postPaintWindow(EffectWindow *w) override;
Effect *provides(Effect::Feature ef);
void drawWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) override;
void renderWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) override;
void activateWindow(EffectWindow *c) override;
EffectWindow *activeWindow() const override;
void moveWindow(EffectWindow *w, const QPoint &pos, bool snap = false, double snapAdjust = 1.0) override;
void windowToScreen(EffectWindow *w, Output *screen) override;
void setShowingDesktop(bool showing) override;
QString currentActivity() const override;
VirtualDesktop *currentDesktop() const override;
QList<VirtualDesktop *> desktops() const override;
void setCurrentDesktop(VirtualDesktop *desktop) override;
QSize desktopGridSize() const override;
int desktopGridWidth() const override;
int desktopGridHeight() const override;
int workspaceWidth() const override;
int workspaceHeight() const override;
VirtualDesktop *desktopAtCoords(QPoint coords) const override;
QPoint desktopGridCoords(VirtualDesktop *desktop) const override;
QPoint desktopCoords(VirtualDesktop *desktop) const override;
VirtualDesktop *desktopAbove(VirtualDesktop *desktop = nullptr, bool wrap = true) const override;
VirtualDesktop *desktopToRight(VirtualDesktop *desktop = nullptr, bool wrap = true) const override;
VirtualDesktop *desktopBelow(VirtualDesktop *desktop = nullptr, bool wrap = true) const override;
VirtualDesktop *desktopToLeft(VirtualDesktop *desktop = nullptr, bool wrap = true) const override;
QString desktopName(VirtualDesktop *desktop) const override;
bool optionRollOverDesktops() const override;
QPointF cursorPos() const override;
bool grabKeyboard(Effect *effect) override;
void ungrabKeyboard() override;
// not performing XGrabPointer
void startMouseInterception(Effect *effect, Qt::CursorShape shape) override;
void stopMouseInterception(Effect *effect) override;
bool isMouseInterception() const;
void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action) override;
void registerAxisShortcut(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis, QAction *action) override;
void registerTouchpadSwipeShortcut(SwipeDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback) override;
void registerTouchpadPinchShortcut(PinchDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback) override;
void registerTouchscreenSwipeShortcut(SwipeDirection direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback) override;
void startMousePolling() override;
void stopMousePolling() override;
EffectWindow *findWindow(WId id) const override;
EffectWindow *findWindow(SurfaceInterface *surf) const override;
EffectWindow *findWindow(QWindow *w) const override;
EffectWindow *findWindow(const QUuid &id) const override;
EffectWindowList stackingOrder() const override;
void setElevatedWindow(KWin::EffectWindow *w, bool set) override;
void setTabBoxWindow(EffectWindow *) override;
EffectWindowList currentTabBoxWindowList() const override;
void refTabBox() override;
void unrefTabBox() override;
void closeTabBox() override;
EffectWindow *currentTabBoxWindow() const override;
void setActiveFullScreenEffect(Effect *e) override;
Effect *activeFullScreenEffect() const override;
bool hasActiveFullScreenEffect() const override;
void addRepaintFull() override;
void addRepaint(const QRect &r) override;
void addRepaint(const QRectF &r) override;
void addRepaint(const QRegion &r) override;
void addRepaint(int x, int y, int w, int h) override;
Output *activeScreen() const override;
QRectF clientArea(clientAreaOption, const Output *screen, const VirtualDesktop *desktop) const override;
QRectF clientArea(clientAreaOption, const EffectWindow *c) const override;
QRectF clientArea(clientAreaOption, const QPoint &p, const VirtualDesktop *desktop) const override;
QSize virtualScreenSize() const override;
QRect virtualScreenGeometry() const override;
double animationTimeFactor() const override;
void defineCursor(Qt::CursorShape shape) override;
bool checkInputWindowEvent(QMouseEvent *e);
bool checkInputWindowEvent(QWheelEvent *e);
void checkInputWindowStacking();
void reserveElectricBorder(ElectricBorder border, Effect *effect) override;
void unreserveElectricBorder(ElectricBorder border, Effect *effect) override;
void registerTouchBorder(ElectricBorder border, QAction *action) override;
void registerRealtimeTouchBorder(ElectricBorder border, QAction *action, EffectsHandler::TouchBorderCallback progressCallback) override;
void unregisterTouchBorder(ElectricBorder border, QAction *action) override;
QPainter *scenePainter() override;
void reconfigure() override;
QByteArray readRootProperty(long atom, long type, int format) const override;
xcb_atom_t announceSupportProperty(const QByteArray &propertyName, Effect *effect) override;
void removeSupportProperty(const QByteArray &propertyName, Effect *effect) override;
bool hasDecorationShadows() const override;
bool decorationsHaveAlpha() const override;
QVariant kwinOption(KWinOption kwopt) override;
bool isScreenLocked() const override;
bool makeOpenGLContextCurrent() override;
void doneOpenGLContextCurrent() override;
xcb_connection_t *xcbConnection() const override;
xcb_window_t x11RootWindow() const override;
// internal (used by kwin core or compositing code)
void startPaint();
void grabbedKeyboardEvent(QKeyEvent *e);
bool hasKeyboardGrab() const;
void reloadEffect(Effect *effect) override;
QStringList loadedEffects() const;
QStringList listOfEffects() const;
void unloadAllEffects();
QStringList activeEffects() const;
bool isEffectActive(const QString &pluginId) const;
/**
* @returns whether or not any effect is currently active where KWin should not use direct scanout
*/
bool blocksDirectScanout() const;
Display *waylandDisplay() const override;
bool animationsSupported() const override;
PlatformCursorImage cursorImage() const override;
void hideCursor() override;
void showCursor() override;
void startInteractiveWindowSelection(std::function<void(KWin::EffectWindow *)> callback) override;
void startInteractivePositionSelection(std::function<void(const QPointF &)> callback) override;
void showOnScreenMessage(const QString &message, const QString &iconName = QString()) override;
void hideOnScreenMessage(OnScreenMessageHideFlags flags = OnScreenMessageHideFlags()) override;
KSharedConfigPtr config() const override;
KSharedConfigPtr inputConfig() const override;
WorkspaceScene *scene() const
{
return m_scene;
}
bool touchDown(qint32 id, const QPointF &pos, std::chrono::microseconds time);
bool touchMotion(qint32 id, const QPointF &pos, std::chrono::microseconds time);
bool touchUp(qint32 id, std::chrono::microseconds time);
bool tabletToolEvent(KWin::TabletEvent *event);
bool tabletToolButtonEvent(uint button, bool pressed, const KWin::TabletToolId &tabletToolId, std::chrono::microseconds time);
bool tabletPadButtonEvent(uint button, bool pressed, const KWin::TabletPadId &tabletPadId, std::chrono::microseconds time);
bool tabletPadStripEvent(int number, int position, bool isFinger, const KWin::TabletPadId &tabletPadId, std::chrono::microseconds time);
bool tabletPadRingEvent(int number, int position, bool isFinger, const KWin::TabletPadId &tabletPadId, std::chrono::microseconds time);
void highlightWindows(const QList<EffectWindow *> &windows);
bool isPropertyTypeRegistered(xcb_atom_t atom) const
{
return registered_atoms.contains(atom);
}
void windowToDesktops(EffectWindow *w, const QList<VirtualDesktop *> &desktops) override;
/**
* Finds an effect with the given name.
*
* @param name The name of the effect.
* @returns The effect with the given name @p name, or nullptr if there
* is no such effect loaded.
*/
Effect *findEffect(const QString &name) const;
void renderOffscreenQuickView(const RenderTarget &renderTarget, const RenderViewport &viewport, OffscreenQuickView *effectQuickView) const override;
SessionState sessionState() const override;
QList<Output *> screens() const override;
Output *screenAt(const QPoint &point) const override;
Output *findScreen(const QString &name) const override;
Output *findScreen(int screenId) const override;
void renderScreen(Output *screen) override;
bool isCursorHidden() const override;
KWin::EffectWindow *inputPanel() const override;
bool isInputPanelOverlay() const override;
QQmlEngine *qmlEngine() const override;
public Q_SLOTS:
// slots for D-Bus interface
Q_SCRIPTABLE void reconfigureEffect(const QString &name);
Q_SCRIPTABLE bool loadEffect(const QString &name);
Q_SCRIPTABLE void toggleEffect(const QString &name);
Q_SCRIPTABLE void unloadEffect(const QString &name);
Q_SCRIPTABLE bool isEffectLoaded(const QString &name) const;
Q_SCRIPTABLE bool isEffectSupported(const QString &name);
Q_SCRIPTABLE QList<bool> areEffectsSupported(const QStringList &names);
Q_SCRIPTABLE QString supportInformation(const QString &name) const;
Q_SCRIPTABLE QString debug(const QString &name, const QString &parameter = QString()) const;
protected:
void connectNotify(const QMetaMethod &signal) override;
void disconnectNotify(const QMetaMethod &signal) override;
void effectsChanged();
void setupWindowConnections(KWin::Window *window);
/**
* Default implementation does nothing and returns @c true.
*/
virtual bool doGrabKeyboard();
/**
* Default implementation does nothing.
*/
virtual void doUngrabKeyboard();
/**
* Default implementation sets Effects override cursor on the PointerInputRedirection.
*/
virtual void doStartMouseInterception(Qt::CursorShape shape);
/**
* Default implementation removes the Effects override cursor on the PointerInputRedirection.
*/
virtual void doStopMouseInterception();
/**
* Default implementation does nothing
*/
virtual void doCheckInputWindowStacking();
Effect *keyboard_grab_effect;
Effect *fullscreen_effect;
QMultiMap<int, EffectPair> effect_order;
QHash<long, int> registered_atoms;
private:
void registerPropertyType(long atom, bool reg);
void destroyEffect(Effect *effect);
void reconfigureEffects();
typedef QList<Effect *> EffectsList;
typedef EffectsList::const_iterator EffectsIterator;
EffectsList m_activeEffects;
EffectsIterator m_currentDrawWindowIterator;
EffectsIterator m_currentPaintWindowIterator;
EffectsIterator m_currentPaintScreenIterator;
typedef QHash<QByteArray, QList<Effect *>> PropertyEffectMap;
PropertyEffectMap m_propertiesForEffects;
QHash<QByteArray, qulonglong> m_managedProperties;
Compositor *m_compositor;
WorkspaceScene *m_scene;
QList<Effect *> m_grabbedMouseEffects;
EffectLoader *m_effectLoader;
int m_trackingCursorChanges;
std::unique_ptr<WindowPropertyNotifyX11Filter> m_x11WindowPropertyNotify;
};
inline xcb_window_t EffectsHandlerImpl::x11RootWindow() const
{
return kwinApp()->x11RootWindow();
}
inline xcb_connection_t *EffectsHandlerImpl::xcbConnection() const
{
return kwinApp()->x11Connection();
}
} // namespace

View file

@ -17,14 +17,9 @@
#include "atoms.h"
#include "cursor.h"
#include "focuschain.h"
#include "netinfo.h"
#include "workspace.h"
#include "x11window.h"
#if KWIN_BUILD_TABBOX
#include "tabbox/tabbox.h"
#endif
#include "effects.h"
#include "group.h"
#include "libkwineffects/kwineffects.h"
#include "netinfo.h"
#include "rules.h"
#include "screenedge.h"
#include "useractions.h"
@ -32,6 +27,12 @@
#include "wayland/surface.h"
#include "wayland/xwaylandshell_v1.h"
#include "wayland_server.h"
#include "workspace.h"
#include "x11window.h"
#if KWIN_BUILD_TABBOX
#include "tabbox/tabbox.h"
#endif
#include <KDecoration2/Decoration>
@ -678,7 +679,7 @@ void X11Window::clientMessageEvent(xcb_client_message_event_t *e)
void X11Window::configureNotifyEvent(xcb_configure_notify_event_t *e)
{
if (effects) {
static_cast<EffectsHandlerImpl *>(effects)->checkInputWindowStacking(); // keep them on top
effects->checkInputWindowStacking(); // keep them on top
}
QRectF newgeom(Xcb::fromXNative(e->x), Xcb::fromXNative(e->y), Xcb::fromXNative(e->width), Xcb::fromXNative(e->height));
if (newgeom != m_frameGeometry) {

View file

@ -15,7 +15,6 @@
#include "backends/libinput/device.h"
#include "core/inputbackend.h"
#include "core/session.h"
#include "effects.h"
#include "gestures.h"
#include "globalshortcuts.h"
#include "hide_cursor_spy.h"
@ -529,23 +528,23 @@ public:
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->checkInputWindowEvent(event);
return effects->checkInputWindowEvent(event);
}
bool wheelEvent(WheelEvent *event) override
{
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->checkInputWindowEvent(event);
return effects->checkInputWindowEvent(event);
}
bool keyEvent(KeyEvent *event) override
{
if (!effects || !static_cast<EffectsHandlerImpl *>(effects)->hasKeyboardGrab()) {
if (!effects || !effects->hasKeyboardGrab()) {
return false;
}
waylandServer()->seat()->setFocusedKeyboardSurface(nullptr);
passToWaylandServer(event);
static_cast<EffectsHandlerImpl *>(effects)->grabbedKeyboardEvent(event);
effects->grabbedKeyboardEvent(event);
return true;
}
bool touchDown(qint32 id, const QPointF &pos, std::chrono::microseconds time) override
@ -553,56 +552,56 @@ public:
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->touchDown(id, pos, time);
return effects->touchDown(id, pos, time);
}
bool touchMotion(qint32 id, const QPointF &pos, std::chrono::microseconds time) override
{
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->touchMotion(id, pos, time);
return effects->touchMotion(id, pos, time);
}
bool touchUp(qint32 id, std::chrono::microseconds time) override
{
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->touchUp(id, time);
return effects->touchUp(id, time);
}
bool tabletToolEvent(TabletEvent *event) override
{
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->tabletToolEvent(event);
return effects->tabletToolEvent(event);
}
bool tabletToolButtonEvent(uint button, bool pressed, const TabletToolId &tabletToolId, std::chrono::microseconds time) override
{
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->tabletToolButtonEvent(button, pressed, tabletToolId, time);
return effects->tabletToolButtonEvent(button, pressed, tabletToolId, time);
}
bool tabletPadButtonEvent(uint button, bool pressed, const TabletPadId &tabletPadId, std::chrono::microseconds time) override
{
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->tabletPadButtonEvent(button, pressed, tabletPadId, time);
return effects->tabletPadButtonEvent(button, pressed, tabletPadId, time);
}
bool tabletPadStripEvent(int number, int position, bool isFinger, const TabletPadId &tabletPadId, std::chrono::microseconds time) override
{
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->tabletPadStripEvent(number, position, isFinger, tabletPadId, time);
return effects->tabletPadStripEvent(number, position, isFinger, tabletPadId, time);
}
bool tabletPadRingEvent(int number, int position, bool isFinger, const TabletPadId &tabletPadId, std::chrono::microseconds time) override
{
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->tabletPadRingEvent(number, position, isFinger, tabletPadId, time);
return effects->tabletPadRingEvent(number, position, isFinger, tabletPadId, time);
}
};
@ -3249,7 +3248,7 @@ Window *InputRedirection::findToplevel(const QPointF &pos)
const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked();
if (!isScreenLocked) {
// if an effect overrides the cursor we don't have a window to focus
if (effects && static_cast<EffectsHandlerImpl *>(effects)->isMouseInterception()) {
if (effects && effects->isMouseInterception()) {
return nullptr;
}
}

View file

@ -65,10 +65,10 @@
*/
#include "compositor.h"
#include "effects.h"
#include "focuschain.h"
#include "group.h"
#include "internalwindow.h"
#include "libkwineffects/kwineffects.h"
#include "netinfo.h"
#include "rules.h"
#include "screenedge.h"
@ -589,7 +589,7 @@ void Workspace::blockStackingUpdates(bool block)
if (--m_blockStackingUpdates == 0) {
updateStackingOrder(m_blockedPropagatingNewWindows);
if (effects) {
static_cast<EffectsHandlerImpl *>(effects)->checkInputWindowStacking();
effects->checkInputWindowStacking();
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -40,6 +40,8 @@ class KConfigGroup;
class QFont;
class QKeyEvent;
class QMatrix4x4;
class QMouseEvent;
class QWheelEvent;
class QAction;
class QTabletEvent;
class QQmlEngine;
@ -63,16 +65,23 @@ class Display;
class PaintDataPrivate;
class WindowPaintDataPrivate;
class Compositor;
class EffectLoader;
class EffectWindow;
class EffectWindowGroup;
class OffscreenQuickView;
class Group;
class Output;
class Effect;
class TabletEvent;
class TabletPadId;
class TabletToolId;
class Window;
class WindowItem;
class WindowPropertyNotifyX11Filter;
class WindowQuad;
class WindowQuadList;
class WorkspaceScene;
class VirtualDesktop;
typedef QPair<QString, Effect *> EffectPair;
@ -133,6 +142,12 @@ KWIN_EXPORT inline QPoint flooredPoint(const QPointF &point)
class KWIN_EXPORT EffectsHandler : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Effects")
Q_PROPERTY(QStringList activeEffects READ activeEffects)
Q_PROPERTY(QStringList loadedEffects READ loadedEffects)
Q_PROPERTY(QStringList listOfEffects READ listOfEffects)
Q_PROPERTY(KWin::VirtualDesktop *currentDesktop READ currentDesktop WRITE setCurrentDesktop NOTIFY desktopChanged)
Q_PROPERTY(QString currentActivity READ currentActivity NOTIFY currentActivityChanged)
Q_PROPERTY(KWin::EffectWindow *activeWindow READ activeWindow WRITE activateWindow NOTIFY windowActivated)
@ -176,27 +191,31 @@ class KWIN_EXPORT EffectsHandler : public QObject
public:
using TouchBorderCallback = std::function<void(ElectricBorder border, const QPointF &, Output *screen)>;
explicit EffectsHandler(CompositingType type);
EffectsHandler(Compositor *compositor, WorkspaceScene *scene);
~EffectsHandler() override;
// internal (used by kwin core or compositing code)
void startPaint();
// for use by effects
virtual void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) = 0;
virtual void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) = 0;
virtual void postPaintScreen() = 0;
virtual void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime) = 0;
virtual void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) = 0;
virtual void postPaintWindow(EffectWindow *w) = 0;
virtual void drawWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) = 0;
virtual void renderWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) = 0;
virtual QVariant kwinOption(KWinOption kwopt) = 0;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime);
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen);
void postPaintScreen();
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime);
void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data);
void postPaintWindow(EffectWindow *w);
void drawWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data);
void renderWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data);
QVariant kwinOption(KWinOption kwopt);
/**
* Sets the cursor while the mouse is intercepted.
* @see startMouseInterception
* @since 4.11
*/
virtual void defineCursor(Qt::CursorShape shape) = 0;
virtual QPointF cursorPos() const = 0;
virtual bool grabKeyboard(Effect *effect) = 0;
virtual void ungrabKeyboard() = 0;
virtual void defineCursor(Qt::CursorShape shape);
QPointF cursorPos() const;
bool grabKeyboard(Effect *effect);
void ungrabKeyboard();
/**
* Ensures that all mouse events are sent to the @p effect.
* No window will get the mouse events. Only fullscreen effects providing a custom user interface should
@ -211,13 +230,21 @@ public:
* @see Effect::windowInputMouseEvent
* @since 4.11
*/
virtual void startMouseInterception(Effect *effect, Qt::CursorShape shape) = 0;
void startMouseInterception(Effect *effect, Qt::CursorShape shape);
/**
* Releases the hold mouse interception for @p effect
* @see startMouseInterception
* @since 4.11
*/
virtual void stopMouseInterception(Effect *effect) = 0;
void stopMouseInterception(Effect *effect);
bool isMouseInterception() const;
bool checkInputWindowEvent(QMouseEvent *e);
bool checkInputWindowEvent(QWheelEvent *e);
void checkInputWindowStacking();
void grabbedKeyboardEvent(QKeyEvent *e);
bool hasKeyboardGrab() const;
/**
* @brief Registers a global pointer shortcut with the provided @p action.
@ -226,7 +253,7 @@ public:
* @param pointerButtons The pointer buttons which need to be pressed
* @param action The action which gets triggered when the shortcut matches
*/
virtual void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action) = 0;
void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action);
/**
* @brief Registers a global axis shortcut with the provided @p action.
*
@ -234,7 +261,7 @@ public:
* @param axis The direction in which the axis needs to be moved
* @param action The action which gets triggered when the shortcut matches
*/
virtual void registerAxisShortcut(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis, QAction *action) = 0;
void registerAxisShortcut(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis, QAction *action);
/**
* @brief Registers a global touchpad swipe gesture shortcut with the provided @p action.
@ -243,9 +270,9 @@ public:
* @param action The action which gets triggered when the gesture triggers
* @since 5.10
*/
virtual void registerTouchpadSwipeShortcut(SwipeDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = {}) = 0;
void registerTouchpadSwipeShortcut(SwipeDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = {});
virtual void registerTouchpadPinchShortcut(PinchDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = {}) = 0;
void registerTouchpadPinchShortcut(PinchDirection dir, uint fingerCount, QAction *onUp, std::function<void(qreal)> progressCallback = {});
/**
* @brief Registers a global touchscreen swipe gesture shortcut with the provided @p action.
@ -254,14 +281,14 @@ public:
* @param action The action which gets triggered when the gesture triggers
* @since 5.25
*/
virtual void registerTouchscreenSwipeShortcut(SwipeDirection direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback) = 0;
void registerTouchscreenSwipeShortcut(SwipeDirection direction, uint fingerCount, QAction *action, std::function<void(qreal)> progressCallback);
// Mouse polling
virtual void startMousePolling() = 0;
virtual void stopMousePolling() = 0;
void startMousePolling();
void stopMousePolling();
virtual void reserveElectricBorder(ElectricBorder border, Effect *effect) = 0;
virtual void unreserveElectricBorder(ElectricBorder border, Effect *effect) = 0;
void reserveElectricBorder(ElectricBorder border, Effect *effect);
void unreserveElectricBorder(ElectricBorder border, Effect *effect);
/**
* Registers the given @p action for the given @p border to be activated through
@ -276,7 +303,7 @@ public:
* @see unregisterTouchBorder
* @since 5.10
*/
virtual void registerTouchBorder(ElectricBorder border, QAction *action) = 0;
void registerTouchBorder(ElectricBorder border, QAction *action);
/**
* Registers the given @p action for the given @p border to be activated through
@ -294,7 +321,7 @@ public:
* @see unregisterTouchBorder
* @since 5.25
*/
virtual void registerRealtimeTouchBorder(ElectricBorder border, QAction *action, TouchBorderCallback progressCallback) = 0;
void registerRealtimeTouchBorder(ElectricBorder border, QAction *action, TouchBorderCallback progressCallback);
/**
* Unregisters the given @p action for the given touch @p border.
@ -302,101 +329,101 @@ public:
* @see registerTouchBorder
* @since 5.10
*/
virtual void unregisterTouchBorder(ElectricBorder border, QAction *action) = 0;
void unregisterTouchBorder(ElectricBorder border, QAction *action);
// functions that allow controlling windows/desktop
virtual void activateWindow(KWin::EffectWindow *c) = 0;
virtual KWin::EffectWindow *activeWindow() const = 0;
Q_SCRIPTABLE virtual void moveWindow(KWin::EffectWindow *w, const QPoint &pos, bool snap = false, double snapAdjust = 1.0) = 0;
void activateWindow(KWin::EffectWindow *c);
KWin::EffectWindow *activeWindow() const;
Q_SCRIPTABLE void moveWindow(KWin::EffectWindow *w, const QPoint &pos, bool snap = false, double snapAdjust = 1.0);
/**
* Moves a window to the given desktops
* On X11, the window will end up on the last window in the list
* Setting this to an empty list will set the window on all desktops
*/
Q_SCRIPTABLE virtual void windowToDesktops(KWin::EffectWindow *w, const QList<KWin::VirtualDesktop *> &desktops) = 0;
Q_SCRIPTABLE void windowToDesktops(KWin::EffectWindow *w, const QList<KWin::VirtualDesktop *> &desktops);
Q_SCRIPTABLE virtual void windowToScreen(KWin::EffectWindow *w, Output *screen) = 0;
virtual void setShowingDesktop(bool showing) = 0;
Q_SCRIPTABLE void windowToScreen(KWin::EffectWindow *w, Output *screen);
void setShowingDesktop(bool showing);
// Activities
/**
* @returns The ID of the current activity.
*/
virtual QString currentActivity() const = 0;
QString currentActivity() const;
// Desktops
/**
* @returns The current desktop.
*/
virtual VirtualDesktop *currentDesktop() const = 0;
VirtualDesktop *currentDesktop() const;
/**
* @returns Total number of desktops currently in existence.
*/
virtual QList<VirtualDesktop *> desktops() const = 0;
QList<VirtualDesktop *> desktops() const;
/**
* Set the current desktop to @a desktop.
*/
virtual void setCurrentDesktop(KWin::VirtualDesktop *desktop) = 0;
void setCurrentDesktop(KWin::VirtualDesktop *desktop);
/**
* @returns The size of desktop layout in grid units.
*/
virtual QSize desktopGridSize() const = 0;
QSize desktopGridSize() const;
/**
* @returns The width of desktop layout in grid units.
*/
virtual int desktopGridWidth() const = 0;
int desktopGridWidth() const;
/**
* @returns The height of desktop layout in grid units.
*/
virtual int desktopGridHeight() const = 0;
int desktopGridHeight() const;
/**
* @returns The width of desktop layout in pixels.
*/
virtual int workspaceWidth() const = 0;
int workspaceWidth() const;
/**
* @returns The height of desktop layout in pixels.
*/
virtual int workspaceHeight() const = 0;
int workspaceHeight() const;
/**
* @returns The desktop at the point @a coords or 0 if no desktop exists at that
* point. @a coords is to be in grid units.
*/
virtual VirtualDesktop *desktopAtCoords(QPoint coords) const = 0;
VirtualDesktop *desktopAtCoords(QPoint coords) const;
/**
* @returns The coords of the specified @a desktop in grid units.
*/
virtual QPoint desktopGridCoords(VirtualDesktop *desktop) const = 0;
QPoint desktopGridCoords(VirtualDesktop *desktop) const;
/**
* @returns The coords of the top-left corner of @a desktop in pixels.
*/
virtual QPoint desktopCoords(VirtualDesktop *desktop) const = 0;
QPoint desktopCoords(VirtualDesktop *desktop) const;
/**
* @returns The desktop above the given @a desktop. Wraps around to the bottom of
* the layout if @a wrap is set. If @a id is not set use the current one.
*/
Q_SCRIPTABLE virtual KWin::VirtualDesktop *desktopAbove(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const = 0;
Q_SCRIPTABLE KWin::VirtualDesktop *desktopAbove(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const;
/**
* @returns The desktop to the right of the given @a desktop. Wraps around to the
* left of the layout if @a wrap is set. If @a id is not set use the current one.
*/
Q_SCRIPTABLE virtual KWin::VirtualDesktop *desktopToRight(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const = 0;
Q_SCRIPTABLE KWin::VirtualDesktop *desktopToRight(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const;
/**
* @returns The desktop below the given @a desktop. Wraps around to the top of the
* layout if @a wrap is set. If @a id is not set use the current one.
*/
Q_SCRIPTABLE virtual KWin::VirtualDesktop *desktopBelow(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const = 0;
Q_SCRIPTABLE KWin::VirtualDesktop *desktopBelow(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const;
/**
* @returns The desktop to the left of the given @a desktop. Wraps around to the
* right of the layout if @a wrap is set. If @a id is not set use the current one.
*/
Q_SCRIPTABLE virtual KWin::VirtualDesktop *desktopToLeft(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const = 0;
Q_SCRIPTABLE virtual QString desktopName(KWin::VirtualDesktop *desktop) const = 0;
virtual bool optionRollOverDesktops() const = 0;
Q_SCRIPTABLE KWin::VirtualDesktop *desktopToLeft(KWin::VirtualDesktop *desktop = nullptr, bool wrap = true) const;
Q_SCRIPTABLE QString desktopName(KWin::VirtualDesktop *desktop) const;
bool optionRollOverDesktops() const;
virtual Output *activeScreen() const = 0; // Xinerama
virtual QRectF clientArea(clientAreaOption, const Output *screen, const VirtualDesktop *desktop) const = 0;
virtual QRectF clientArea(clientAreaOption, const EffectWindow *c) const = 0;
virtual QRectF clientArea(clientAreaOption, const QPoint &p, const VirtualDesktop *desktop) const = 0;
Output *activeScreen() const; // Xinerama
QRectF clientArea(clientAreaOption, const Output *screen, const VirtualDesktop *desktop) const;
QRectF clientArea(clientAreaOption, const EffectWindow *c) const;
QRectF clientArea(clientAreaOption, const QPoint &p, const VirtualDesktop *desktop) const;
/**
* The bounding size of all screens combined. Overlapping areas
@ -406,7 +433,7 @@ public:
* @see virtualScreenSizeChanged()
* @since 5.0
*/
virtual QSize virtualScreenSize() const = 0;
QSize virtualScreenSize() const;
/**
* The bounding geometry of all outputs combined. Always starts at (0,0) and has
* virtualScreenSize as it's size.
@ -415,7 +442,7 @@ public:
* @see virtualScreenGeometryChanged()
* @since 5.0
*/
virtual QRect virtualScreenGeometry() const = 0;
QRect virtualScreenGeometry() const;
/**
* Factor by which animation speed in the effect should be modified (multiplied).
* If configurable in the effect itself, the option should have also 'default'
@ -423,10 +450,10 @@ public:
* Note: The factor can be also 0, so make sure your code can cope with 0ms time
* if used manually.
*/
virtual double animationTimeFactor() const = 0;
double animationTimeFactor() const;
Q_SCRIPTABLE virtual KWin::EffectWindow *findWindow(WId id) const = 0;
Q_SCRIPTABLE virtual KWin::EffectWindow *findWindow(SurfaceInterface *surf) const = 0;
Q_SCRIPTABLE KWin::EffectWindow *findWindow(WId id) const;
Q_SCRIPTABLE KWin::EffectWindow *findWindow(SurfaceInterface *surf) const;
/**
* Finds the EffectWindow for the internal window @p w.
* If there is no such window @c null is returned.
@ -436,38 +463,38 @@ public:
*
* @since 5.16
*/
Q_SCRIPTABLE virtual KWin::EffectWindow *findWindow(QWindow *w) const = 0;
Q_SCRIPTABLE KWin::EffectWindow *findWindow(QWindow *w) const;
/**
* Finds the EffectWindow for the Window with KWin internal @p id.
* If there is no such window @c null is returned.
*
* @since 5.16
*/
Q_SCRIPTABLE virtual KWin::EffectWindow *findWindow(const QUuid &id) const = 0;
virtual EffectWindowList stackingOrder() const = 0;
Q_SCRIPTABLE KWin::EffectWindow *findWindow(const QUuid &id) const;
EffectWindowList stackingOrder() const;
// window will be temporarily painted as if being at the top of the stack
Q_SCRIPTABLE virtual void setElevatedWindow(KWin::EffectWindow *w, bool set) = 0;
Q_SCRIPTABLE void setElevatedWindow(KWin::EffectWindow *w, bool set);
virtual void setTabBoxWindow(EffectWindow *) = 0;
virtual EffectWindowList currentTabBoxWindowList() const = 0;
virtual void refTabBox() = 0;
virtual void unrefTabBox() = 0;
virtual void closeTabBox() = 0;
virtual EffectWindow *currentTabBoxWindow() const = 0;
void setTabBoxWindow(EffectWindow *);
EffectWindowList currentTabBoxWindowList() const;
void refTabBox();
void unrefTabBox();
void closeTabBox();
EffectWindow *currentTabBoxWindow() const;
virtual void setActiveFullScreenEffect(Effect *e) = 0;
virtual Effect *activeFullScreenEffect() const = 0;
void setActiveFullScreenEffect(Effect *e);
Effect *activeFullScreenEffect() const;
/**
* Schedules the entire workspace to be repainted next time.
* If you call it during painting (including prepaint) then it does not
* affect the current painting.
*/
Q_SCRIPTABLE virtual void addRepaintFull() = 0;
Q_SCRIPTABLE virtual void addRepaint(const QRectF &r) = 0;
Q_SCRIPTABLE virtual void addRepaint(const QRect &r) = 0;
Q_SCRIPTABLE virtual void addRepaint(const QRegion &r) = 0;
Q_SCRIPTABLE virtual void addRepaint(int x, int y, int w, int h) = 0;
Q_SCRIPTABLE void addRepaintFull();
Q_SCRIPTABLE void addRepaint(const QRectF &r);
Q_SCRIPTABLE void addRepaint(const QRect &r);
Q_SCRIPTABLE void addRepaint(const QRegion &r);
Q_SCRIPTABLE void addRepaint(int x, int y, int w, int h);
CompositingType compositingType() const;
/**
@ -484,10 +511,10 @@ public:
*
* @return QPainter* The Scene's QPainter or @c null.
*/
virtual QPainter *scenePainter() = 0;
virtual void reconfigure() = 0;
QPainter *scenePainter();
void reconfigure();
virtual QByteArray readRootProperty(long atom, long type, int format) const = 0;
QByteArray readRootProperty(long atom, long type, int format) const;
/**
* @brief Announces support for the feature with the given name. If no other Effect
* has announced support for this feature yet, an X11 property will be installed on
@ -505,7 +532,7 @@ public:
* @see removeSupportProperty
* @since 4.11
*/
virtual xcb_atom_t announceSupportProperty(const QByteArray &propertyName, Effect *effect) = 0;
xcb_atom_t announceSupportProperty(const QByteArray &propertyName, Effect *effect);
/**
* @brief Removes support for the feature with the given name. If there is no other Effect left
* which has announced support for the given property, the property will be removed from the
@ -518,18 +545,18 @@ public:
* @see announceSupportProperty
* @since 4.11
*/
virtual void removeSupportProperty(const QByteArray &propertyName, Effect *effect) = 0;
void removeSupportProperty(const QByteArray &propertyName, Effect *effect);
/**
* Returns @a true if the active window decoration has shadow API hooks.
*/
virtual bool hasDecorationShadows() const = 0;
bool hasDecorationShadows() const;
/**
* Returns @a true if the window decorations use the alpha channel, and @a false otherwise.
* @since 4.5
*/
virtual bool decorationsHaveAlpha() const = 0;
bool decorationsHaveAlpha() const;
/**
* Allows an effect to trigger a reload of itself.
@ -539,7 +566,14 @@ public:
* @param effect The effect to reload
* @since 4.8
*/
virtual void reloadEffect(Effect *effect) = 0;
void reloadEffect(Effect *effect);
Effect *provides(Effect::Feature ef);
Effect *findEffect(const QString &name) const;
QStringList loadedEffects() const;
QStringList listOfEffects() const;
void unloadAllEffects();
QStringList activeEffects() const;
bool isEffectActive(const QString &pluginId) const;
/**
* Whether the screen is currently considered as locked.
@ -551,7 +585,7 @@ public:
* @see screenLockingChanged
* @since 4.11
*/
virtual bool isScreenLocked() const = 0;
bool isScreenLocked() const;
/**
* @brief Makes the OpenGL compositing context current.
@ -560,7 +594,7 @@ public:
*
* @return bool @c true if the context became current, @c false otherwise.
*/
virtual bool makeOpenGLContextCurrent() = 0;
bool makeOpenGLContextCurrent();
/**
* @brief Makes a null OpenGL context current resulting in no context
* being current.
@ -569,17 +603,17 @@ public:
*
* There is normally no reason for an Effect to call this method.
*/
virtual void doneOpenGLContextCurrent() = 0;
void doneOpenGLContextCurrent();
virtual xcb_connection_t *xcbConnection() const = 0;
virtual xcb_window_t x11RootWindow() const = 0;
xcb_connection_t *xcbConnection() const;
xcb_window_t x11RootWindow() const;
/**
* Interface to the Wayland display: this is relevant only
* on Wayland, on X11 it will be nullptr
* @since 5.5
*/
virtual Display *waylandDisplay() const = 0;
Display *waylandDisplay() const;
/**
* Whether animations are supported by the Scene.
@ -589,33 +623,33 @@ public:
* @returns Whether the Scene can drive animations
* @since 5.8
*/
virtual bool animationsSupported() const = 0;
bool animationsSupported() const;
/**
* The current cursor image of the Platform.
* @see cursorPos
* @since 5.9
*/
virtual PlatformCursorImage cursorImage() const = 0;
PlatformCursorImage cursorImage() const;
/**
* The cursor image should be hidden.
* @see showCursor
* @since 5.9
*/
virtual void hideCursor() = 0;
void hideCursor();
/**
* The cursor image should be shown again after having been hidden.
* @see hideCursor
* @since 5.9
*/
virtual void showCursor() = 0;
void showCursor();
/**
* @returns Whether or not the cursor is currently hidden
*/
virtual bool isCursorHidden() const = 0;
bool isCursorHidden() const;
/**
* Starts an interactive window selection process.
@ -629,7 +663,7 @@ public:
* @param callback The function to invoke once the interactive window selection ends
* @since 5.9
*/
virtual void startInteractiveWindowSelection(std::function<void(KWin::EffectWindow *)> callback) = 0;
void startInteractiveWindowSelection(std::function<void(KWin::EffectWindow *)> callback);
/**
* Starts an interactive position selection process.
@ -644,7 +678,7 @@ public:
* @param callback The function to invoke once the interactive position selection ends
* @since 5.9
*/
virtual void startInteractivePositionSelection(std::function<void(const QPointF &)> callback) = 0;
void startInteractivePositionSelection(std::function<void(const QPointF &)> callback);
/**
* Shows an on-screen-message. To hide it again use hideOnScreenMessage.
@ -654,7 +688,7 @@ public:
* @see hideOnScreenMessage
* @since 5.9
*/
virtual void showOnScreenMessage(const QString &message, const QString &iconName = QString()) = 0;
void showOnScreenMessage(const QString &message, const QString &iconName = QString());
/**
* Flags for how to hide a shown on-screen-message
@ -675,55 +709,82 @@ public:
* @see showOnScreenMessage
* @since 5.9
*/
virtual void hideOnScreenMessage(OnScreenMessageHideFlags flags = OnScreenMessageHideFlags()) = 0;
void hideOnScreenMessage(OnScreenMessageHideFlags flags = OnScreenMessageHideFlags());
/*
* @returns The configuration used by the EffectsHandler.
* @since 5.10
*/
virtual KSharedConfigPtr config() const = 0;
KSharedConfigPtr config() const;
/**
* @returns The global input configuration (kcminputrc)
* @since 5.10
*/
virtual KSharedConfigPtr inputConfig() const = 0;
KSharedConfigPtr inputConfig() const;
/**
* Returns if activeFullScreenEffect is set
*/
virtual bool hasActiveFullScreenEffect() const = 0;
bool hasActiveFullScreenEffect() const;
/**
* Render the supplied OffscreenQuickView onto the scene
* It can be called at any point during the scene rendering
* @since 5.18
*/
virtual void renderOffscreenQuickView(const RenderTarget &renderTarget, const RenderViewport &viewport, OffscreenQuickView *effectQuickView) const = 0;
void renderOffscreenQuickView(const RenderTarget &renderTarget, const RenderViewport &viewport, OffscreenQuickView *effectQuickView) const;
/**
* The status of the session i.e if the user is logging out
* @since 5.18
*/
virtual SessionState sessionState() const = 0;
SessionState sessionState() const;
/**
* Returns the list of all the screens connected to the system.
*/
virtual QList<Output *> screens() const = 0;
virtual Output *screenAt(const QPoint &point) const = 0;
virtual Output *findScreen(const QString &name) const = 0;
virtual Output *findScreen(int screenId) const = 0;
QList<Output *> screens() const;
Output *screenAt(const QPoint &point) const;
Output *findScreen(const QString &name) const;
Output *findScreen(int screenId) const;
/**
* Renders @p screen in the current render target
*/
virtual void renderScreen(Output *screen) = 0;
void renderScreen(Output *screen);
virtual KWin::EffectWindow *inputPanel() const = 0;
virtual bool isInputPanelOverlay() const = 0;
KWin::EffectWindow *inputPanel() const;
bool isInputPanelOverlay() const;
virtual QQmlEngine *qmlEngine() const = 0;
QQmlEngine *qmlEngine() const;
/**
* @returns whether or not any effect is currently active where KWin should not use direct scanout
*/
bool blocksDirectScanout() const;
WorkspaceScene *scene() const
{
return m_scene;
}
bool touchDown(qint32 id, const QPointF &pos, std::chrono::microseconds time);
bool touchMotion(qint32 id, const QPointF &pos, std::chrono::microseconds time);
bool touchUp(qint32 id, std::chrono::microseconds time);
bool tabletToolEvent(KWin::TabletEvent *event);
bool tabletToolButtonEvent(uint button, bool pressed, const KWin::TabletToolId &tabletToolId, std::chrono::microseconds time);
bool tabletPadButtonEvent(uint button, bool pressed, const KWin::TabletPadId &tabletPadId, std::chrono::microseconds time);
bool tabletPadStripEvent(int number, int position, bool isFinger, const KWin::TabletPadId &tabletPadId, std::chrono::microseconds time);
bool tabletPadRingEvent(int number, int position, bool isFinger, const KWin::TabletPadId &tabletPadId, std::chrono::microseconds time);
void highlightWindows(const QList<EffectWindow *> &windows);
bool isPropertyTypeRegistered(xcb_atom_t atom) const
{
return registered_atoms.contains(atom);
}
Q_SIGNALS:
/**
@ -1009,10 +1070,74 @@ Q_SIGNALS:
void inputPanelChanged();
public Q_SLOTS:
// slots for D-Bus interface
Q_SCRIPTABLE void reconfigureEffect(const QString &name);
Q_SCRIPTABLE bool loadEffect(const QString &name);
Q_SCRIPTABLE void toggleEffect(const QString &name);
Q_SCRIPTABLE void unloadEffect(const QString &name);
Q_SCRIPTABLE bool isEffectLoaded(const QString &name) const;
Q_SCRIPTABLE bool isEffectSupported(const QString &name);
Q_SCRIPTABLE QList<bool> areEffectsSupported(const QStringList &names);
Q_SCRIPTABLE QString supportInformation(const QString &name) const;
Q_SCRIPTABLE QString debug(const QString &name, const QString &parameter = QString()) const;
protected:
void connectNotify(const QMetaMethod &signal) override;
void disconnectNotify(const QMetaMethod &signal) override;
void effectsChanged();
void setupWindowConnections(KWin::Window *window);
/**
* Default implementation does nothing and returns @c true.
*/
virtual bool doGrabKeyboard();
/**
* Default implementation does nothing.
*/
virtual void doUngrabKeyboard();
/**
* Default implementation sets Effects override cursor on the PointerInputRedirection.
*/
virtual void doStartMouseInterception(Qt::CursorShape shape);
/**
* Default implementation removes the Effects override cursor on the PointerInputRedirection.
*/
virtual void doStopMouseInterception();
/**
* Default implementation does nothing
*/
virtual void doCheckInputWindowStacking();
void registerPropertyType(long atom, bool reg);
void destroyEffect(Effect *effect);
void reconfigureEffects();
typedef QList<Effect *> EffectsList;
typedef EffectsList::const_iterator EffectsIterator;
Effect *keyboard_grab_effect;
Effect *fullscreen_effect;
QMultiMap<int, EffectPair> effect_order;
QHash<long, int> registered_atoms;
QList<EffectPair> loaded_effects;
// QHash< QString, EffectFactory* > effect_factories;
CompositingType compositing_type;
EffectsList m_activeEffects;
EffectsIterator m_currentDrawWindowIterator;
EffectsIterator m_currentPaintWindowIterator;
EffectsIterator m_currentPaintScreenIterator;
typedef QHash<QByteArray, QList<Effect *>> PropertyEffectMap;
PropertyEffectMap m_propertiesForEffects;
QHash<QByteArray, qulonglong> m_managedProperties;
Compositor *m_compositor;
WorkspaceScene *m_scene;
QList<Effect *> m_grabbedMouseEffects;
EffectLoader *m_effectLoader;
int m_trackingCursorChanges;
std::unique_ptr<WindowPropertyNotifyX11Filter> m_x11WindowPropertyNotify;
};
class EffectWindowVisibleRef;

View file

@ -19,9 +19,9 @@
#include "core/session.h"
#include "cursor.h"
#include "cursorsource.h"
#include "effects.h"
#include "input.h"
#include "inputmethod.h"
#include "libkwineffects/kwineffects.h"
#include "opengl/gltexture.h"
#include "opengl/glutils.h"
#include "options.h"
@ -355,7 +355,7 @@ std::unique_ptr<OutlineVisual> Application::createOutline(Outline *outline)
void Application::createEffectsHandler(Compositor *compositor, WorkspaceScene *scene)
{
new EffectsHandlerImpl(compositor, scene);
new EffectsHandler(compositor, scene);
}
void Application::registerEventFilter(X11EventFilter *filter)

View file

@ -17,8 +17,8 @@
#include "compositor_wayland.h"
#include "core/outputbackend.h"
#include "core/session.h"
#include "effects.h"
#include "inputmethod.h"
#include "libkwineffects/kwineffects.h"
#include "tabletmodemanager.h"
#include "utils/realtime.h"
#include "wayland/display.h"
@ -117,7 +117,7 @@ ApplicationWayland::~ApplicationWayland()
// need to unload all effects prior to destroying X connection as they might do X calls
if (effects) {
static_cast<EffectsHandlerImpl *>(effects)->unloadAllEffects();
effects->unloadAllEffects();
}
m_xwayland.reset();
destroyColorManager();

View file

@ -17,7 +17,7 @@
#include "core/outputbackend.h"
#include "core/session.h"
#include "cursor.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "outline.h"
#include "screenedge.h"
#include "sm.h"
@ -184,7 +184,7 @@ ApplicationX11::~ApplicationX11()
setTerminating();
// need to unload all effects before destroying Workspace, as effects might call into Workspace
if (effects) {
static_cast<EffectsHandlerImpl *>(effects)->unloadAllEffects();
effects->unloadAllEffects();
}
destroyPlugins();
destroyColorManager();
@ -245,7 +245,7 @@ void ApplicationX11::lostSelection()
sendPostedEvents();
// need to unload all effects before destroying Workspace, as effects might call into Workspace
if (effects) {
static_cast<EffectsHandlerImpl *>(effects)->unloadAllEffects();
effects->unloadAllEffects();
}
destroyPlugins();
destroyColorManager();

View file

@ -10,7 +10,6 @@
#include "compositor.h"
#include "core/output.h"
#include "core/outputbackend.h"
#include "effects.h"
#include "opengl/gltexture.h"
#include "outputscreencastsource.h"
#include "regionscreencastsource.h"

View file

@ -4,7 +4,7 @@
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "windoweffects.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include <QGuiApplication>
#include <QWidget>
@ -30,14 +30,13 @@ bool WindowEffects::isEffectAvailable(KWindowEffects::Effect effect)
if (!effects) {
return false;
}
auto e = static_cast<EffectsHandlerImpl *>(effects);
switch (effect) {
case KWindowEffects::BackgroundContrast:
return e->isEffectLoaded(QStringLiteral("contrast"));
return effects->isEffectLoaded(QStringLiteral("contrast"));
case KWindowEffects::BlurBehind:
return e->isEffectLoaded(QStringLiteral("blur"));
return effects->isEffectLoaded(QStringLiteral("blur"));
case KWindowEffects::Slide:
return e->isEffectLoaded(QStringLiteral("slidingpopups"));
return effects->isEffectLoaded(QStringLiteral("slidingpopups"));
default:
// plugin does not provide integration for other effects
return false;

View file

@ -16,7 +16,6 @@
#include "core/output.h"
#include "cursorsource.h"
#include "decorations/decoratedclient.h"
#include "effects.h"
#include "input_event.h"
#include "input_event_spy.h"
#include "mousebuttons.h"
@ -1076,7 +1075,7 @@ void CursorImage::reevaluteSource()
setSource(m_windowSelectionCursor.get());
return;
}
if (effects && static_cast<EffectsHandlerImpl *>(effects)->isMouseInterception()) {
if (effects && effects->isMouseInterception()) {
setSource(m_effectsCursor.get());
return;
}

View file

@ -59,8 +59,8 @@
#include "core/renderlayer.h"
#include "core/renderloop.h"
#include "core/renderviewport.h"
#include "effects.h"
#include "internalwindow.h"
#include "libkwineffects/kwineffects.h"
#include "scene/dndiconitem.h"
#include "scene/itemrenderer.h"
#include "scene/shadowitem.h"
@ -156,7 +156,7 @@ SurfaceItem *WorkspaceScene::scanoutCandidate() const
return nullptr;
}
SurfaceItem *candidate = nullptr;
if (!static_cast<EffectsHandlerImpl *>(effects)->blocksDirectScanout()) {
if (!effects->blocksDirectScanout()) {
for (int i = stacking_order.count() - 1; i >= 0; i--) {
WindowItem *windowItem = stacking_order[i];
Window *window = windowItem->window();
@ -248,8 +248,7 @@ QRegion WorkspaceScene::prePaint(SceneDelegate *delegate)
}
// preparation step
auto effectsImpl = static_cast<EffectsHandlerImpl *>(effects);
effectsImpl->startPaint();
effects->startPaint();
ScreenPrePaintData prePaintData;
prePaintData.mask = 0;

View file

@ -88,7 +88,7 @@ Q_SIGNALS:
protected:
void createStackingOrder();
void clearStackingOrder();
friend class EffectsHandlerImpl;
friend class EffectsHandler;
// called after all effects had their paintScreen() called
void finalPaintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen);
// shared implementation of painting the screen in the generic

View file

@ -22,8 +22,8 @@
#include "core/output.h"
#include "cursor.h"
#include "effects.h"
#include "gestures.h"
#include "libkwineffects/kwineffects.h"
#include "main.h"
#include "pointer_input.h"
#include "utils/common.h"

View file

@ -5,7 +5,7 @@
*/
#include "gesturehandler.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include <QAction>

View file

@ -11,7 +11,6 @@
#include "core/renderbackend.h"
#include "core/rendertarget.h"
#include "core/renderviewport.h"
#include "effects.h"
#include "scene/itemrenderer.h"
#include "scene/windowitem.h"
#include "scene/workspacescene.h"

View file

@ -12,7 +12,7 @@
#include "core/output.h"
#include "core/outputbackend.h"
#include "cursor.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "outline.h"
#include "tiles/tilemanager.h"
#include "virtualdesktops.h"
@ -333,7 +333,7 @@ bool WorkspaceWrapper::isEffectActive(const QString &pluginId) const
if (!effects) {
return false;
}
return static_cast<EffectsHandlerImpl *>(effects)->isEffectActive(pluginId);
return effects->isEffectActive(pluginId);
}
QSize WorkspaceWrapper::desktopGridSize() const

View file

@ -22,10 +22,10 @@
#include "activities.h"
#endif
#include "compositor.h"
#include "effects.h"
#include "focuschain.h"
#include "input.h"
#include "keyboard_input.h"
#include "libkwineffects/kwineffects.h"
#include "pointer_input.h"
#include "screenedge.h"
#include "utils/xcbutils.h"
@ -271,7 +271,7 @@ void TabBoxHandlerImpl::highlightWindows(Window *window, QWindow *controller)
if (Window *t = workspace()->findInternal(controller)) {
windows << t->effectWindow();
}
static_cast<EffectsHandlerImpl *>(effects)->highlightWindows(windows);
effects->highlightWindows(windows);
}
bool TabBoxHandlerImpl::noModifierGrab() const
@ -606,7 +606,7 @@ bool TabBox::handleMouseEvent(QMouseEvent *event)
{
if (!m_isShown && isDisplayed()) {
// tabbox has been replaced, check effects
if (effects && static_cast<EffectsHandlerImpl *>(effects)->checkInputWindowEvent(event)) {
if (effects && effects->checkInputWindowEvent(event)) {
return true;
}
}
@ -636,7 +636,7 @@ bool TabBox::handleWheelEvent(QWheelEvent *event)
{
if (!m_isShown && isDisplayed()) {
// tabbox has been replaced, check effects
if (effects && static_cast<EffectsHandlerImpl *>(effects)->checkInputWindowEvent(event)) {
if (effects && effects->checkInputWindowEvent(event)) {
return true;
}
}

View file

@ -8,7 +8,7 @@
*/
#include "x11_filter.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "screenedge.h"
#include "tabbox/tabbox.h"
#include "utils/xcbutils.h"
@ -41,7 +41,7 @@ bool X11Filter::event(xcb_generic_event_t *event)
auto e = reinterpret_cast<xcb_button_press_event_t *>(event);
xcb_allow_events(connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME);
if (!tab->isShown() && tab->isDisplayed()) {
if (effects && static_cast<EffectsHandlerImpl *>(effects)->isMouseInterception()) {
if (effects && effects->isMouseInterception()) {
// pass on to effects, effects will filter out the event
return false;
}

View file

@ -27,7 +27,6 @@
#include "core/output.h"
#include "cursor.h"
#include "effects.h"
#include "input.h"
#include "options.h"
#include "scripting/scripting.h"

View file

@ -7,14 +7,14 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "window_property_notify_x11_filter.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "workspace.h"
#include "x11window.h"
namespace KWin
{
WindowPropertyNotifyX11Filter::WindowPropertyNotifyX11Filter(EffectsHandlerImpl *effects)
WindowPropertyNotifyX11Filter::WindowPropertyNotifyX11Filter(EffectsHandler *effects)
: X11EventFilter(QList<int>{XCB_PROPERTY_NOTIFY})
, m_effects(effects)
{

View file

@ -12,17 +12,17 @@
namespace KWin
{
class EffectsHandlerImpl;
class EffectsHandler;
class WindowPropertyNotifyX11Filter : public X11EventFilter
{
public:
explicit WindowPropertyNotifyX11Filter(EffectsHandlerImpl *effects);
explicit WindowPropertyNotifyX11Filter(EffectsHandler *effects);
bool event(xcb_generic_event_t *event) override;
private:
EffectsHandlerImpl *m_effects;
EffectsHandler *m_effects;
};
}

View file

@ -24,12 +24,12 @@
#include "core/outputconfiguration.h"
#include "cursor.h"
#include "dbusinterface.h"
#include "effects.h"
#include "focuschain.h"
#include "group.h"
#include "input.h"
#include "internalwindow.h"
#include "killwindow.h"
#include "libkwineffects/kwineffects.h"
#include "moving_client_x11_filter.h"
#include "netinfo.h"
#include "outline.h"
@ -1842,20 +1842,20 @@ QString Workspace::supportInformation() const
}
support.append(QStringLiteral("\nLoaded Effects:\n"));
support.append(QStringLiteral("---------------\n"));
const auto loadedEffects = static_cast<EffectsHandlerImpl *>(effects)->loadedEffects();
const auto loadedEffects = effects->loadedEffects();
for (const QString &effect : loadedEffects) {
support.append(effect + QStringLiteral("\n"));
}
support.append(QStringLiteral("\nCurrently Active Effects:\n"));
support.append(QStringLiteral("-------------------------\n"));
const auto activeEffects = static_cast<EffectsHandlerImpl *>(effects)->activeEffects();
const auto activeEffects = effects->activeEffects();
for (const QString &effect : activeEffects) {
support.append(effect + QStringLiteral("\n"));
}
support.append(QStringLiteral("\nEffect Settings:\n"));
support.append(QStringLiteral("----------------\n"));
for (const QString &effect : loadedEffects) {
support.append(static_cast<EffectsHandlerImpl *>(effects)->supportInformation(effect));
support.append(effects->supportInformation(effect));
support.append(QStringLiteral("\n"));
}
support.append(QLatin1String("\nLoaded Plugins:\n"));

View file

@ -20,9 +20,9 @@
#include "cursor.h"
#include "decorations/decoratedclient.h"
#include "decorations/decorationbridge.h"
#include "effects.h"
#include "focuschain.h"
#include "group.h"
#include "libkwineffects/kwineffects.h"
#include "netinfo.h"
#include "placement.h"
#include "scene/surfaceitem_x11.h"
@ -561,7 +561,7 @@ bool X11Window::track(xcb_window_t w)
m_outline = internalWindow->property("__kwin_outline").toBool();
}
if (effects) {
static_cast<EffectsHandlerImpl *>(effects)->checkInputWindowStacking();
effects->checkInputWindowStacking();
}
switch (kwinApp()->operationMode()) {

View file

@ -8,7 +8,7 @@
*/
#include "xdgactivationv1.h"
#include "effects.h"
#include "libkwineffects/kwineffects.h"
#include "utils/common.h"
#include "wayland/display.h"
#include "wayland/plasmawindowmanagement.h"