File indexing completed on 2024-04-28 05:30:23

0001 /*
0002     SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "waylandwindow.h"
0010 
0011 namespace KWin
0012 {
0013 
0014 class AutoHideScreenEdgeV1Interface;
0015 class LayerSurfaceV1Interface;
0016 class Output;
0017 class LayerShellV1Integration;
0018 
0019 class LayerShellV1Window : public WaylandWindow
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit LayerShellV1Window(LayerSurfaceV1Interface *shellSurface,
0025                                 Output *output,
0026                                 LayerShellV1Integration *integration);
0027 
0028     LayerSurfaceV1Interface *shellSurface() const;
0029     Output *desiredOutput() const;
0030 
0031     NET::WindowType windowType() const override;
0032     bool isPlaceable() const override;
0033     bool isCloseable() const override;
0034     bool isMovable() const override;
0035     bool isMovableAcrossScreens() const override;
0036     bool isResizable() const override;
0037     bool takeFocus() override;
0038     bool wantsInput() const override;
0039     bool dockWantsInput() const override;
0040     StrutRect strutRect(StrutArea area) const override;
0041     bool hasStrut() const override;
0042     void destroyWindow() override;
0043     void closeWindow() override;
0044     void setVirtualKeyboardGeometry(const QRectF &geo) override;
0045     void showOnScreenEdge() override;
0046 
0047     void installAutoHideScreenEdgeV1(AutoHideScreenEdgeV1Interface *edge);
0048 
0049 protected:
0050     Layer belongsToLayer() const override;
0051     bool acceptsFocus() const override;
0052     void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override;
0053 
0054 private:
0055     void handleSizeChanged();
0056     void handleUnmapped();
0057     void handleCommitted();
0058     void handleAcceptsFocusChanged();
0059     void handleOutputEnabledChanged();
0060     void scheduleRearrange();
0061     void activateScreenEdge();
0062     void deactivateScreenEdge();
0063     void reserveScreenEdge();
0064     void unreserveScreenEdge();
0065 
0066     Output *m_desiredOutput;
0067     LayerShellV1Integration *m_integration;
0068     LayerSurfaceV1Interface *m_shellSurface;
0069     QPointer<AutoHideScreenEdgeV1Interface> m_screenEdge;
0070     bool m_screenEdgeActive = false;
0071     NET::WindowType m_windowType;
0072 };
0073 
0074 } // namespace KWin