File indexing completed on 2024-12-08 13:21:59

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
0006     SPDX-FileCopyrightText: 1997-2002 Cristian Tibirna <tibirna@kde.org>
0007     SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 */
0011 
0012 #pragma once
0013 // KWin
0014 #include "options.h"
0015 // Qt
0016 #include <QList>
0017 #include <QPoint>
0018 #include <QRect>
0019 
0020 class QObject;
0021 
0022 namespace KWin
0023 {
0024 
0025 class Window;
0026 
0027 class KWIN_EXPORT Placement
0028 {
0029 public:
0030     explicit Placement();
0031 
0032     void place(Window *c, const QRectF &area);
0033     void placeSmart(Window *c, const QRectF &area, PlacementPolicy next = PlacementUnknown);
0034 
0035     void placeCentered(Window *c, const QRectF &area, PlacementPolicy next = PlacementUnknown);
0036 
0037     void reinitCascading(int desktop);
0038 
0039     void cascadeIfCovering(Window *c, const QRectF &area);
0040 
0041     /**
0042      * Cascades all clients on the current desktop
0043      */
0044     void cascadeDesktop();
0045     /**
0046      *   Unclutters the current desktop by smart-placing all clients again.
0047      */
0048     void unclutterDesktop();
0049 
0050     static const char *policyToString(PlacementPolicy policy);
0051 
0052 private:
0053     void place(Window *c, const QRectF &area, PlacementPolicy policy, PlacementPolicy nextPlacement = PlacementUnknown);
0054     void placeUnderMouse(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
0055     void placeOnMainWindow(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
0056     void placeTransient(Window *c);
0057 
0058     void placeAtRandom(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
0059     void placeCascaded(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
0060     void placeMaximizing(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
0061     void placeZeroCornered(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
0062     void placeDialog(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
0063     void placeUtility(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
0064     void placeOnScreenDisplay(Window *c, const QRect &area);
0065 
0066     // CT needed for cascading+
0067     struct DesktopCascadingInfo
0068     {
0069         QPoint pos;
0070         int col;
0071         int row;
0072     };
0073 
0074     QList<DesktopCascadingInfo> cci;
0075 };
0076 
0077 } // namespace