Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ef7b553c authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[libkwineffects] Port the remaining bits of API to dynamic dispatch

Summary:
7834bec5 missed to port minimize and
unminimize to dynamic dispatch. In addition to that, we don't benefit
from QMetaObject::invokeMethod so port addRepaint and addLayerRepaint
to dynamic dispatch as well.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18049
parent 3f13a493
......@@ -40,6 +40,11 @@ public:
void deleteProperty(long int atom) const override;
void disablePainting(int reason) override;
void enablePainting(int reason) override;
void addRepaint(const QRect &r) override;
void addRepaint(int x, int y, int w, int h) override;
void addRepaintFull() override;
void addLayerRepaint(const QRect &r) override;
void addLayerRepaint(int x, int y, int w, int h) override;
EffectWindow *findModal() override;
const EffectWindowGroup *group() const override;
bool isPaintingEnabled() override;
......@@ -49,6 +54,9 @@ public:
void unrefWindow() override;
QRegion shape() const override;
void setData(int role, const QVariant &data) override;
void minimize() override;
void unminimize() override;
void closeWindow() override;
void referencePreviousWindowPixmap() override {}
void unreferencePreviousWindowPixmap() override {}
bool isDeleted() const override {
......@@ -279,6 +287,36 @@ void MockEffectWindow::enablePainting(int reason)
Q_UNUSED(reason)
}
void MockEffectWindow::addRepaint(const QRect &r)
{
Q_UNUSED(r)
}
void MockEffectWindow::addRepaint(int x, int y, int w, int h)
{
Q_UNUSED(x)
Q_UNUSED(y)
Q_UNUSED(w)
Q_UNUSED(h)
}
void MockEffectWindow::addRepaintFull()
{
}
void MockEffectWindow::addLayerRepaint(const QRect &r)
{
Q_UNUSED(r)
}
void MockEffectWindow::addLayerRepaint(int x, int y, int w, int h)
{
Q_UNUSED(x)
Q_UNUSED(y)
Q_UNUSED(w)
Q_UNUSED(h)
}
EffectWindow *MockEffectWindow::findModal()
{
return nullptr;
......@@ -317,6 +355,18 @@ void MockEffectWindow::setData(int role, const QVariant &data)
Q_UNUSED(data)
}
void MockEffectWindow::minimize()
{
}
void MockEffectWindow::unminimize()
{
}
void MockEffectWindow::closeWindow()
{
}
QRegion MockEffectWindow::shape() const
{
return QRegion();
......
......@@ -1719,6 +1719,31 @@ void EffectWindowImpl::disablePainting(int reason)
sceneWindow()->disablePainting(reason);
}
void EffectWindowImpl::addRepaint(const QRect &r)
{
toplevel->addRepaint(r);
}
void EffectWindowImpl::addRepaint(int x, int y, int w, int h)
{
toplevel->addRepaint(x, y, w, h);
}
void EffectWindowImpl::addRepaintFull()
{
toplevel->addRepaintFull();
}
void EffectWindowImpl::addLayerRepaint(const QRect &r)
{
toplevel->addLayerRepaint(r);
}
void EffectWindowImpl::addLayerRepaint(int x, int y, int w, int h)
{
toplevel->addLayerRepaint(x, y, w, h);
}
const EffectWindowGroup* EffectWindowImpl::group() const
{
if (auto c = qobject_cast<Client *>(toplevel)) {
......@@ -2012,6 +2037,27 @@ void EffectWindowImpl::desktopThumbnailDestroyed(QObject *object)
m_desktopThumbnails.removeAll(static_cast<DesktopThumbnailItem*>(object));
}
void EffectWindowImpl::minimize()
{
if (auto client = qobject_cast<AbstractClient *>(toplevel)) {
client->minimize();
}
}
void EffectWindowImpl::unminimize()
{
if (auto client = qobject_cast<AbstractClient *>(toplevel)) {
client->unminimize();
}
}
void EffectWindowImpl::closeWindow()
{
if (auto client = qobject_cast<AbstractClient *>(toplevel)) {
client->closeWindow();
}
}
void EffectWindowImpl::referencePreviousWindowPixmap()
{
if (sw) {
......
......@@ -374,6 +374,12 @@ public:
void disablePainting(int reason) override;
bool isPaintingEnabled() override;
void addRepaint(const QRect &r) override;
void addRepaint(int x, int y, int w, int h) override;
void addRepaintFull() override;
void addLayerRepaint(const QRect &r) override;
void addLayerRepaint(int x, int y, int w, int h) override;
void refWindow() override;
void unrefWindow() override;
......@@ -461,6 +467,10 @@ public:
WindowQuadList buildQuads(bool force = false) const override;
void minimize() override;
void unminimize() override;
void closeWindow() override;
void referencePreviousWindowPixmap() override;
void unreferencePreviousWindowPixmap() override;
......
......@@ -803,20 +803,6 @@ bool EffectWindow::isOnAllActivities() const
return activities().isEmpty();
}
#define WINDOW_HELPER_SETTER( prototype, propertyname, args, value ) \
void EffectWindow::prototype ( args ) \
{\
const QVariant variant = parent()->property( propertyname ); \
if (variant.isValid()) { \
parent()->setProperty( propertyname, value ); \
} \
}
WINDOW_HELPER_SETTER(minimize, "minimized",,true)
WINDOW_HELPER_SETTER(unminimize, "minimized",,false)
#undef WINDOW_HELPER_SETTER
void EffectWindow::setMinimized(bool min)
{
if (min) {
......@@ -826,36 +812,6 @@ void EffectWindow::setMinimized(bool min)
}
}
void EffectWindow::closeWindow() const
{
QMetaObject::invokeMethod(parent(), "closeWindow");
}
void EffectWindow::addRepaint(int x, int y, int w, int h)
{
QMetaObject::invokeMethod(parent(), "addRepaint", Q_ARG(int, x), Q_ARG(int, y), Q_ARG(int, w), Q_ARG(int, h));
}
void EffectWindow::addRepaint(const QRect &r)
{
QMetaObject::invokeMethod(parent(), "addRepaint", Q_ARG(const QRect&, r));
}
void EffectWindow::addRepaintFull()
{
QMetaObject::invokeMethod(parent(), "addRepaintFull");
}
void EffectWindow::addLayerRepaint(int x, int y, int w, int h)
{
QMetaObject::invokeMethod(parent(), "addLayerRepaint", Q_ARG(int, x), Q_ARG(int, y), Q_ARG(int, w), Q_ARG(int, h));
}
void EffectWindow::addLayerRepaint(const QRect &r)
{
QMetaObject::invokeMethod(parent(), "addLayerRepaint", Q_ARG(const QRect&, r));
}
bool EffectWindow::isOnCurrentActivity() const
{
return isOnActivity(effects->currentActivity());
......
......@@ -2063,11 +2063,11 @@ public:
virtual void enablePainting(int reason) = 0;
virtual void disablePainting(int reason) = 0;
virtual bool isPaintingEnabled() = 0;
Q_SCRIPTABLE void addRepaint(const QRect& r);
Q_SCRIPTABLE void addRepaint(int x, int y, int w, int h);
Q_SCRIPTABLE void addRepaintFull();
Q_SCRIPTABLE void addLayerRepaint(const QRect& r);
Q_SCRIPTABLE void addLayerRepaint(int x, int y, int w, int h);
Q_SCRIPTABLE virtual void addRepaint(const QRect &r) = 0;
Q_SCRIPTABLE virtual void addRepaint(int x, int y, int w, int h) = 0;
Q_SCRIPTABLE virtual void addRepaintFull() = 0;
Q_SCRIPTABLE virtual void addLayerRepaint(const QRect &r) = 0;
Q_SCRIPTABLE virtual void addLayerRepaint(int x, int y, int w, int h) = 0;
virtual void refWindow() = 0;
virtual void unrefWindow() = 0;
......@@ -2277,9 +2277,9 @@ public:
virtual WindowQuadList buildQuads(bool force = false) const = 0;
void setMinimized(bool minimize);
void minimize();
void unminimize();
Q_SCRIPTABLE void closeWindow() const;
virtual void minimize() = 0;
virtual void unminimize() = 0;
Q_SCRIPTABLE virtual void closeWindow() = 0;
virtual bool isCurrentTab() const = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment