libkwineffects: Replace EffectScreen with Output

This commit is contained in:
Vlad Zahorodnii 2023-10-24 23:25:32 +03:00
parent 7db4df9915
commit b3b2e96148
58 changed files with 240 additions and 450 deletions

View file

@ -260,6 +260,16 @@ QRectF Output::mapToGlobal(const QRectF &rect) const
return rect.translated(geometry().topLeft());
}
QPointF Output::mapToGlobal(const QPointF &pos) const
{
return pos + geometry().topLeft();
}
QPointF Output::mapFromGlobal(const QPointF &pos) const
{
return pos - geometry().topLeft();
}
Output::Capabilities Output::capabilities() const
{
return m_information.capabilities;

View file

@ -25,7 +25,6 @@
namespace KWin
{
class EffectScreenImpl;
class RenderLoop;
class OutputConfiguration;
class ColorTransformation;
@ -117,6 +116,12 @@ private:
class KWIN_EXPORT Output : public QObject
{
Q_OBJECT
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
Q_PROPERTY(qreal devicePixelRatio READ scale NOTIFY scaleChanged)
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
Q_PROPERTY(QString model READ model CONSTANT)
Q_PROPERTY(QString serialNumber READ serialNumber CONSTANT)
public:
enum class DpmsMode {
@ -184,6 +189,9 @@ public:
*/
QRectF mapToGlobal(const QRectF &rect) const;
Q_INVOKABLE QPointF mapToGlobal(const QPointF &pos) const;
Q_INVOKABLE QPointF mapFromGlobal(const QPointF &pos) const;
/**
* Returns a short identifiable name of this output.
*/
@ -430,14 +438,12 @@ protected:
void setInformation(const Information &information);
void setState(const State &state);
EffectScreenImpl *m_effectScreen = nullptr;
State m_state;
Information m_information;
QUuid m_uuid;
int m_directScanoutCount = 0;
int m_refCount = 1;
ContentType m_contentType = ContentType::None;
friend class EffectScreenImpl; // to access m_effectScreen
};
inline QRect Output::rect() const

View file

@ -228,13 +228,8 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, WorkspaceScene *s
setupWindowConnections(window);
}
connect(ws, &Workspace::outputAdded, this, &EffectsHandlerImpl::slotOutputAdded);
connect(ws, &Workspace::outputRemoved, this, &EffectsHandlerImpl::slotOutputRemoved);
const QList<Output *> outputs = ws->outputs();
for (Output *output : outputs) {
slotOutputAdded(output);
}
connect(ws, &Workspace::outputAdded, this, &EffectsHandlerImpl::screenAdded);
connect(ws, &Workspace::outputRemoved, this, &EffectsHandlerImpl::screenRemoved);
if (auto inputMethod = kwinApp()->inputMethod()) {
connect(inputMethod, &InputMethod::panelChanged, this, &EffectsHandlerImpl::inputPanelChanged);
@ -284,7 +279,7 @@ void EffectsHandlerImpl::prePaintScreen(ScreenPrePaintData &data, std::chrono::m
// no special final code
}
void EffectsHandlerImpl::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void EffectsHandlerImpl::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
if (m_currentPaintScreenIterator != m_activeEffects.constEnd()) {
(*m_currentPaintScreenIterator++)->paintScreen(renderTarget, viewport, mask, region, screen);
@ -751,12 +746,11 @@ void EffectsHandlerImpl::windowToDesktops(EffectWindow *w, const QList<uint> &de
window->setDesktops(desktops);
}
void EffectsHandlerImpl::windowToScreen(EffectWindow *w, EffectScreen *screen)
void EffectsHandlerImpl::windowToScreen(EffectWindow *w, Output *screen)
{
auto window = static_cast<EffectWindowImpl *>(w)->window();
if (window->isClient() && !window->isDesktop() && !window->isDock()) {
EffectScreenImpl *screenImpl = static_cast<EffectScreenImpl *>(screen);
Workspace::self()->sendWindowToOutput(window, screenImpl->platformOutput());
Workspace::self()->sendWindowToOutput(window, screen);
}
}
@ -1024,9 +1018,9 @@ void EffectsHandlerImpl::addRepaint(int x, int y, int w, int h)
m_compositor->scene()->addRepaint(x, y, w, h);
}
EffectScreen *EffectsHandlerImpl::activeScreen() const
Output *EffectsHandlerImpl::activeScreen() const
{
return EffectScreenImpl::get(workspace()->activeOutput());
return workspace()->activeOutput();
}
static VirtualDesktop *resolveVirtualDesktop(int desktopId)
@ -1038,10 +1032,9 @@ static VirtualDesktop *resolveVirtualDesktop(int desktopId)
}
}
QRectF EffectsHandlerImpl::clientArea(clientAreaOption opt, const EffectScreen *screen, int desktop) const
QRectF EffectsHandlerImpl::clientArea(clientAreaOption opt, const Output *screen, int desktop) const
{
const EffectScreenImpl *screenImpl = static_cast<const EffectScreenImpl *>(screen);
return Workspace::self()->clientArea(opt, screenImpl->platformOutput(), resolveVirtualDesktop(desktop));
return Workspace::self()->clientArea(opt, screen, resolveVirtualDesktop(desktop));
}
QRectF EffectsHandlerImpl::clientArea(clientAreaOption opt, const EffectWindow *effectWindow) const
@ -1152,9 +1145,7 @@ void EffectsHandlerImpl::registerTouchBorder(ElectricBorder border, QAction *act
void EffectsHandlerImpl::registerRealtimeTouchBorder(ElectricBorder border, QAction *action, EffectsHandler::TouchBorderCallback progressCallback)
{
workspace()->screenEdges()->reserveTouch(border, action, [progressCallback](ElectricBorder border, const QPointF &deltaProgress, Output *output) {
progressCallback(border, deltaProgress, EffectScreenImpl::get(output));
});
workspace()->screenEdges()->reserveTouch(border, action, progressCallback);
}
void EffectsHandlerImpl::unregisterTouchBorder(ElectricBorder border, QAction *action)
@ -1579,19 +1570,20 @@ SessionState EffectsHandlerImpl::sessionState() const
return Workspace::self()->sessionManager()->state();
}
QList<EffectScreen *> EffectsHandlerImpl::screens() const
QList<Output *> EffectsHandlerImpl::screens() const
{
return m_effectScreens;
return Workspace::self()->outputs();
}
EffectScreen *EffectsHandlerImpl::screenAt(const QPoint &point) const
Output *EffectsHandlerImpl::screenAt(const QPoint &point) const
{
return EffectScreenImpl::get(Workspace::self()->outputAt(point));
return Workspace::self()->outputAt(point);
}
EffectScreen *EffectsHandlerImpl::findScreen(const QString &name) const
Output *EffectsHandlerImpl::findScreen(const QString &name) const
{
for (EffectScreen *screen : std::as_const(m_effectScreens)) {
const auto outputs = Workspace::self()->outputs();
for (Output *screen : outputs) {
if (screen->name() == name) {
return screen;
}
@ -1599,32 +1591,15 @@ EffectScreen *EffectsHandlerImpl::findScreen(const QString &name) const
return nullptr;
}
EffectScreen *EffectsHandlerImpl::findScreen(int screenId) const
Output *EffectsHandlerImpl::findScreen(int screenId) const
{
return m_effectScreens.value(screenId);
return Workspace::self()->outputs().value(screenId);
}
void EffectsHandlerImpl::slotOutputAdded(Output *output)
{
EffectScreen *screen = new EffectScreenImpl(output, this);
m_effectScreens.append(screen);
Q_EMIT screenAdded(screen);
}
void EffectsHandlerImpl::slotOutputRemoved(Output *output)
{
EffectScreen *screen = EffectScreenImpl::get(output);
m_effectScreens.removeOne(screen);
Q_EMIT screenRemoved(screen);
delete screen;
}
void EffectsHandlerImpl::renderScreen(EffectScreen *screen)
void EffectsHandlerImpl::renderScreen(Output *output)
{
RenderTarget renderTarget(GLFramebuffer::currentFramebuffer());
auto output = static_cast<EffectScreenImpl *>(screen)->platformOutput();
RenderLayer layer(output->renderLoop());
SceneDelegate delegate(m_scene, output);
delegate.setLayer(&layer);
@ -1670,81 +1645,6 @@ QQmlEngine *EffectsHandlerImpl::qmlEngine() const
return Scripting::self()->qmlEngine();
}
//****************************************
// EffectScreenImpl
//****************************************
EffectScreenImpl::EffectScreenImpl(Output *output, QObject *parent)
: EffectScreen(parent)
, m_platformOutput(output)
{
m_platformOutput->m_effectScreen = this;
connect(output, &Output::aboutToChange, this, &EffectScreen::aboutToChange);
connect(output, &Output::changed, this, &EffectScreen::changed);
connect(output, &Output::wakeUp, this, &EffectScreen::wakeUp);
connect(output, &Output::aboutToTurnOff, this, &EffectScreen::aboutToTurnOff);
connect(output, &Output::scaleChanged, this, &EffectScreen::devicePixelRatioChanged);
connect(output, &Output::geometryChanged, this, &EffectScreen::geometryChanged);
}
EffectScreenImpl::~EffectScreenImpl()
{
if (m_platformOutput) {
m_platformOutput->m_effectScreen = nullptr;
}
}
EffectScreenImpl *EffectScreenImpl::get(Output *output)
{
return output->m_effectScreen;
}
Output *EffectScreenImpl::platformOutput() const
{
return m_platformOutput;
}
QString EffectScreenImpl::name() const
{
return m_platformOutput->name();
}
QString EffectScreenImpl::manufacturer() const
{
return m_platformOutput->manufacturer();
}
QString EffectScreenImpl::model() const
{
return m_platformOutput->model();
}
QString EffectScreenImpl::serialNumber() const
{
return m_platformOutput->serialNumber();
}
qreal EffectScreenImpl::devicePixelRatio() const
{
return m_platformOutput->scale();
}
QRect EffectScreenImpl::geometry() const
{
return m_platformOutput->geometry();
}
int EffectScreenImpl::refreshRate() const
{
return m_platformOutput->refreshRate();
}
EffectScreen::Transform EffectScreenImpl::transform() const
{
return EffectScreen::Transform(m_platformOutput->transform().kind());
}
//****************************************
// EffectWindowImpl
//****************************************
@ -1885,9 +1785,9 @@ void EffectWindowImpl::unrefWindow()
Q_UNREACHABLE(); // TODO
}
EffectScreen *EffectWindowImpl::screen() const
Output *EffectWindowImpl::screen() const
{
return EffectScreenImpl::get(m_window->output());
return m_window->output();
}
#define WINDOW_HELPER(rettype, prototype, toplevelPrototype) \

View file

@ -50,7 +50,7 @@ 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, EffectScreen *screen) 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;
@ -65,7 +65,7 @@ public:
EffectWindow *activeWindow() const override;
void moveWindow(EffectWindow *w, const QPoint &pos, bool snap = false, double snapAdjust = 1.0) override;
void windowToDesktop(EffectWindow *w, int desktop) override;
void windowToScreen(EffectWindow *w, EffectScreen *screen) override;
void windowToScreen(EffectWindow *w, Output *screen) override;
void setShowingDesktop(bool showing) override;
QString currentActivity() const override;
@ -126,8 +126,8 @@ public:
void addRepaint(const QRegion &r) override;
void addRepaint(int x, int y, int w, int h) override;
EffectScreen *activeScreen() const override;
QRectF clientArea(clientAreaOption, const EffectScreen *screen, int desktop) const override;
Output *activeScreen() const override;
QRectF clientArea(clientAreaOption, const Output *screen, int desktop) const override;
QRectF clientArea(clientAreaOption, const EffectWindow *c) const override;
QRectF clientArea(clientAreaOption, const QPoint &p, int desktop) const override;
QSize virtualScreenSize() const override;
@ -238,11 +238,11 @@ public:
void renderOffscreenQuickView(const RenderTarget &renderTarget, const RenderViewport &viewport, OffscreenQuickView *effectQuickView) const override;
SessionState sessionState() const override;
QList<EffectScreen *> screens() const override;
EffectScreen *screenAt(const QPoint &point) const override;
EffectScreen *findScreen(const QString &name) const override;
EffectScreen *findScreen(int screenId) const override;
void renderScreen(EffectScreen *screen) 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;
@ -262,10 +262,6 @@ public Q_SLOTS:
Q_SCRIPTABLE QString supportInformation(const QString &name) const;
Q_SCRIPTABLE QString debug(const QString &name, const QString &parameter = QString()) const;
protected Q_SLOTS:
void slotOutputAdded(Output *output);
void slotOutputRemoved(Output *output);
protected:
void connectNotify(const QMetaMethod &signal) override;
void disconnectNotify(const QMetaMethod &signal) override;
@ -321,32 +317,6 @@ private:
EffectLoader *m_effectLoader;
int m_trackingCursorChanges;
std::unique_ptr<WindowPropertyNotifyX11Filter> m_x11WindowPropertyNotify;
QList<EffectScreen *> m_effectScreens;
};
class EffectScreenImpl : public EffectScreen
{
Q_OBJECT
public:
explicit EffectScreenImpl(Output *output, QObject *parent = nullptr);
~EffectScreenImpl() override;
Output *platformOutput() const;
QString name() const override;
QString manufacturer() const override;
QString model() const override;
QString serialNumber() const override;
qreal devicePixelRatio() const override;
QRect geometry() const override;
int refreshRate() const override;
Transform transform() const override;
static EffectScreenImpl *get(Output *output);
private:
QPointer<Output> m_platformOutput;
};
class EffectWindowImpl : public EffectWindow
@ -386,7 +356,7 @@ public:
QString caption() const override;
QRectF expandedGeometry() const override;
EffectScreen *screen() const override;
Output *screen() const override;
QPointF pos() const override;
QSizeF size() const override;
QRectF rect() const override;

