Changeset View
Changeset View
Standalone View
Standalone View
src/PlatformBackends/KWinWaylandImageGrabber.h
Show All 24 Lines | |||||
25 | { | 25 | { | ||
26 | Q_OBJECT | 26 | Q_OBJECT | ||
27 | 27 | | |||
28 | public: | 28 | public: | ||
29 | 29 | | |||
30 | explicit KWinWaylandImageGrabber(QObject * parent = nullptr); | 30 | explicit KWinWaylandImageGrabber(QObject * parent = nullptr); | ||
31 | ~KWinWaylandImageGrabber() Q_DECL_OVERRIDE; | 31 | ~KWinWaylandImageGrabber() Q_DECL_OVERRIDE; | ||
32 | 32 | | |||
33 | QVector<ImageGrabber::GrabMode> supportedModes() const override { return {FullScreen, CurrentScreen, /*ActiveWindow, */WindowUnderCursor, TransientWithParent/*, RectangularRegion*/}; } | 33 | QVector<ImageGrabber::GrabMode> supportedModes() const override { return {FullScreen, CurrentScreen, /*ActiveWindow, */WindowUnderCursor, TransientWithParent, RectangularRegion}; } | ||
34 | bool onClickGrabSupported() const Q_DECL_OVERRIDE; | 34 | bool onClickGrabSupported() const Q_DECL_OVERRIDE; | ||
35 | 35 | | |||
36 | protected: | 36 | protected: | ||
37 | 37 | | |||
38 | void grabFullScreen() Q_DECL_OVERRIDE; | 38 | void grabFullScreen() Q_DECL_OVERRIDE; | ||
39 | void grabCurrentScreen() Q_DECL_OVERRIDE; | 39 | void grabCurrentScreen() Q_DECL_OVERRIDE; | ||
40 | void grabActiveWindow() Q_DECL_OVERRIDE; | 40 | void grabActiveWindow() Q_DECL_OVERRIDE; | ||
41 | void grabRectangularRegion() Q_DECL_OVERRIDE; | 41 | void grabRectangularRegion() Q_DECL_OVERRIDE; | ||
42 | void grabWindowUnderCursor() Q_DECL_OVERRIDE; | 42 | void grabWindowUnderCursor() Q_DECL_OVERRIDE; | ||
43 | void grabTransientWithParent() Q_DECL_OVERRIDE; | 43 | void grabTransientWithParent() Q_DECL_OVERRIDE; | ||
44 | QPixmap blendCursorImage(const QPixmap &pixmap, int x, int y, int width, int height) Q_DECL_OVERRIDE; | 44 | QPixmap blendCursorImage(const QPixmap &pixmap, int x, int y, int width, int height) Q_DECL_OVERRIDE; | ||
45 | 45 | | |||
46 | private Q_SLOTS: | ||||
47 | | ||||
48 | void rectangleSelectionConfirmed(const QPixmap &pixmap); | ||||
49 | void rectangleSelectionCancelled(); | ||||
50 | | ||||
46 | private: | 51 | private: | ||
47 | 52 | | |||
48 | void startReadImage(int readPipe); | 53 | void startReadImage(int readPipe, std::function<void(QPixmap)> const& cb); | ||
49 | enum class Mode { | 54 | enum class Mode { | ||
50 | Window, | 55 | Window, | ||
51 | CurrentScreen, | 56 | CurrentScreen, | ||
52 | FullScreen | 57 | FullScreen | ||
53 | }; | 58 | }; | ||
54 | template <typename T> | 59 | template <typename T> | ||
55 | void callDBus(Mode mode, int writeFd, T argument); | 60 | void callDBus(Mode mode, int writeFd, T argument); | ||
56 | template <typename T> | 61 | template <typename T> | ||
57 | void grab(Mode mode, T argument); | 62 | void grab(Mode mode, std::function<void(QPixmap)> const& cb, T argument); | ||
58 | }; | 63 | }; | ||
59 | 64 | | |||
60 | #endif | 65 | #endif |