2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2019-01-27 19:48:00 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2019-01-27 19:48:00 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2019-01-27 19:48:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-07-21 08:13:43 +00:00
|
|
|
#include "core/graphicsbuffer.h"
|
2022-04-22 17:39:12 +00:00
|
|
|
#include "window.h"
|
2019-01-27 19:48:00 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2023-08-04 11:13:21 +00:00
|
|
|
struct InternalWindowFrame
|
|
|
|
{
|
|
|
|
GraphicsBuffer *buffer = nullptr;
|
|
|
|
QRegion bufferDamage;
|
|
|
|
GraphicsBufferOrigin bufferOrigin = GraphicsBufferOrigin::TopLeft;
|
|
|
|
};
|
|
|
|
|
2022-04-22 17:45:19 +00:00
|
|
|
class KWIN_EXPORT InternalWindow : public Window
|
2019-01-27 19:48:00 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-08-26 07:44:04 +00:00
|
|
|
|
2019-01-27 19:48:00 +00:00
|
|
|
public:
|
2022-04-28 12:00:38 +00:00
|
|
|
explicit InternalWindow(QWindow *handle);
|
2022-04-22 17:45:19 +00:00
|
|
|
~InternalWindow() override;
|
2019-01-27 19:48:00 +00:00
|
|
|
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
|
|
|
2019-08-26 07:44:04 +00:00
|
|
|
QString captionNormal() const override;
|
|
|
|
QString captionSuffix() const override;
|
2022-05-16 20:13:39 +00:00
|
|
|
QSizeF minSize() const override;
|
|
|
|
QSizeF maxSize() const override;
|
2023-03-28 10:48:11 +00:00
|
|
|
NET::WindowType windowType(bool direct = false) const override;
|
2019-01-27 19:48:00 +00:00
|
|
|
void killWindow() override;
|
2021-05-25 16:06:17 +00:00
|
|
|
bool isClient() const override;
|
2019-01-27 19:48:00 +00:00
|
|
|
bool isPopupWindow() const override;
|
2022-10-21 14:24:42 +00:00
|
|
|
QString windowRole() const override;
|
2019-01-27 19:48:00 +00:00
|
|
|
void closeWindow() override;
|
|
|
|
bool isCloseable() const override;
|
|
|
|
bool isMovable() const override;
|
|
|
|
bool isMovableAcrossScreens() const override;
|
|
|
|
bool isResizable() const override;
|
2020-09-23 13:24:10 +00:00
|
|
|
bool isPlaceable() const override;
|
2019-01-27 19:48:00 +00:00
|
|
|
bool noBorder() const override;
|
|
|
|
bool userCanSetNoBorder() const override;
|
|
|
|
bool wantsInput() const override;
|
|
|
|
bool isInternal() const override;
|
|
|
|
bool isLockScreen() const override;
|
2019-03-19 14:01:29 +00:00
|
|
|
bool isOutline() const override;
|
2022-08-29 13:54:28 +00:00
|
|
|
QRectF resizeWithChecks(const QRectF &geometry, const QSizeF &size) override;
|
2022-04-22 17:39:12 +00:00
|
|
|
Window *findModal(bool allow_itself = false) override;
|
2020-07-22 11:00:11 +00:00
|
|
|
bool takeFocus() override;
|
2019-08-26 07:44:04 +00:00
|
|
|
void setNoBorder(bool set) override;
|
2021-12-08 13:21:48 +00:00
|
|
|
void invalidateDecoration() override;
|
2022-04-23 08:33:23 +00:00
|
|
|
void destroyWindow() override;
|
2021-01-30 20:29:55 +00:00
|
|
|
bool hasPopupGrab() const override;
|
|
|
|
void popupDone() override;
|
2022-05-16 20:13:39 +00:00
|
|
|
bool hitTest(const QPointF &point) const override;
|
|
|
|
void pointerEnterEvent(const QPointF &globalPos) override;
|
2021-11-29 20:19:38 +00:00
|
|
|
void pointerLeaveEvent() override;
|
2019-08-26 07:44:04 +00:00
|
|
|
|
2023-07-21 08:13:43 +00:00
|
|
|
GraphicsBuffer *graphicsBuffer() const;
|
2023-08-04 11:13:21 +00:00
|
|
|
GraphicsBufferOrigin graphicsBufferOrigin() const;
|
2023-03-23 17:58:10 +00:00
|
|
|
|
2023-08-04 11:13:21 +00:00
|
|
|
void present(const InternalWindowFrame &frame);
|
2021-11-16 07:38:51 +00:00
|
|
|
qreal bufferScale() const;
|
2022-04-28 12:00:38 +00:00
|
|
|
QWindow *handle() const;
|
2019-01-27 19:48:00 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool acceptsFocus() const override;
|
2022-04-22 17:39:12 +00:00
|
|
|
bool belongsToSameApplication(const Window *other, SameApplicationChecks checks) const override;
|
2022-07-11 21:43:06 +00:00
|
|
|
void doInteractiveResizeSync(const QRectF &rect) override;
|
2019-08-26 07:44:04 +00:00
|
|
|
void updateCaption() override;
|
2022-05-16 20:13:39 +00:00
|
|
|
void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override;
|
2023-01-07 20:51:34 +00:00
|
|
|
std::unique_ptr<WindowItem> createItem(Scene *scene) override;
|
2019-01-27 19:48:00 +00:00
|
|
|
|
|
|
|
private:
|
2022-05-16 20:13:39 +00:00
|
|
|
void requestGeometry(const QRectF &rect);
|
|
|
|
void commitGeometry(const QRectF &rect);
|
2019-08-26 07:44:04 +00:00
|
|
|
void setCaption(const QString &caption);
|
|
|
|
void markAsMapped();
|
2019-01-27 19:48:00 +00:00
|
|
|
void syncGeometryToInternalWindow();
|
2019-08-26 07:44:04 +00:00
|
|
|
void updateInternalWindowGeometry();
|
2021-12-08 13:28:43 +00:00
|
|
|
void updateDecoration(bool check_workspace_pos, bool force = false);
|
2022-05-16 20:13:39 +00:00
|
|
|
void createDecoration(const QRectF &oldGeometry);
|
2021-12-09 11:55:13 +00:00
|
|
|
void destroyDecoration();
|
2019-01-27 19:48:00 +00:00
|
|
|
|
2022-04-28 12:00:38 +00:00
|
|
|
QWindow *m_handle = nullptr;
|
2019-08-26 07:44:04 +00:00
|
|
|
QString m_captionNormal;
|
|
|
|
QString m_captionSuffix;
|
2019-01-27 19:48:00 +00:00
|
|
|
NET::WindowType m_windowType = NET::Normal;
|
|
|
|
Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags();
|
2019-08-26 07:44:04 +00:00
|
|
|
bool m_userNoBorder = false;
|
2023-07-21 08:13:43 +00:00
|
|
|
GraphicsBufferRef m_graphicsBufferRef;
|
2023-08-04 11:13:21 +00:00
|
|
|
GraphicsBufferOrigin m_graphicsBufferOrigin;
|
2019-08-26 07:44:04 +00:00
|
|
|
|
2022-04-22 17:45:19 +00:00
|
|
|
Q_DISABLE_COPY(InternalWindow)
|
2019-01-27 19:48:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|