View file

@ -241,7 +241,7 @@ void EffectTogglableTouchBorder::setBorders(const QList<int> &touchActivateBorde
for (const int &border : touchActivateBorders) {
m_touchBorderActivate.append(ElectricBorder(border));
effects->registerRealtimeTouchBorder(ElectricBorder(border), m_state->toggleAction(), [this](ElectricBorder border, const QPointF &deltaProgress, const EffectScreen *screen) {
effects->registerRealtimeTouchBorder(ElectricBorder(border), m_state->toggleAction(), [this](ElectricBorder border, const QPointF &deltaProgress, const Output *screen) {
if (m_state->status() == EffectTogglableState::Status::Active) {
return;
}

View file

@ -10,6 +10,7 @@
*/
#include "libkwineffects/kwineffects.h"
#include "core/output.h"
#include "config-kwin.h"
@ -431,7 +432,7 @@ void Effect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds
effects->prePaintScreen(data, presentTime);
}
void Effect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void Effect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);
}
@ -627,21 +628,6 @@ bool EffectsHandler::isOpenGLCompositing() const
EffectsHandler *effects = nullptr;
EffectScreen::EffectScreen(QObject *parent)
: QObject(parent)
{
}
QPointF EffectScreen::mapToGlobal(const QPointF &pos) const
{
return pos + geometry().topLeft();
}
QPointF EffectScreen::mapFromGlobal(const QPointF &pos) const
{
return pos - geometry().topLeft();
}
//****************************************
// EffectWindow
//****************************************

View file

@ -73,7 +73,7 @@ class EffectWindowGroup;
class EffectFrame;
class EffectFramePrivate;
class OffscreenQuickView;
class EffectScreen;
class Output;
class Effect;
class WindowQuad;
class WindowQuadList;
@ -380,7 +380,7 @@ public:
* In OpenGL based compositing, the frameworks ensures that the context is current
* when this method is invoked.
*/
virtual void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen);
virtual void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen);
/**
* Called after all the painting has been finished.
* In this method you can:
@ -801,7 +801,7 @@ class KWIN_EXPORT EffectsHandler : public QObject
*/
Q_PROPERTY(int desktops READ numberOfDesktops WRITE setNumberOfDesktops NOTIFY numberDesktopsChanged)
Q_PROPERTY(bool optionRollOverDesktops READ optionRollOverDesktops)
Q_PROPERTY(KWin::EffectScreen *activeScreen READ activeScreen)
Q_PROPERTY(KWin::Output *activeScreen READ activeScreen)
/**
* Factor by which animation speed in the effect should be modified (multiplied).
* If configurable in the effect itself, the option should have also 'default'
@ -832,13 +832,13 @@ class KWIN_EXPORT EffectsHandler : public QObject
friend class Effect;
public:
using TouchBorderCallback = std::function<void(ElectricBorder border, const QPointF &, EffectScreen *screen)>;
using TouchBorderCallback = std::function<void(ElectricBorder border, const QPointF &, Output *screen)>;
explicit EffectsHandler(CompositingType type);
~EffectsHandler() override;
// 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, EffectScreen *screen) = 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;
@ -982,7 +982,7 @@ public:
*/
Q_SCRIPTABLE virtual void windowToDesktops(KWin::EffectWindow *w, const QList<uint> &desktopIds) = 0;
Q_SCRIPTABLE virtual void windowToScreen(KWin::EffectWindow *w, EffectScreen *screen) = 0;
Q_SCRIPTABLE virtual void windowToScreen(KWin::EffectWindow *w, Output *screen) = 0;
virtual void setShowingDesktop(bool showing) = 0;
// Activities
@ -1063,8 +1063,8 @@ public:
Q_SCRIPTABLE virtual QString desktopName(int desktop) const = 0;
virtual bool optionRollOverDesktops() const = 0;
virtual EffectScreen *activeScreen() const = 0; // Xinerama
virtual QRectF clientArea(clientAreaOption, const EffectScreen *screen, int desktop) const = 0;
virtual Output *activeScreen() const = 0; // Xinerama
virtual QRectF clientArea(clientAreaOption, const Output *screen, int desktop) const = 0;
virtual QRectF clientArea(clientAreaOption, const EffectWindow *c) const = 0;
virtual QRectF clientArea(clientAreaOption, const QPoint &p, int desktop) const = 0;
@ -1392,15 +1392,15 @@ public:
/**
* Returns the list of all the screens connected to the system.
*/
virtual QList<EffectScreen *> screens() const = 0;
virtual EffectScreen *screenAt(const QPoint &point) const = 0;
virtual EffectScreen *findScreen(const QString &name) const = 0;
virtual EffectScreen *findScreen(int screenId) const = 0;
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;
/**
* Renders @p screen in the current render target
*/
virtual void renderScreen(EffectScreen *screen) = 0;
virtual void renderScreen(Output *screen) = 0;
virtual KWin::EffectWindow *inputPanel() const = 0;
virtual bool isInputPanelOverlay() const = 0;
@ -1411,11 +1411,11 @@ Q_SIGNALS:
/**
* This signal is emitted whenever a new @a screen is added to the system.
*/
void screenAdded(KWin::EffectScreen *screen);
void screenAdded(KWin::Output *screen);
/**
* This signal is emitted whenever a @a screen is removed from the system.
*/
void screenRemoved(KWin::EffectScreen *screen);
void screenRemoved(KWin::Output *screen);
/**
* Signal emitted when the current desktop changed.
* @param oldDesktop The previously current desktop
@ -1702,100 +1702,6 @@ protected:
CompositingType compositing_type;
};
/**
* The EffectScreen class represents a screen used by/for Effect classes.
*/
class KWIN_EXPORT EffectScreen : public QObject
{
Q_OBJECT
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged)
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
Q_PROPERTY(QString model READ model CONSTANT)
Q_PROPERTY(QString serialNumber READ serialNumber CONSTANT)
Q_PROPERTY(qreal refreshRate READ refreshRate CONSTANT)
public:
explicit EffectScreen(QObject *parent = nullptr);
/**
* Returns the name of the screen, e.g. "DP-1".
*/
virtual QString name() const = 0;
/**
* Returns the screen's ratio between physical pixels and device-independent pixels.
*/
virtual qreal devicePixelRatio() const = 0;
/**
* Returns the screen's geometry in the device-independent pixels.
*/
virtual QRect geometry() const = 0;
Q_INVOKABLE QPointF mapToGlobal(const QPointF &pos) const;
Q_INVOKABLE QPointF mapFromGlobal(const QPointF &pos) const;
/**
* Returns the screen's refresh rate in milli-hertz.
*/
virtual int refreshRate() const = 0;
enum class Transform {
Normal,
Rotated90,
Rotated180,
Rotated270,
Flipped,
Flipped90,
Flipped180,
Flipped270
};
Q_ENUM(Transform)
virtual Transform transform() const = 0;
virtual QString manufacturer() const = 0;
virtual QString model() const = 0;
virtual QString serialNumber() const = 0;
Q_SIGNALS:
/**
* Notifies that the display will be dimmed in @p time ms.
*/
void aboutToTurnOff(std::chrono::milliseconds time);
/**
* Notifies that the output has been turned on and the wake can be decorated.
*/
void wakeUp();
/**
* This signal is emitted when the geometry of this screen changes.
*/
void geometryChanged();
/**
* This signal is emitted when the device pixel ratio of this screen changes.
*/
void devicePixelRatioChanged();
/**
* Notifies that the output is about to change configuration based on a
* user interaction.
*
* Be it because it gets a transformation or moved around.
*/
void aboutToChange();
/**
* Notifies that the output changed based on a user interaction.
*
* Be it because it gets a transformation or moved around.
*/
void changed();
};
class EffectWindowVisibleRef;
/**
* @short Representation of a window used by/for Effect classes.
@ -1811,7 +1717,7 @@ class KWIN_EXPORT EffectWindow : public QObject
Q_PROPERTY(qreal height READ height)
Q_PROPERTY(qreal opacity READ opacity)
Q_PROPERTY(QPointF pos READ pos)
Q_PROPERTY(KWin::EffectScreen *screen READ screen)
Q_PROPERTY(KWin::Output *screen READ screen)
Q_PROPERTY(QSizeF size READ size)
Q_PROPERTY(qreal width READ width)
Q_PROPERTY(qreal x READ x)
@ -2170,7 +2076,7 @@ public:
* @since 4.9
*/
virtual QRectF expandedGeometry() const = 0;
virtual EffectScreen *screen() const = 0;
virtual Output *screen() const = 0;
virtual QPointF pos() const = 0;
virtual QSizeF size() const = 0;
virtual QRectF rect() const = 0;
@ -3296,7 +3202,7 @@ class KWIN_EXPORT ScreenPrePaintData
public:
int mask;
QRegion paint;
EffectScreen *screen = nullptr;
Output *screen = nullptr;
};
/**

View file

@ -5,6 +5,7 @@
*/
#include "libkwineffects/kwinoffscreeneffect.h"
#include "core/output.h"
#include "libkwineffects/gltexture.h"
#include "libkwineffects/glutils.h"
#include "libkwineffects/rendertarget.h"
@ -94,7 +95,7 @@ void OffscreenEffect::apply(EffectWindow *window, int mask, WindowPaintData &dat
void OffscreenData::maybeRender(EffectWindow *window)
{
const QRectF logicalGeometry = window->expandedGeometry();
const qreal scale = window->screen()->devicePixelRatio();
const qreal scale = window->screen()->scale();
const QSize textureSize = (logicalGeometry.size() * scale).toSize();
if (!m_texture || m_texture->size() != textureSize) {

View file

@ -5,6 +5,7 @@
*/
#include "libkwineffects/kwinquickeffect.h"
#include "core/output.h"
#include "logging_p.h"
@ -22,7 +23,7 @@ static QHash<QQuickWindow *, QuickSceneView *> s_views;
class QuickSceneViewIncubator : public QQmlIncubator
{
public:
QuickSceneViewIncubator(QuickSceneEffect *effect, EffectScreen *screen, const std::function<void(QuickSceneViewIncubator *)> &statusChangedCallback)
QuickSceneViewIncubator(QuickSceneEffect *effect, Output *screen, const std::function<void(QuickSceneViewIncubator *)> &statusChangedCallback)
: QQmlIncubator(QQmlIncubator::Asynchronous)
, m_effect(effect)
, m_screen(screen)
@ -49,7 +50,7 @@ public:
private:
QuickSceneEffect *m_effect;
EffectScreen *m_screen;
Output *m_screen;
std::function<void(QuickSceneViewIncubator *)> m_statusChangedCallback;
std::unique_ptr<QuickSceneView> m_view;
};
@ -61,18 +62,18 @@ public:
{
return effect->d.get();
}
bool isItemOnScreen(QQuickItem *item, EffectScreen *screen) const;
bool isItemOnScreen(QQuickItem *item, Output *screen) const;
std::unique_ptr<QQmlComponent> delegate;
QUrl source;
std::map<EffectScreen *, std::unique_ptr<QQmlContext>> contexts;
std::map<EffectScreen *, std::unique_ptr<QQmlIncubator>> incubators;
std::map<EffectScreen *, std::unique_ptr<QuickSceneView>> views;
std::map<Output *, std::unique_ptr<QQmlContext>> contexts;
std::map<Output *, std::unique_ptr<QQmlIncubator>> incubators;
std::map<Output *, std::unique_ptr<QuickSceneView>> views;
QPointer<QuickSceneView> mouseImplicitGrab;
bool running = false;
};
bool QuickSceneEffectPrivate::isItemOnScreen(QQuickItem *item, EffectScreen *screen) const
bool QuickSceneEffectPrivate::isItemOnScreen(QQuickItem *item, Output *screen) const
{
if (!item || !screen || !views.contains(screen)) {
return false;
@ -82,12 +83,12 @@ bool QuickSceneEffectPrivate::isItemOnScreen(QQuickItem *item, EffectScreen *scr
return item->window() == view->window();
}
QuickSceneView::QuickSceneView(QuickSceneEffect *effect, EffectScreen *screen)
QuickSceneView::QuickSceneView(QuickSceneEffect *effect, Output *screen)
: m_effect(effect)
, m_screen(screen)
{
setGeometry(screen->geometry());
connect(screen, &EffectScreen::geometryChanged, this, [this, screen]() {
connect(screen, &Output::geometryChanged, this, [this, screen]() {
setGeometry(screen->geometry());
});
@ -123,7 +124,7 @@ QuickSceneEffect *QuickSceneView::effect() const
return m_effect;
}
EffectScreen *QuickSceneView::screen() const
Output *QuickSceneView::screen() const
{
return m_screen;
}
@ -184,7 +185,7 @@ bool QuickSceneEffect::supported()
void QuickSceneEffect::checkItemDraggedOutOfScreen(QQuickItem *item)
{
const QRectF globalGeom = QRectF(item->mapToGlobal(QPointF(0, 0)), QSizeF(item->width(), item->height()));
QList<EffectScreen *> screens;
QList<Output *> screens;
for (const auto &[screen, view] : d->views) {
if (!d->isItemOnScreen(item, screen) && screen->geometry().intersects(globalGeom.toRect())) {
@ -198,7 +199,7 @@ void QuickSceneEffect::checkItemDraggedOutOfScreen(QQuickItem *item)
void QuickSceneEffect::checkItemDroppedOutOfScreen(const QPointF &globalPos, QQuickItem *item)
{
const auto it = std::find_if(d->views.begin(), d->views.end(), [this, globalPos, item](const auto &view) {
EffectScreen *screen = view.first;
Output *screen = view.first;
return !d->isItemOnScreen(item, screen) && screen->geometry().contains(globalPos.toPoint());
});
if (it != d->views.end()) {
@ -267,7 +268,7 @@ void QuickSceneEffect::setDelegate(QQmlComponent *delegate)
}
}
QuickSceneView *QuickSceneEffect::viewForScreen(EffectScreen *screen) const
QuickSceneView *QuickSceneEffect::viewForScreen(Output *screen) const
{
const auto it = d->views.find(screen);
return it == d->views.end() ? nullptr : it->second.get();
@ -379,7 +380,7 @@ void QuickSceneEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mil
}
}
void QuickSceneEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void QuickSceneEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
if (effects->waylandDisplay()) {
const auto it = d->views.find(screen);
@ -398,24 +399,24 @@ bool QuickSceneEffect::isActive() const
return !d->views.empty() && !effects->isScreenLocked();
}
QVariantMap QuickSceneEffect::initialProperties(EffectScreen *screen)
QVariantMap QuickSceneEffect::initialProperties(Output *screen)
{
return QVariantMap();
}
void QuickSceneEffect::handleScreenAdded(EffectScreen *screen)
void QuickSceneEffect::handleScreenAdded(Output *screen)
{
addScreen(screen);
}
void QuickSceneEffect::handleScreenRemoved(EffectScreen *screen)
void QuickSceneEffect::handleScreenRemoved(Output *screen)
{
d->views.erase(screen);
d->incubators.erase(screen);
d->contexts.erase(screen);
}
void QuickSceneEffect::addScreen(EffectScreen *screen)
void QuickSceneEffect::addScreen(Output *screen)
{
auto properties = initialProperties(screen);
properties["width"] = screen->geometry().width();
@ -481,8 +482,8 @@ void QuickSceneEffect::startInternal()
// Install an event filter to monitor cursor shape changes.
qApp->installEventFilter(this);
const QList<EffectScreen *> screens = effects->screens();
for (EffectScreen *screen : screens) {
const QList<Output *> screens = effects->screens();
for (Output *screen : screens) {
addScreen(screen);
}

View file

@ -6,6 +6,7 @@
#pragma once
#include "core/output.h"
#include "libkwineffects/kwineffects.h"
#include "libkwineffects/kwinoffscreenquickview.h"
@ -29,15 +30,15 @@ class KWIN_EXPORT QuickSceneView : public OffscreenQuickView
{
Q_OBJECT
Q_PROPERTY(QuickSceneEffect *effect READ effect CONSTANT)
Q_PROPERTY(EffectScreen *screen READ screen CONSTANT)
Q_PROPERTY(Output *screen READ screen CONSTANT)
Q_PROPERTY(QQuickItem *rootItem READ rootItem CONSTANT)
public:
explicit QuickSceneView(QuickSceneEffect *effect, EffectScreen *screen);
explicit QuickSceneView(QuickSceneEffect *effect, Output *screen);
~QuickSceneView() override;
QuickSceneEffect *effect() const;
EffectScreen *screen() const;
Output *screen() const;
QQuickItem *rootItem() const;
void setRootItem(QQuickItem *item);
@ -54,7 +55,7 @@ public Q_SLOTS:
private:
QuickSceneEffect *m_effect;
EffectScreen *m_screen;
Output *m_screen;
std::unique_ptr<QQuickItem> m_rootItem;
bool m_dirty = false;
};
@ -96,7 +97,7 @@ public:
/**
* Returns the scene view on the specified screen
*/
Q_INVOKABLE QuickSceneView *viewForScreen(EffectScreen *screen) const;
Q_INVOKABLE QuickSceneView *viewForScreen(Output *screen) const;
/**
* Returns the view at the specified @a pos in the global screen coordinates.
@ -139,7 +140,7 @@ public:
bool eventFilter(QObject *watched, QEvent *event) override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
bool isActive() const override;
void windowInputMouseEvent(QEvent *event) override;
@ -155,8 +156,8 @@ public:
Q_INVOKABLE void checkItemDroppedOutOfScreen(const QPointF &globalPos, QQuickItem *item);
Q_SIGNALS:
void itemDraggedOutOfScreen(QQuickItem *item, QList<EffectScreen *> screens);
void itemDroppedOutOfScreen(const QPointF &globalPos, QQuickItem *item, EffectScreen *screen);
void itemDraggedOutOfScreen(QQuickItem *item, QList<Output *> screens);
void itemDroppedOutOfScreen(const QPointF &globalPos, QQuickItem *item, Output *screen);
void activeViewChanged(KWin::QuickSceneView *view);
void delegateChanged();
@ -167,13 +168,13 @@ protected:
*
* @see QQmlComponent::createWithInitialProperties()
*/
virtual QVariantMap initialProperties(EffectScreen *screen);
virtual QVariantMap initialProperties(Output *screen);
private:
void handleScreenAdded(EffectScreen *screen);
void handleScreenRemoved(EffectScreen *screen);
void handleScreenAdded(Output *screen);
void handleScreenRemoved(Output *screen);
void addScreen(EffectScreen *screen);
void addScreen(Output *screen);
void startInternal();
void stopInternal();

View file

@ -286,7 +286,7 @@ void BlurEffect::slotWindowDeleted(EffectWindow *w)
}
}
void BlurEffect::slotScreenRemoved(KWin::EffectScreen *screen)
void BlurEffect::slotScreenRemoved(KWin::Output *screen)
{
for (auto &[window, data] : m_windows) {
if (auto it = data.render.find(screen); it != data.render.end()) {

View file

@ -33,7 +33,7 @@ struct BlurEffectData
QRegion region;
/// The render data per screen. Screens can have different color spaces.
std::unordered_map<EffectScreen *, BlurRenderData> render;
std::unordered_map<Output *, BlurRenderData> render;
};
class BlurEffect : public KWin::Effect
@ -67,7 +67,7 @@ public:
public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow *w);
void slotWindowDeleted(KWin::EffectWindow *w);
void slotScreenRemoved(KWin::EffectScreen *screen);
void slotScreenRemoved(KWin::Output *screen);
void slotPropertyNotify(KWin::EffectWindow *w, long atom);
void setupDecorationConnections(EffectWindow *w);
@ -114,7 +114,7 @@ private:
long net_wm_blur_region = 0;
QRegion m_paintedArea; // keeps track of all painted areas (from bottom to top)
QRegion m_currentBlur; // keeps track of the currently blured area of the windows(from bottom to top)
EffectScreen *m_currentScreen = nullptr;
Output *m_currentScreen = nullptr;
size_t m_iterationCount; // number of times the texture will be downsized to half size
int m_offset;

View file

@ -52,7 +52,7 @@ ColorPickerEffect::ColorPickerEffect()
ColorPickerEffect::~ColorPickerEffect() = default;
void ColorPickerEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void ColorPickerEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);

View file

@ -25,7 +25,7 @@ class ColorPickerEffect : public Effect, protected QDBusContext
public:
ColorPickerEffect();
~ColorPickerEffect() override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
bool isActive() const override;
int requestedEffectChainPosition() const override

View file

@ -8,6 +8,7 @@
*/
// own
#include "kscreen.h"
#include "core/output.h"
// KConfigSkeleton
#include "kscreenconfig.h"
#include <QDebug>
@ -55,12 +56,12 @@ KscreenEffect::KscreenEffect()
}
reconfigure(ReconfigureAll);
const QList<EffectScreen *> screens = effects->screens();
const QList<Output *> screens = effects->screens();
for (auto screen : screens) {
addScreen(screen);
}
connect(effects, &EffectsHandler::screenAdded, this, &KscreenEffect::addScreen);
connect(effects, &EffectsHandler::screenRemoved, this, [this](KWin::EffectScreen *screen) {
connect(effects, &EffectsHandler::screenRemoved, this, [this](KWin::Output *screen) {
m_waylandStates.remove(screen);
});
}
@ -69,14 +70,14 @@ KscreenEffect::~KscreenEffect()
{
}
void KscreenEffect::addScreen(EffectScreen *screen)
void KscreenEffect::addScreen(Output *screen)
{
connect(screen, &EffectScreen::wakeUp, this, [this, screen] {
connect(screen, &Output::wakeUp, this, [this, screen] {
auto &state = m_waylandStates[screen];
state.m_timeLine.setDuration(std::chrono::milliseconds(animationTime<KscreenConfig>(250)));
setState(state, StateFadingIn);
});
connect(screen, &EffectScreen::aboutToTurnOff, this, [this, screen](std::chrono::milliseconds dimmingIn) {
connect(screen, &Output::aboutToTurnOff, this, [this, screen](std::chrono::milliseconds dimmingIn) {
auto &state = m_waylandStates[screen];
state.m_timeLine.setDuration(dimmingIn);
setState(state, StateFadingOut);
@ -210,7 +211,7 @@ bool KscreenEffect::isActive() const
return !m_waylandStates.isEmpty() || (!effects->waylandDisplay() && m_atom && m_xcbState.m_state != StateNormal);
}
bool KscreenEffect::isScreenActive(EffectScreen *screen) const
bool KscreenEffect::isScreenActive(Output *screen) const
{
return m_waylandStates.contains(screen) || (!effects->waylandDisplay() && m_atom && m_xcbState.m_state != StateNormal);
}

View file

@ -53,12 +53,12 @@ private:
void switchState(ScreenState &state);
void setState(ScreenState &state, FadeOutState newState);
void addScreen(EffectScreen *screen);
bool isScreenActive(EffectScreen *screen) const;
void addScreen(Output *screen);
bool isScreenActive(Output *screen) const;
QHash<EffectScreen *, ScreenState> m_waylandStates;
QHash<Output *, ScreenState> m_waylandStates;
ScreenState m_xcbState;
EffectScreen *m_currentScreen = nullptr;
Output *m_currentScreen = nullptr;
xcb_atom_t m_atom;
};

View file

@ -114,7 +114,7 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mill
}
}
void MagnifierEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void MagnifierEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen); // paint normal screen
if (m_zoom != 1.0) {

View file

@ -28,7 +28,7 @@ public:
~MagnifierEffect() override;
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void postPaintScreen() override;
bool isActive() const override;
static bool supported();

View file

@ -97,7 +97,7 @@ void MouseClickEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mil
effects->prePaintScreen(data, presentTime);
}
void MouseClickEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void MouseClickEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);

View file

@ -97,7 +97,7 @@ public:
~MouseClickEffect() override;
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void postPaintScreen() override;
bool isActive() const override;

View file

@ -99,7 +99,7 @@ void MouseMarkEffect::reconfigure(ReconfigureFlags)
}
}
void MouseMarkEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void MouseMarkEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen); // paint normal screen
if (marks.isEmpty() && drawing.isEmpty()) {

View file

@ -28,7 +28,7 @@ public:
MouseMarkEffect();
~MouseMarkEffect() override;
void reconfigure(ReconfigureFlags) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
bool isActive() const override;
int requestedEffectChainPosition() const override;

View file

@ -5,8 +5,9 @@
*/
#include "outputlocator.h"
#include "core/output.h"
#include "libkwineffects/kwinoffscreenquickview.h"
#include <algorithm>
#include <KLocalizedString>
@ -17,13 +18,13 @@
namespace KWin
{
static QString outputName(const EffectScreen *screen)
static QString outputName(const Output *screen)
{
const auto screens = effects->screens();
const bool shouldShowSerialNumber = std::any_of(screens.cbegin(), screens.cend(), [screen](const EffectScreen *other) {
const bool shouldShowSerialNumber = std::any_of(screens.cbegin(), screens.cend(), [screen](const Output *other) {
return other != screen && other->manufacturer() == screen->manufacturer() && other->model() == screen->model();
});
const bool shouldShowConnector = shouldShowSerialNumber && std::any_of(screens.cbegin(), screens.cend(), [screen](const EffectScreen *other) {
const bool shouldShowConnector = shouldShowSerialNumber && std::any_of(screens.cbegin(), screens.cend(), [screen](const Output *other) {
return other != screen && other->serialNumber() == screen->serialNumber();
});
@ -77,7 +78,7 @@ void OutputLocatorEffect::show()
const auto screens = effects->screens();
for (const auto screen : screens) {
auto scene = new OffscreenQuickScene();
scene->setSource(m_qmlUrl, {{QStringLiteral("outputName"), outputName(screen)}, {QStringLiteral("resolution"), screen->geometry().size()}, {QStringLiteral("scale"), screen->devicePixelRatio()}});
scene->setSource(m_qmlUrl, {{QStringLiteral("outputName"), outputName(screen)}, {QStringLiteral("resolution"), screen->geometry().size()}, {QStringLiteral("scale"), screen->scale()}});
QRectF geometry(0, 0, scene->rootItem()->implicitWidth(), scene->rootItem()->implicitHeight());
geometry.moveCenter(screen->geometry().center());
scene->setGeometry(geometry.toRect());
@ -103,7 +104,7 @@ void OutputLocatorEffect::hide()
effects->addRepaint(repaintRegion);
}
void OutputLocatorEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::EffectScreen *screen)
void OutputLocatorEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);
// On X11 all screens are painted at once

View file

@ -22,7 +22,7 @@ class OutputLocatorEffect : public KWin::Effect
public:
explicit OutputLocatorEffect(QObject *parent = nullptr);
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::Output *screen) override;
bool isActive() const override;
public Q_SLOTS:
@ -32,6 +32,6 @@ public Q_SLOTS:
private:
QUrl m_qmlUrl;
QTimer m_showTimer;
std::unordered_map<EffectScreen *, std::unique_ptr<OffscreenQuickScene>> m_scenesByScreens;
std::unordered_map<Output *, std::unique_ptr<OffscreenQuickScene>> m_scenesByScreens;
};
}

View file

@ -5,6 +5,7 @@
*/
#include "expoarea.h"
#include "core/output.h"
namespace KWin
{
@ -34,20 +35,20 @@ qreal ExpoArea::height() const
return m_rect.height();
}
EffectScreen *ExpoArea::screen() const
Output *ExpoArea::screen() const
{
return m_screen;
}
void ExpoArea::setScreen(EffectScreen *screen)
void ExpoArea::setScreen(Output *screen)
{
if (m_screen != screen) {
if (m_screen) {
disconnect(m_screen, &EffectScreen::geometryChanged, this, &ExpoArea::update);
disconnect(m_screen, &Output::geometryChanged, this, &ExpoArea::update);
}
m_screen = screen;
if (m_screen) {
connect(m_screen, &EffectScreen::geometryChanged, this, &ExpoArea::update);
connect(m_screen, &Output::geometryChanged, this, &ExpoArea::update);
}
update();
Q_EMIT screenChanged();

View file

@ -14,7 +14,7 @@ namespace KWin
class ExpoArea : public QObject
{
Q_OBJECT
Q_PROPERTY(KWin::EffectScreen *screen READ screen WRITE setScreen NOTIFY screenChanged)
Q_PROPERTY(KWin::Output *screen READ screen WRITE setScreen NOTIFY screenChanged)
Q_PROPERTY(qreal x READ x NOTIFY xChanged)
Q_PROPERTY(qreal y READ y NOTIFY yChanged)
Q_PROPERTY(qreal width READ width NOTIFY widthChanged)
@ -23,8 +23,8 @@ class ExpoArea : public QObject
public:
explicit ExpoArea(QObject *parent = nullptr);
EffectScreen *screen() const;
void setScreen(EffectScreen *screen);
Output *screen() const;
void setScreen(Output *screen);
qreal x() const;
qreal y() const;
@ -42,7 +42,7 @@ private:
void update();
QRectF m_rect;
EffectScreen *m_screen = nullptr;
Output *m_screen = nullptr;
};
} // namespace KWin

View file

@ -88,7 +88,7 @@ void ScreenEdgeEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mil
}
}
void ScreenEdgeEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void ScreenEdgeEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);
for (auto &[border, glow] : m_borders) {

View file

@ -29,7 +29,7 @@ public:
ScreenEdgeEffect();
~ScreenEdgeEffect() override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
bool isActive() const override;
int requestedEffectChainPosition() const override

View file

@ -11,6 +11,7 @@
#include "screenshot.h"
#include "screenshotdbusinterface2.h"
#include "core/output.h"
#include "libkwineffects/glplatform.h"
#include "libkwineffects/glutils.h"
#include "libkwineffects/rendertarget.h"
@ -34,14 +35,14 @@ struct ScreenShotAreaData
ScreenShotFlags flags;
QRect area;
QImage result;
QList<EffectScreen *> screens;
QList<Output *> screens;
};
struct ScreenShotScreenData
{
QPromise<QImage> promise;
ScreenShotFlags flags;
EffectScreen *screen = nullptr;
Output *screen = nullptr;
};
static void convertFromGLImage(QImage &img, int w, int h, const QMatrix4x4 &renderTargetTransformation)
@ -100,7 +101,7 @@ ScreenShotEffect::~ScreenShotEffect()
cancelScreenScreenShots();
}
QFuture<QImage> ScreenShotEffect::scheduleScreenShot(EffectScreen *screen, ScreenShotFlags flags)
QFuture<QImage> ScreenShotEffect::scheduleScreenShot(Output *screen, ScreenShotFlags flags)
{
for (const ScreenShotScreenData &data : m_screenScreenShots) {
if (data.screen == screen && data.flags == flags) {
@ -133,8 +134,8 @@ QFuture<QImage> ScreenShotEffect::scheduleScreenShot(const QRect &area, ScreenSh
data.area = area;
data.flags = flags;
const QList<EffectScreen *> screens = effects->screens();
for (EffectScreen *screen : screens) {
const QList<Output *> screens = effects->screens();
for (Output *screen : screens) {
if (screen->geometry().intersects(area)) {
data.screens.append(screen);
}
@ -142,9 +143,9 @@ QFuture<QImage> ScreenShotEffect::scheduleScreenShot(const QRect &area, ScreenSh
qreal devicePixelRatio = 1.0;
if (flags & ScreenShotNativeResolution) {
for (const EffectScreen *screen : std::as_const(data.screens)) {
if (screen->devicePixelRatio() > devicePixelRatio) {
devicePixelRatio = screen->devicePixelRatio();
for (const Output *screen : std::as_const(data.screens)) {
if (screen->scale() > devicePixelRatio) {
devicePixelRatio = screen->scale();
}
}
}
@ -198,7 +199,7 @@ void ScreenShotEffect::cancelScreenScreenShots()
m_screenScreenShots.clear();
}
void ScreenShotEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void ScreenShotEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
m_paintedScreen = screen;
effects->paintScreen(renderTarget, viewport, mask, region, screen);
@ -236,8 +237,8 @@ void ScreenShotEffect::takeScreenShot(ScreenShotWindowData *screenshot)
}
if (screenshot->flags & ScreenShotNativeResolution) {
if (const EffectScreen *screen = window->screen()) {
devicePixelRatio = screen->devicePixelRatio();
if (const Output *screen = window->screen()) {
devicePixelRatio = screen->scale();
}
}
@ -313,7 +314,7 @@ bool ScreenShotEffect::takeScreenShot(const RenderTarget &renderTarget, const Re
const QRect sourceRect = screenshot->area & m_paintedScreen->geometry();
qreal sourceDevicePixelRatio = 1.0;
if (screenshot->flags & ScreenShotNativeResolution) {
sourceDevicePixelRatio = m_paintedScreen->devicePixelRatio();
sourceDevicePixelRatio = m_paintedScreen->scale();
}
const QImage snapshot = blitScreenshot(renderTarget, viewport, sourceRect, sourceDevicePixelRatio);
@ -346,7 +347,7 @@ bool ScreenShotEffect::takeScreenShot(const RenderTarget &renderTarget, const Re
qreal devicePixelRatio = 1.0;
if (screenshot->flags & ScreenShotNativeResolution) {
devicePixelRatio = screenshot->screen->devicePixelRatio();
devicePixelRatio = screenshot->screen->scale();
}
QImage snapshot = blitScreenshot(renderTarget, viewport, screenshot->screen->geometry(), devicePixelRatio);
@ -430,7 +431,7 @@ void ScreenShotEffect::handleScreenAdded()
cancelAreaScreenShots();
}
void ScreenShotEffect::handleScreenRemoved(EffectScreen *screen)
void ScreenShotEffect::handleScreenRemoved(Output *screen)
{
cancelAreaScreenShots();

View file

@ -56,7 +56,7 @@ public:
* the image data. If the screen is removed before the screenshot is taken, the future will
* be cancelled.
*/
QFuture<QImage> scheduleScreenShot(EffectScreen *screen, ScreenShotFlags flags = {});
QFuture<QImage> scheduleScreenShot(Output *screen, ScreenShotFlags flags = {});
/**
* Schedules a screenshot of the given @a area. The returned QFuture can be used to query the
@ -71,7 +71,7 @@ public:
*/
QFuture<QImage> scheduleScreenShot(EffectWindow *window, ScreenShotFlags flags = {});
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
bool isActive() const override;
int requestedEffectChainPosition() const override;
@ -80,7 +80,7 @@ public:
private Q_SLOTS:
void handleWindowClosed(EffectWindow *window);
void handleScreenAdded();
void handleScreenRemoved(EffectScreen *screen);
void handleScreenRemoved(Output *screen);
private:
void takeScreenShot(ScreenShotWindowData *screenshot);
@ -99,7 +99,7 @@ private:
std::vector<ScreenShotScreenData> m_screenScreenShots;
std::unique_ptr<ScreenShotDBusInterface2> m_dbusInterface2;
EffectScreen *m_paintedScreen = nullptr;
Output *m_paintedScreen = nullptr;
};
} // namespace KWin

View file

@ -7,6 +7,7 @@
*/
#include "screenshotdbusinterface2.h"
#include "core/output.h"
#include "screenshot2adaptor.h"
#include "screenshotlogging.h"
#include "utils/filedescriptor.h"
@ -169,12 +170,12 @@ class ScreenShotSourceScreen2 : public ScreenShotSource2
Q_OBJECT
public:
ScreenShotSourceScreen2(ScreenShotEffect *effect, EffectScreen *screen, ScreenShotFlags flags);
ScreenShotSourceScreen2(ScreenShotEffect *effect, Output *screen, ScreenShotFlags flags);
QVariantMap attributes() const override;
private:
EffectScreen *m_screen;
Output *m_screen;
};
class ScreenShotSourceArea2 : public ScreenShotSource2
@ -243,7 +244,7 @@ void ScreenShotSource2::marshal(ScreenShotSinkPipe2 *sink)
}
ScreenShotSourceScreen2::ScreenShotSourceScreen2(ScreenShotEffect *effect,
EffectScreen *screen,
Output *screen,
ScreenShotFlags flags)
: ScreenShotSource2(effect->scheduleScreenShot(screen, flags))
, m_screen(screen)
@ -456,7 +457,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureScreen(const QString &name,
return QVariantMap();
}
EffectScreen *screen = effects->findScreen(name);
Output *screen = effects->findScreen(name);
if (!screen) {
sendErrorReply(s_errorInvalidScreen, s_errorInvalidScreenMessage);
return QVariantMap();
@ -482,7 +483,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureActiveScreen(const QVariantMap &opt
return QVariantMap();
}
EffectScreen *screen = effects->activeScreen();
Output *screen = effects->activeScreen();
if (!screen) {
sendErrorReply(s_errorInvalidScreen, s_errorInvalidScreenMessage);
return QVariantMap();
@ -540,7 +541,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureInteractive(uint kind,
QDBusConnection bus = QDBusConnection::sessionBus();
bus.send(replyMessage.createErrorReply(s_errorCancelled, s_errorCancelledMessage));
} else {
EffectScreen *screen = effects->screenAt(point.toPoint());
Output *screen = effects->screenAt(point.toPoint());
takeScreenShot(screen, screenShotFlagsFromOptions(options),
new ScreenShotSinkPipe2(fileDescriptor, replyMessage));
}
@ -590,7 +591,7 @@ void ScreenShotDBusInterface2::bind(ScreenShotSinkPipe2 *sink, ScreenShotSource2
});
}
void ScreenShotDBusInterface2::takeScreenShot(EffectScreen *screen, ScreenShotFlags flags,
void ScreenShotDBusInterface2::takeScreenShot(Output *screen, ScreenShotFlags flags,
ScreenShotSinkPipe2 *sink)
{
bind(sink, new ScreenShotSourceScreen2(m_effect, screen, flags));

View file

@ -57,7 +57,7 @@ public Q_SLOTS:
QDBusUnixFileDescriptor pipe);
private:
void takeScreenShot(EffectScreen *screen, ScreenShotFlags flags, ScreenShotSinkPipe2 *sink);
void takeScreenShot(Output *screen, ScreenShotFlags flags, ScreenShotSinkPipe2 *sink);
void takeScreenShot(const QRect &area, ScreenShotFlags flags, ScreenShotSinkPipe2 *sink);
void takeScreenShot(EffectWindow *window, ScreenShotFlags flags, ScreenShotSinkPipe2 *sink);

View file

@ -39,7 +39,7 @@ ScreenTransformEffect::ScreenTransformEffect()
m_previousTextureLocation = m_shader->uniformLocation("previousTexture");
m_currentTextureLocation = m_shader->uniformLocation("currentTexture");
const QList<EffectScreen *> screens = effects->screens();
const QList<Output *> screens = effects->screens();
for (auto screen : screens) {
addScreen(screen);
}
@ -54,19 +54,19 @@ bool ScreenTransformEffect::supported()
return effects->compositingType() == OpenGLCompositing && effects->waylandDisplay() && effects->animationsSupported();
}
qreal transformAngle(EffectScreen::Transform current, EffectScreen::Transform old)
qreal transformAngle(OutputTransform current, OutputTransform old)
{
auto ensureShort = [](int angle) {
return angle > 180 ? angle - 360 : angle < -180 ? angle + 360
: angle;
};
// % 4 to ignore flipped cases (for now)
return ensureShort((int(current) % 4 - int(old) % 4) * 90);
return ensureShort((int(current.kind()) % 4 - int(old.kind()) % 4) * 90);
}
void ScreenTransformEffect::addScreen(EffectScreen *screen)
void ScreenTransformEffect::addScreen(Output *screen)
{
connect(screen, &EffectScreen::changed, this, [this, screen] {
connect(screen, &Output::changed, this, [this, screen] {
auto &state = m_states[screen];
if (transformAngle(screen->transform(), state.m_oldTransform) == 0) {
effects->makeOpenGLContextCurrent();
@ -79,12 +79,12 @@ void ScreenTransformEffect::addScreen(EffectScreen *screen)
Q_ASSERT(state.m_angle != 0);
effects->addRepaintFull();
});
connect(screen, &EffectScreen::aboutToChange, this, [this, screen] {
connect(screen, &Output::aboutToChange, this, [this, screen] {
effects->makeOpenGLContextCurrent();
auto &state = m_states[screen];
state.m_oldTransform = screen->transform();
state.m_oldGeometry = screen->geometry();
state.m_prev.texture = GLTexture::allocate(GL_RGBA8, screen->geometry().size() * screen->devicePixelRatio());
state.m_prev.texture = GLTexture::allocate(GL_RGBA8, screen->geometry().size() * screen->scale());
if (!state.m_prev.texture) {
m_states.remove(screen);
return;
@ -101,7 +101,7 @@ void ScreenTransformEffect::addScreen(EffectScreen *screen)
});
}
void ScreenTransformEffect::removeScreen(EffectScreen *screen)
void ScreenTransformEffect::removeScreen(Output *screen)
{
effects->makeOpenGLContextCurrent();
m_states.remove(screen);
@ -181,7 +181,7 @@ static QRectF lerp(const QRectF &a, const QRectF &b, qreal t)
return ret;
}
void ScreenTransformEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::EffectScreen *screen)
void ScreenTransformEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::Output *screen)
{
auto it = m_states.find(screen);
if (it == m_states.end() || !it->m_captured) {
@ -190,7 +190,7 @@ void ScreenTransformEffect::paintScreen(const RenderTarget &renderTarget, const
}
// Render the screen in an offscreen texture.
const QSize nativeSize = screen->geometry().size() * screen->devicePixelRatio();
const QSize nativeSize = screen->geometry().size() * screen->scale();
if (!it->m_current.texture || it->m_current.texture->size() != nativeSize) {
it->m_current.texture = GLTexture::allocate(GL_RGBA8, nativeSize);
if (!it->m_current.texture) {

View file

@ -8,6 +8,7 @@
*/
#pragma once
#include "core/output.h"
#include "libkwineffects/kwineffects.h"
namespace KWin
@ -25,7 +26,7 @@ public:
~ScreenTransformEffect() override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::Output *screen) override;
bool isActive() const override;
@ -48,15 +49,15 @@ private:
Snapshot m_prev;
Snapshot m_current;
QRect m_oldGeometry;
EffectScreen::Transform m_oldTransform;
OutputTransform m_oldTransform;
qreal m_angle = 0;
bool m_captured = false;
};
void addScreen(EffectScreen *screen);
void removeScreen(EffectScreen *screen);
void addScreen(Output *screen);
void removeScreen(Output *screen);
QHash<EffectScreen *, ScreenState> m_states;
QHash<Output *, ScreenState> m_states;
std::unique_ptr<GLShader> m_shader;
int m_previousTextureLocation = -1;

View file

@ -7,6 +7,7 @@
*/
#include "showfpseffect.h"
#include "core/output.h"
#include "libkwineffects/renderviewport.h"
#include <QQmlContext>
@ -75,7 +76,7 @@ void ShowFpsEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::millis
}
}
void ShowFpsEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void ShowFpsEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);

View file

@ -36,7 +36,7 @@ public:
QColor paintColor() const;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, KWin::WindowPaintData &data) override;
void postPaintScreen() override;

View file

@ -43,7 +43,7 @@ ShowPaintEffect::ShowPaintEffect()
connect(toggleAction, &QAction::triggered, this, &ShowPaintEffect::toggle);
}
void ShowPaintEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void ShowPaintEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
m_painted = QRegion();
effects->paintScreen(renderTarget, viewport, mask, region, screen);

View file

@ -21,7 +21,7 @@ class ShowPaintEffect : public Effect
public:
ShowPaintEffect();
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
bool isActive() const override;

View file

@ -11,6 +11,7 @@
// own
#include "slide.h"
#include "core/output.h"
// KConfigSkeleton
#include "slideconfig.h"
@ -134,13 +135,13 @@ void SlideEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::millisec
effects->prePaintScreen(data, presentTime);
}
void SlideEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void SlideEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
m_paintCtx.wrap = effects->optionRollOverDesktops();
effects->paintScreen(renderTarget, viewport, mask, region, screen);
}
QPoint SlideEffect::getDrawCoords(QPointF pos, EffectScreen *screen)
QPoint SlideEffect::getDrawCoords(QPointF pos, Output *screen)
{
QPoint c = QPoint();
c.setX(pos.x() * (screen->geometry().width() + m_hGap));
@ -226,7 +227,7 @@ void SlideEffect::paintWindow(const RenderTarget &renderTarget, const RenderView
desktopTranslation = QPointF(desktopTranslation.x(), desktopTranslation.y() + gridHeight);
}
for (EffectScreen *screen : screens) {
for (Output *screen : screens) {
QPoint drawTranslation = getDrawCoords(desktopTranslation, screen);
data += drawTranslation;

View file

@ -57,7 +57,7 @@ public:
void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) 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;
@ -80,7 +80,7 @@ private Q_SLOTS:
void windowDeleted(EffectWindow *w);
private:
QPoint getDrawCoords(QPointF pos, EffectScreen *screen);
QPoint getDrawCoords(QPointF pos, Output *screen);
bool isTranslated(const EffectWindow *w) const;
bool willBePainted(const EffectWindow *w) const;
bool shouldElevate(const EffectWindow *w) const;

View file

@ -32,8 +32,8 @@ static QRegion computeDirtyRegion(const QRectF &windowRect)
QRegion dirtyRegion;
const QList<EffectScreen *> screens = effects->screens();
for (EffectScreen *screen : screens) {
const QList<Output *> screens = effects->screens();
for (Output *screen : screens) {
const QRectF screenRect = effects->clientArea(ScreenArea, screen, effects->currentDesktop());
QRectF screenWindowRect = windowRect;
@ -93,14 +93,14 @@ void SnapHelperEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mil
effects->prePaintScreen(data, presentTime);
}
void SnapHelperEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void SnapHelperEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);
const qreal opacityFactor = m_animation.active
? m_animation.timeLine.value()
: 1.0;
const QList<EffectScreen *> screens = effects->screens();
const QList<Output *> screens = effects->screens();
const auto scale = viewport.scale();
@ -121,7 +121,7 @@ void SnapHelperEffect::paintScreen(const RenderTarget &renderTarget, const Rende
glLineWidth(s_lineWidth);
QList<QVector2D> verts;
verts.reserve(screens.count() * 24);
for (EffectScreen *screen : screens) {
for (Output *screen : screens) {
const QRectF rect = effects->clientArea(ScreenArea, screen, effects->currentDesktop());
const int midX = rect.x() + rect.width() / 2;
const int midY = rect.y() + rect.height() / 2;
@ -167,7 +167,7 @@ void SnapHelperEffect::paintScreen(const RenderTarget &renderTarget, const Rende
painter->setPen(pen);
painter->setBrush(Qt::NoBrush);
for (EffectScreen *screen : screens) {
for (Output *screen : screens) {
const QRectF rect = effects->clientArea(ScreenArea, screen, effects->currentDesktop());
// Center lines.
painter->drawLine(rect.center().x(), rect.y(), rect.center().x(), rect.y() + rect.height());

View file

@ -26,7 +26,7 @@ public:
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void postPaintScreen() override;
bool isActive() const override;

View file

@ -196,7 +196,7 @@ void StartupFeedbackEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono
effects->prePaintScreen(data, presentTime);
}
void StartupFeedbackEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void StartupFeedbackEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);
if (m_active) {

View file

@ -33,7 +33,7 @@ public:
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void postPaintScreen() override;
bool isActive() const override;

View file

@ -55,7 +55,7 @@ void ThumbnailAsideEffect::reconfigure(ReconfigureFlags)
arrange();
}
void ThumbnailAsideEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void ThumbnailAsideEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
painted = QRegion();
effects->paintScreen(renderTarget, viewport, mask, region, screen);
@ -166,7 +166,7 @@ void ThumbnailAsideEffect::arrange()
mwidth = std::max(mwidth, d.window->width());
pos[d.index] = d.window->height();
}
EffectScreen *effectiveScreen = effects->findScreen(screen);
Output *effectiveScreen = effects->findScreen(screen);
if (!effectiveScreen) {
effectiveScreen = effects->activeScreen();
}

View file

@ -34,7 +34,7 @@ class ThumbnailAsideEffect
public:
ThumbnailAsideEffect();
void reconfigure(ReconfigureFlags) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
// for properties

View file

@ -38,7 +38,7 @@ TilesEditorEffect::~TilesEditorEffect()
{
}
QVariantMap TilesEditorEffect::initialProperties(EffectScreen *screen)
QVariantMap TilesEditorEffect::initialProperties(Output *screen)
{
return QVariantMap{
{QStringLiteral("effect"), QVariant::fromValue(this)},

View file

@ -37,7 +37,7 @@ Q_SIGNALS:
void animationDurationChanged();
protected:
QVariantMap initialProperties(EffectScreen *screen) override;
QVariantMap initialProperties(Output *screen) override;
private:
void realDeactivate();

View file

@ -119,7 +119,7 @@ void TouchPointsEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mi
effects->prePaintScreen(data, presentTime);
}
void TouchPointsEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void TouchPointsEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen);

View file

@ -27,7 +27,7 @@ public:
TouchPointsEffect();
~TouchPointsEffect() override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void postPaintScreen() override;
bool isActive() const override;
bool touchDown(qint32 id, const QPointF &pos, std::chrono::microseconds time) override;

View file

@ -98,7 +98,7 @@ void TrackMouseEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::mil
effects->prePaintScreen(data, presentTime);
}
void TrackMouseEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void TrackMouseEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
effects->paintScreen(renderTarget, viewport, mask, region, screen); // paint normal screen

View file

@ -29,7 +29,7 @@ public:
TrackMouseEffect();
~TrackMouseEffect() override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void postPaintScreen() override;
void reconfigure(ReconfigureFlags) override;
bool isActive() const override;

View file

@ -193,7 +193,7 @@ void WindowViewEffect::reconfigure(ReconfigureFlags)
effects->reserveElectricBorder(ElectricBorder(i), this);
}
auto touchCallback = [this](ElectricBorder border, const QPointF &deltaProgress, const EffectScreen *screen) {
auto touchCallback = [this](ElectricBorder border, const QPointF &deltaProgress, const Output *screen) {
if (m_status == Status::Active) {
return;
}

View file

@ -263,7 +263,7 @@ void ZoomEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseco
effects->prePaintScreen(data, presentTime);
}
ZoomEffect::OffscreenData *ZoomEffect::ensureOffscreenData(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectScreen *screen)
ZoomEffect::OffscreenData *ZoomEffect::ensureOffscreenData(const RenderTarget &renderTarget, const RenderViewport &viewport, Output *screen)
{
const QRect rect = viewport.renderRect().toRect();
const qreal devicePixelRatio = viewport.scale();
@ -286,7 +286,7 @@ ZoomEffect::OffscreenData *ZoomEffect::ensureOffscreenData(const RenderTarget &r
return &data;
}
void ZoomEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void ZoomEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
OffscreenData *offscreenData = ensureOffscreenData(renderTarget, viewport, screen);
if (!offscreenData) {
@ -561,7 +561,7 @@ void ZoomEffect::slotWindowDamaged()
}
}
void ZoomEffect::slotScreenRemoved(EffectScreen *screen)
void ZoomEffect::slotScreenRemoved(Output *screen)
{
if (auto it = m_offscreenData.find(screen); it != m_offscreenData.end()) {
effects->makeOpenGLContextCurrent();

View file

@ -44,7 +44,7 @@ public:
~ZoomEffect() override;
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen) override;
void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
void postPaintScreen() override;
bool isActive() const override;
int requestedEffectChainPosition() const override;
@ -78,7 +78,7 @@ private Q_SLOTS:
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
void slotWindowAdded(EffectWindow *w);
void slotWindowDamaged();
void slotScreenRemoved(EffectScreen *screen);
void slotScreenRemoved(Output *screen);
private:
void showCursor();
@ -94,7 +94,7 @@ private:
};
GLTexture *ensureCursorTexture();
OffscreenData *ensureOffscreenData(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectScreen *screen);
OffscreenData *ensureOffscreenData(const RenderTarget &renderTarget, const RenderViewport &viewport, Output *screen);
void markCursorTextureDirty();
#if HAVE_ACCESSIBILITY
@ -131,7 +131,7 @@ private:
int xMove, yMove;
double moveFactor;
std::chrono::milliseconds lastPresentTime;
std::map<EffectScreen *, OffscreenData> m_offscreenData;
std::map<Output *, OffscreenData> m_offscreenData;
};
} // namespace

View file

@ -240,7 +240,7 @@ QRegion WorkspaceScene::prePaint(SceneDelegate *delegate)
ScreenPrePaintData prePaintData;
prePaintData.mask = 0;
prePaintData.screen = EffectScreenImpl::get(painted_screen);
prePaintData.screen = painted_screen;
effects->makeOpenGLContextCurrent();
Q_EMIT preFrameRender();
@ -364,7 +364,7 @@ void WorkspaceScene::paint(const RenderTarget &renderTarget, const QRegion &regi
m_renderer->beginFrame(renderTarget, viewport);
effects->paintScreen(renderTarget, viewport, m_paintContext.mask, region, EffectScreenImpl::get(painted_screen));
effects->paintScreen(renderTarget, viewport, m_paintContext.mask, region, painted_screen);
m_paintScreenCount = 0;
Q_EMIT frameRendered();
@ -372,7 +372,7 @@ void WorkspaceScene::paint(const RenderTarget &renderTarget, const QRegion &regi
}
// the function that'll be eventually called by paintScreen() above
void WorkspaceScene::finalPaintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen)
void WorkspaceScene::finalPaintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen)
{
m_paintScreenCount++;
if (mask & (PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS)) {
@ -384,7 +384,7 @@ void WorkspaceScene::finalPaintScreen(const RenderTarget &renderTarget, const Re
// The generic painting code that can handle even transformations.
// It simply paints bottom-to-top.
void WorkspaceScene::paintGenericScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int, EffectScreen *screen)
void WorkspaceScene::paintGenericScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int, Output *screen)
{
if (m_paintContext.mask & PAINT_SCREEN_BACKGROUND_FIRST) {
if (m_paintScreenCount == 1) {

View file

@ -90,11 +90,11 @@ protected:
void clearStackingOrder();
friend class EffectsHandlerImpl;
// called after all effects had their paintScreen() called
void finalPaintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, EffectScreen *screen);
void finalPaintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen);
// shared implementation of painting the screen in the generic
// (unoptimized) way
void preparePaintGenericScreen();
void paintGenericScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, EffectScreen *screen);
void paintGenericScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, Output *screen);
// shared implementation of painting the screen in an optimized way
void preparePaintSimpleScreen();
void paintSimpleScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region);

View file

@ -13,6 +13,7 @@
#include "scriptingutils.h"
#include "workspace_wrapper.h"
#include "core/output.h"
#include "input.h"
#include "screenedge.h"
#include "workspace.h"
@ -720,7 +721,7 @@ bool ScriptedEffect::registerRealtimeScreenEdge(int edge, const QJSValue &callba
}
}
});
effects->registerRealtimeTouchBorder(static_cast<KWin::ElectricBorder>(edge), triggerAction, [this](ElectricBorder border, const QPointF &deltaProgress, EffectScreen *screen) {
effects->registerRealtimeTouchBorder(static_cast<KWin::ElectricBorder>(edge), triggerAction, [this](ElectricBorder border, const QPointF &deltaProgress, Output *screen) {
auto it = realtimeScreenEdgeCallbacks().constFind(border);
if (it != realtimeScreenEdgeCallbacks().constEnd()) {
for (const QJSValue &callback : it.value()) {