File indexing completed on 2024-11-10 04:56:58

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include "effect/effect.h"
0012 #include <QColor>
0013 #include <QDBusContext>
0014 #include <QDBusMessage>
0015 #include <QDBusUnixFileDescriptor>
0016 #include <QObject>
0017 
0018 namespace KWin
0019 {
0020 
0021 class ColorPickerEffect : public Effect, protected QDBusContext
0022 {
0023     Q_OBJECT
0024     Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.ColorPicker")
0025 public:
0026     ColorPickerEffect();
0027     ~ColorPickerEffect() override;
0028     void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
0029     bool isActive() const override;
0030 
0031     int requestedEffectChainPosition() const override
0032     {
0033         return 0;
0034     }
0035 
0036     static bool supported();
0037 
0038 public Q_SLOTS:
0039     Q_SCRIPTABLE QColor pick();
0040 
0041 private:
0042     void showInfoMessage();
0043     void hideInfoMessage();
0044 
0045     QDBusMessage m_replyMessage;
0046     QPointF m_scheduledPosition;
0047     bool m_picking = false;
0048 };
0049 
0050 } // namespace