internal_client.h 3.39 KB
Newer Older
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
1
2
3
/*
    KWin - the KDE window manager
    This file is part of the KDE project.
4

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
5
6
    SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
    SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
7

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
8
9
    SPDX-License-Identifier: GPL-2.0-or-later
*/
10
11
#pragma once

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
12
#include "abstract_client.h"
13
14
15
16

namespace KWin
{

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
17
class KWIN_EXPORT InternalClient : public AbstractClient
18
19
{
    Q_OBJECT
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
20

21
public:
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
22
    explicit InternalClient(QWindow *window);
23
24
25
26
    ~InternalClient() override;

    bool eventFilter(QObject *watched, QEvent *event) override;

27
    QRect bufferGeometry() const override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
28
29
30
31
32
33
    QStringList activities() const override;
    void blockActivityUpdates(bool b = true) override;
    qreal bufferScale() const override;
    QString captionNormal() const override;
    QString captionSuffix() const override;
    QPoint clientContentPos() const override;
34
35
    QSize minSize() const override;
    QSize maxSize() const override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
36
    QRect transparentRect() const override;
37
    NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
38
39
    double opacity() const override;
    void setOpacity(double opacity) override;
40
41
    void killWindow() override;
    bool isPopupWindow() const override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
42
    QByteArray windowRole() const override;
43
44
45
46
47
    void closeWindow() override;
    bool isCloseable() const override;
    bool isMovable() const override;
    bool isMovableAcrossScreens() const override;
    bool isResizable() const override;
48
    bool isPlaceable() const override;
49
50
51
52
53
    bool noBorder() const override;
    bool userCanSetNoBorder() const override;
    bool wantsInput() const override;
    bool isInternal() const override;
    bool isLockScreen() const override;
54
    bool isOutline() const override;
55
    quint32 windowId() const override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
56
57
58
    bool isShown(bool shaded_is_shown) const override;
    bool isHiddenInternal() const override;
    void hideClient(bool hide) override;
59
60
    void resizeWithChecks(const QSize &size, ForceGeometry_t force = NormalGeometrySet) override;
    void setFrameGeometry(const QRect &rect, ForceGeometry_t force = NormalGeometrySet) override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
61
62
    AbstractClient *findModal(bool allow_itself = false) override;
    void setOnAllActivities(bool set) override;
63
    bool takeFocus() override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
64
65
    void setNoBorder(bool set) override;
    void updateDecoration(bool check_workspace_pos, bool force = false) override;
66
    void destroyClient() override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
67
68
69
70

    void present(const QSharedPointer<QOpenGLFramebufferObject> fbo);
    void present(const QImage &image, const QRegion &damage);
    QWindow *internalWindow() const;
71
72
73

protected:
    bool acceptsFocus() const override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
74
    bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override;
75
76
    void doMove(int x, int y) override;
    void doResizeSync() override;
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
77
    void updateCaption() override;
78
79

private:
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
80
81
82
83
    void requestGeometry(const QRect &rect);
    void commitGeometry(const QRect &rect);
    void setCaption(const QString &caption);
    void markAsMapped();
84
    void syncGeometryToInternalWindow();
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
85
    void updateInternalWindowGeometry();
86

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
87
88
89
90
    QWindow *m_internalWindow = nullptr;
    QString m_captionNormal;
    QString m_captionSuffix;
    double m_opacity = 1.0;
91
92
93
    NET::WindowType m_windowType = NET::Normal;
    quint32 m_windowId = 0;
    Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags();
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
94
95
96
    bool m_userNoBorder = false;

    Q_DISABLE_COPY(InternalClient)
97
98
99
};

}