File indexing completed on 2024-04-28 16:48:52

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
0006     SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 #pragma once
0011 
0012 #include "window.h"
0013 
0014 namespace KWin
0015 {
0016 
0017 class KWIN_EXPORT InternalWindow : public Window
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     explicit InternalWindow(QWindow *handle);
0023     ~InternalWindow() override;
0024 
0025     bool eventFilter(QObject *watched, QEvent *event) override;
0026 
0027     QString captionNormal() const override;
0028     QString captionSuffix() const override;
0029     QSizeF minSize() const override;
0030     QSizeF maxSize() const override;
0031     NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
0032     void killWindow() override;
0033     bool isClient() const override;
0034     bool isPopupWindow() const override;
0035     QString windowRole() const override;
0036     void closeWindow() override;
0037     bool isCloseable() const override;
0038     bool isMovable() const override;
0039     bool isMovableAcrossScreens() const override;
0040     bool isResizable() const override;
0041     bool isPlaceable() const override;
0042     bool noBorder() const override;
0043     bool userCanSetNoBorder() const override;
0044     bool wantsInput() const override;
0045     bool isInternal() const override;
0046     bool isLockScreen() const override;
0047     bool isOutline() const override;
0048     bool isShown() const override;
0049     bool isHiddenInternal() const override;
0050     void hideClient() override;
0051     void showClient() override;
0052     QRectF resizeWithChecks(const QRectF &geometry, const QSizeF &size) override;
0053     Window *findModal(bool allow_itself = false) override;
0054     bool takeFocus() override;
0055     void setNoBorder(bool set) override;
0056     void invalidateDecoration() override;
0057     void destroyWindow() override;
0058     bool hasPopupGrab() const override;
0059     void popupDone() override;
0060     bool hitTest(const QPointF &point) const override;
0061     void pointerEnterEvent(const QPointF &globalPos) override;
0062     void pointerLeaveEvent() override;
0063 
0064     void present(const std::shared_ptr<QOpenGLFramebufferObject> fbo);
0065     void present(const QImage &image, const QRegion &damage);
0066     qreal bufferScale() const;
0067     QWindow *handle() const;
0068 
0069 protected:
0070     bool acceptsFocus() const override;
0071     bool belongsToSameApplication(const Window *other, SameApplicationChecks checks) const override;
0072     void doInteractiveResizeSync(const QRectF &rect) override;
0073     void updateCaption() override;
0074     void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override;
0075     std::unique_ptr<WindowItem> createItem(Scene *scene) override;
0076 
0077 private:
0078     void requestGeometry(const QRectF &rect);
0079     void commitGeometry(const QRectF &rect);
0080     void setCaption(const QString &caption);
0081     void markAsMapped();
0082     void syncGeometryToInternalWindow();
0083     void updateInternalWindowGeometry();
0084     void updateDecoration(bool check_workspace_pos, bool force = false);
0085     void createDecoration(const QRectF &oldGeometry);
0086     void destroyDecoration();
0087 
0088     QWindow *m_handle = nullptr;
0089     QString m_captionNormal;
0090     QString m_captionSuffix;
0091     NET::WindowType m_windowType = NET::Normal;
0092     Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags();
0093     bool m_userNoBorder = false;
0094 
0095     Q_DISABLE_COPY(InternalWindow)
0096 };
0097 
0098 }