File indexing completed on 2025-04-27 11:32:59

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2011 Arthur Arlt <a.arlt@stud.uni-heidelberg.de>
0006     SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
0007 
0008     Since the functionality provided in this class has been moved from
0009     class Workspace, it is not clear who exactly has written the code.
0010     The list below contains the copyright holders of the class Workspace.
0011 
0012     SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
0013     SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
0014     SPDX-FileCopyrightText: 2009 Lucas Murray <lmurray@undefinedfire.com>
0015 
0016     SPDX-License-Identifier: GPL-2.0-or-later
0017 */
0018 #pragma once
0019 #include "screenedge.h"
0020 #include "utils/xcbutils.h"
0021 
0022 namespace KWin
0023 {
0024 
0025 class WindowBasedEdge : public Edge
0026 {
0027     Q_OBJECT
0028 public:
0029     explicit WindowBasedEdge(ScreenEdges *parent);
0030     ~WindowBasedEdge() override;
0031 
0032     quint32 window() const override;
0033     /**
0034      * The approach window is a special window to notice when get close to the screen border but
0035      * not yet triggering the border.
0036      */
0037     quint32 approachWindow() const override;
0038 
0039 protected:
0040     void doGeometryUpdate() override;
0041     void doActivate() override;
0042     void doDeactivate() override;
0043     void doStartApproaching() override;
0044     void doStopApproaching() override;
0045     void doUpdateBlocking() override;
0046 
0047 private:
0048     void createWindow();
0049     void createApproachWindow();
0050     Xcb::Window m_window;
0051     Xcb::Window m_approachWindow;
0052     QMetaObject::Connection m_cursorPollingConnection;
0053 };
0054 
0055 inline quint32 WindowBasedEdge::window() const
0056 {
0057     return m_window;
0058 }
0059 
0060 inline quint32 WindowBasedEdge::approachWindow() const
0061 {
0062     return m_approachWindow;
0063 }
0064 
0065 }