Move placement policy enum in KWin namespace

Other policy enums are declared in options.h so let's do the same for
placement policy. Besides consistency, another advantage of moving the
enum in kwin namespace is that the enum could be forward declared.
This commit is contained in:
Vlad Zahorodnii 2022-08-31 23:29:15 +03:00
parent 71c9f16673
commit e97e520175
18 changed files with 130 additions and 125 deletions

View file

@ -12,6 +12,7 @@
#include "composite.h"
#include "effects.h"
#include "inputmethod.h"
#include "placement.h"
#include "platform.h"
#include "pluginmanager.h"
#include "session.h"
@ -61,7 +62,7 @@ WaylandTestApplication::WaylandTestApplication(OperationMode mode, int &argc, ch
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
KConfigGroup windowsGroup = config->group("Windows");
windowsGroup.writeEntry("Placement", Placement::policyToString(Placement::Smart));
windowsGroup.writeEntry("Placement", Placement::policyToString(PlacementSmart));
windowsGroup.sync();
setConfig(config);

View file

@ -14,6 +14,7 @@
#include "deleted.h"
#include "effects.h"
#include "output.h"
#include "placement.h"
#include "platform.h"
#include "wayland_server.h"
#include "window.h"

View file

@ -11,6 +11,7 @@
#include "cursor.h"
#include "output.h"
#include "placement.h"
#include "platform.h"
#include "wayland_server.h"
#include "window.h"
@ -52,7 +53,7 @@ private Q_SLOTS:
void testFullscreen();
private:
void setPlacementPolicy(Placement::Policy policy);
void setPlacementPolicy(PlacementPolicy policy);
/*
* Create a window and return relevant results for testing
* defaultSize is the buffer size to use if the compositor returns an empty size in the first configure
@ -93,7 +94,7 @@ void TestPlacement::initTestCase()
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
}
void TestPlacement::setPlacementPolicy(Placement::Policy policy)
void TestPlacement::setPlacementPolicy(PlacementPolicy policy)
{
auto group = kwinApp()->config()->group("Windows");
group.writeEntry("Placement", Placement::policyToString(policy));
@ -132,7 +133,7 @@ std::pair<PlaceWindowResult, std::unique_ptr<KWayland::Client::Surface>> TestPla
void TestPlacement::testPlaceSmart()
{
setPlacementPolicy(Placement::Smart);
setPlacementPolicy(PlacementSmart);
std::vector<std::unique_ptr<KWayland::Client::Surface>> surfaces;
QRegion usedArea;
@ -154,7 +155,7 @@ void TestPlacement::testPlaceSmart()
void TestPlacement::testPlaceZeroCornered()
{
setPlacementPolicy(Placement::ZeroCornered);
setPlacementPolicy(PlacementZeroCornered);
std::vector<std::unique_ptr<KWayland::Client::Surface>> surfaces;
for (int i = 0; i < 4; i++) {
@ -171,7 +172,7 @@ void TestPlacement::testPlaceZeroCornered()
void TestPlacement::testPlaceMaximized()
{
setPlacementPolicy(Placement::Maximizing);
setPlacementPolicy(PlacementMaximizing);
// add a top panel
std::unique_ptr<KWayland::Client::Surface> panelSurface(Test::createSurface());
@ -195,7 +196,7 @@ void TestPlacement::testPlaceMaximized()
void TestPlacement::testPlaceMaximizedLeavesFullscreen()
{
setPlacementPolicy(Placement::Maximizing);
setPlacementPolicy(PlacementMaximizing);
// add a top panel
std::unique_ptr<KWayland::Client::Surface> panelSurface(Test::createSurface());
@ -236,7 +237,7 @@ void TestPlacement::testPlaceCentered()
// This test verifies that Centered placement policy works.
KConfigGroup group = kwinApp()->config()->group("Windows");
group.writeEntry("Placement", Placement::policyToString(Placement::Centered));
group.writeEntry("Placement", Placement::policyToString(PlacementCentered));
group.sync();
workspace()->slotReconfigure();
@ -255,7 +256,7 @@ void TestPlacement::testPlaceUnderMouse()
// This test verifies that Under Mouse placement policy works.
KConfigGroup group = kwinApp()->config()->group("Windows");
group.writeEntry("Placement", Placement::policyToString(Placement::UnderMouse));
group.writeEntry("Placement", Placement::policyToString(PlacementUnderMouse));
group.sync();
workspace()->slotReconfigure();
@ -277,7 +278,7 @@ void TestPlacement::testPlaceCascaded()
// This test verifies that Cascaded placement policy works.
KConfigGroup group = kwinApp()->config()->group("Windows");
group.writeEntry("Placement", Placement::policyToString(Placement::Cascade));
group.writeEntry("Placement", Placement::policyToString(PlacementCascade));
group.sync();
workspace()->slotReconfigure();
@ -315,7 +316,7 @@ void TestPlacement::testPlaceRandom()
// This test verifies that Random placement policy works.
KConfigGroup group = kwinApp()->config()->group("Windows");
group.writeEntry("Placement", Placement::policyToString(Placement::Random));
group.writeEntry("Placement", Placement::policyToString(PlacementRandom));
group.sync();
workspace()->slotReconfigure();
@ -352,7 +353,7 @@ void TestPlacement::testFullscreen()
{
const QList<Output *> outputs = workspace()->outputs();
setPlacementPolicy(Placement::Smart);
setPlacementPolicy(PlacementSmart);
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));

View file

@ -789,16 +789,16 @@ QList<OptionsModel::Data> RulesModel::activitiesModelData() const
QList<OptionsModel::Data> RulesModel::placementModelData() const
{
static const auto modelData = QList<OptionsModel::Data>{
{Placement::Default, i18n("Default")},
{Placement::NoPlacement, i18n("No Placement")},
{Placement::Smart, i18n("Minimal Overlapping")},
{Placement::Maximizing, i18n("Maximized")},
{Placement::Cascade, i18n("Cascaded")},
{Placement::Centered, i18n("Centered")},
{Placement::Random, i18n("Random")},
{Placement::ZeroCornered, i18n("In Top-Left Corner")},
{Placement::UnderMouse, i18n("Under Mouse")},
{Placement::OnMainWindow, i18n("On Main Window")}};
{PlacementDefault, i18n("Default")},
{PlacementNone, i18n("No Placement")},
{PlacementSmart, i18n("Minimal Overlapping")},
{PlacementMaximizing, i18n("Maximized")},
{PlacementCascade, i18n("Cascaded")},
{PlacementCentered, i18n("Centered")},
{PlacementRandom, i18n("Random")},
{PlacementZeroCornered, i18n("In Top-Left Corner")},
{PlacementUnderMouse, i18n("Under Mouse")},
{PlacementOnMainWindow, i18n("On Main Window")}};
return modelData;
}

View file

@ -112,24 +112,24 @@
<max>4</max>
</entry>
<entry name="Placement" type="Enum">
<choices name="KWin::Placement::Policy">
<choice name="NoPlacement"/>
<choice name="Default"/>
<choice name="Unknown"/>
<choice name="Random"/>
<choice name="Smart"/>
<choice name="Cascade"/>
<choice name="Centered"/>
<choice name="ZeroCornered"/>
<choice name="UnderMouse"/>
<choice name="OnMainWindow"/>
<choice name="Maximizing"/>
<choices name="KWin::PlacementPolicy">
<choice name="PlacementNone" value="NoPlacement"/>
<choice name="PlacementDefault" value="Default"/>
<choice name="PlacementUnknown" value="Unknown"/>
<choice name="PlacementRandom" value="Random"/>
<choice name="PlacementSmart" value="Smart"/>
<choice name="PlacementCascade" value="Cascade"/>
<choice name="PlacementCentered" value="Centered"/>
<choice name="PlacementZeroCornered" value="ZeroCornered"/>
<choice name="PlacementUnderMouse" value="UnderMouse"/>
<choice name="PlacementOnMainWindow" value="OnMainWindow"/>
<choice name="PlacementMaximizing" value="Maximizing"/>
</choices>
<default type="code">[] {
#if KWIN_BUILD_DECORATIONS
return Placement::Centered;
return PlacementCentered;
#else
return Placement::Maximizing;
return PlacementMaximizing;
#endif
}()</default>
</entry>

View file

@ -43,7 +43,7 @@ Options::Options(QObject *parent)
, m_shadeHoverInterval(0)
, m_separateScreenFocus(false)
, m_activeMouseScreen(false)
, m_placement(Placement::NoPlacement)
, m_placement(PlacementNone)
, m_activationDesktopPolicy(Options::defaultActivationDesktopPolicy())
, m_borderSnapZone(0)
, m_windowSnapZone(0)
@ -235,12 +235,12 @@ void Options::setActiveMouseScreen(bool activeMouseScreen)
Q_EMIT activeMouseScreenChanged();
}
void Options::setPlacement(int placement)
void Options::setPlacement(PlacementPolicy placement)
{
if (m_placement == static_cast<Placement::Policy>(placement)) {
if (m_placement == placement) {
return;
}
m_placement = static_cast<Placement::Policy>(placement);
m_placement = placement;
Q_EMIT placementChanged();
}

View file

@ -13,7 +13,6 @@
#define KWIN_OPTIONS_H
#include "main.h"
#include "placement.h"
#include <KConfigWatcher>
@ -62,6 +61,26 @@ enum RenderTimeEstimator {
RenderTimeEstimatorAverage,
};
/**
* Placement policies. How workspace decides the way windows get positioned
* on the screen. The better the policy, the heavier the resource use.
* Normally you don't have to worry. What the WM adds to the startup time
* is nil compared to the creation of the window itself in the memory
*/
enum PlacementPolicy {
PlacementNone, // not really a placement
PlacementDefault, // special, means to use the global default
PlacementUnknown, // special, means the function should use its default
PlacementRandom,
PlacementSmart,
PlacementCascade,
PlacementCentered,
PlacementZeroCornered,
PlacementUnderMouse, // special
PlacementOnMainWindow, // special
PlacementMaximizing,
};
class Settings;
class KWIN_EXPORT Options : public QObject
@ -70,6 +89,7 @@ class KWIN_EXPORT Options : public QObject
Q_ENUM(XwaylandCrashPolicy)
Q_ENUM(LatencyPolicy)
Q_ENUM(RenderTimeEstimator)
Q_ENUM(PlacementPolicy)
Q_PROPERTY(FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy NOTIFY focusPolicyChanged)
Q_PROPERTY(XwaylandCrashPolicy xwaylandCrashPolicy READ xwaylandCrashPolicy WRITE setXwaylandCrashPolicy NOTIFY xwaylandCrashPolicyChanged)
Q_PROPERTY(int xwaylandMaxCrashCount READ xwaylandMaxCrashCount WRITE setXwaylandMaxCrashCount NOTIFY xwaylandMaxCrashCountChanged)
@ -104,7 +124,7 @@ class KWIN_EXPORT Options : public QObject
*/
Q_PROPERTY(bool separateScreenFocus READ isSeparateScreenFocus WRITE setSeparateScreenFocus NOTIFY separateScreenFocusChanged)
Q_PROPERTY(bool activeMouseScreen READ activeMouseScreen WRITE setActiveMouseScreen NOTIFY activeMouseScreenChanged)
Q_PROPERTY(int placement READ placement WRITE setPlacement NOTIFY placementChanged)
Q_PROPERTY(PlacementPolicy placement READ placement WRITE setPlacement NOTIFY placementChanged)
Q_PROPERTY(ActivationDesktopPolicy activationDesktopPolicy READ activationDesktopPolicy WRITE setActivationDesktopPolicy NOTIFY activationDesktopPolicyChanged)
Q_PROPERTY(bool focusPolicyIsReasonable READ focusPolicyIsReasonable NOTIFY focusPolicyIsResonableChanged)
/**
@ -318,7 +338,7 @@ public:
return m_activeMouseScreen;
}
Placement::Policy placement() const
PlacementPolicy placement() const
{
return m_placement;
}
@ -699,7 +719,7 @@ public:
void setShadeHoverInterval(int shadeHoverInterval);
void setSeparateScreenFocus(bool separateScreenFocus);
void setActiveMouseScreen(bool activeMouseScreen);
void setPlacement(int placement);
void setPlacement(PlacementPolicy placement);
void setActivationDesktopPolicy(ActivationDesktopPolicy activationDesktopPolicy);
void setBorderSnapZone(int borderSnapZone);
void setWindowSnapZone(int windowSnapZone);
@ -967,7 +987,7 @@ private:
int m_shadeHoverInterval;
bool m_separateScreenFocus;
bool m_activeMouseScreen;
Placement::Policy m_placement;
PlacementPolicy m_placement;
ActivationDesktopPolicy m_activationDesktopPolicy;
int m_borderSnapZone;
int m_windowSnapZone;

View file

@ -38,8 +38,8 @@ Placement::Placement()
*/
void Placement::place(Window *c, const QRectF &area)
{
Policy policy = c->rules()->checkPlacement(Default);
if (policy != Default) {
PlacementPolicy policy = c->rules()->checkPlacement(PlacementDefault);
if (policy != PlacementDefault) {
place(c, area, policy);
return;
}
@ -61,34 +61,34 @@ void Placement::place(Window *c, const QRectF &area)
}
}
void Placement::place(Window *c, const QRectF &area, Policy policy, Policy nextPlacement)
void Placement::place(Window *c, const QRectF &area, PlacementPolicy policy, PlacementPolicy nextPlacement)
{
if (policy == Unknown || policy == Default) {
if (policy == PlacementUnknown || policy == PlacementDefault) {
policy = options->placement();
}
switch (policy) {
case NoPlacement:
case PlacementNone:
return;
case Random:
case PlacementRandom:
placeAtRandom(c, area.toRect(), nextPlacement);
break;
case Cascade:
case PlacementCascade:
placeCascaded(c, area.toRect(), nextPlacement);
break;
case Centered:
case PlacementCentered:
placeCentered(c, area, nextPlacement);
break;
case ZeroCornered:
case PlacementZeroCornered:
placeZeroCornered(c, area.toRect(), nextPlacement);
break;
case UnderMouse:
case PlacementUnderMouse:
placeUnderMouse(c, area.toRect(), nextPlacement);
break;
case OnMainWindow:
case PlacementOnMainWindow:
placeOnMainWindow(c, area.toRect(), nextPlacement);
break;
case Maximizing:
case PlacementMaximizing:
placeMaximizing(c, area.toRect(), nextPlacement);
break;
default:
@ -99,7 +99,7 @@ void Placement::place(Window *c, const QRectF &area, Policy policy, Policy nextP
/**
* Place the client \a c according to a simply "random" placement algorithm.
*/
void Placement::placeAtRandom(Window *c, const QRect &area, Policy /*next*/)
void Placement::placeAtRandom(Window *c, const QRect &area, PlacementPolicy /*next*/)
{
Q_ASSERT(area.isValid());
@ -170,7 +170,7 @@ static inline bool isIrrelevant(const Window *client, const Window *regarding, i
/**
* Place the client \a c according to a really smart placement algorithm :-)
*/
void Placement::placeSmart(Window *c, const QRectF &area, Policy /*next*/)
void Placement::placeSmart(Window *c, const QRectF &area, PlacementPolicy /*next*/)
{
Q_ASSERT(area.isValid());
@ -376,7 +376,7 @@ QPoint Workspace::cascadeOffset(const Window *c) const
/**
* Place windows in a cascading order, remembering positions for each desktop
*/
void Placement::placeCascaded(Window *c, const QRect &area, Policy nextPlacement)
void Placement::placeCascaded(Window *c, const QRect &area, PlacementPolicy nextPlacement)
{
Q_ASSERT(area.isValid());
@ -402,8 +402,8 @@ void Placement::placeCascaded(Window *c, const QRect &area, Policy nextPlacement
const int H = area.height();
const int W = area.width();
if (nextPlacement == Unknown) {
nextPlacement = Smart;
if (nextPlacement == PlacementUnknown) {
nextPlacement = PlacementSmart;
}
// initialize if needed
@ -464,7 +464,7 @@ void Placement::placeCascaded(Window *c, const QRect &area, Policy nextPlacement
/**
* Place windows centered, on top of all others
*/
void Placement::placeCentered(Window *c, const QRectF &area, Policy /*next*/)
void Placement::placeCentered(Window *c, const QRectF &area, PlacementPolicy /*next*/)
{
Q_ASSERT(area.isValid());
@ -482,7 +482,7 @@ void Placement::placeCentered(Window *c, const QRectF &area, Policy /*next*/)
/**
* Place windows in the (0,0) corner, on top of all others
*/
void Placement::placeZeroCornered(Window *c, const QRect &area, Policy /*next*/)
void Placement::placeZeroCornered(Window *c, const QRect &area, PlacementPolicy /*next*/)
{
Q_ASSERT(area.isValid());
@ -490,14 +490,14 @@ void Placement::placeZeroCornered(Window *c, const QRect &area, Policy /*next*/)
c->move(area.topLeft());
}
void Placement::placeUtility(Window *c, const QRect &area, Policy /*next*/)
void Placement::placeUtility(Window *c, const QRect &area, PlacementPolicy /*next*/)
{
// TODO kwin should try to place utility windows next to their mainwindow,
// preferably at the right edge, and going down if there are more of them
// if there's not enough place outside the mainwindow, it should prefer
// top-right corner
// use the default placement for now
place(c, area, Default);
place(c, area, PlacementDefault);
}
void Placement::placeOnScreenDisplay(Window *c, const QRect &area)
@ -528,12 +528,12 @@ void Placement::placeTransient(Window *c)
}
}
void Placement::placeDialog(Window *c, const QRect &area, Policy nextPlacement)
void Placement::placeDialog(Window *c, const QRect &area, PlacementPolicy nextPlacement)
{
placeOnMainWindow(c, area, nextPlacement);
}
void Placement::placeUnderMouse(Window *c, const QRect &area, Policy /*next*/)
void Placement::placeUnderMouse(Window *c, const QRect &area, PlacementPolicy /*next*/)
{
Q_ASSERT(area.isValid());
@ -543,15 +543,15 @@ void Placement::placeUnderMouse(Window *c, const QRect &area, Policy /*next*/)
c->keepInArea(area); // make sure it's kept inside workarea
}
void Placement::placeOnMainWindow(Window *c, const QRect &area, Policy nextPlacement)
void Placement::placeOnMainWindow(Window *c, const QRect &area, PlacementPolicy nextPlacement)
{
Q_ASSERT(area.isValid());
if (nextPlacement == Unknown) {
nextPlacement = Centered;
if (nextPlacement == PlacementUnknown) {
nextPlacement = PlacementCentered;
}
if (nextPlacement == Maximizing) { // maximize if needed
placeMaximizing(c, area, NoPlacement);
if (nextPlacement == PlacementMaximizing) { // maximize if needed
placeMaximizing(c, area, PlacementNone);
}
auto mainwindows = c->mainWindows();
Window *place_on = nullptr;
@ -573,7 +573,7 @@ void Placement::placeOnMainWindow(Window *c, const QRect &area, Policy nextPlace
// made as large as its maximum size and then placed centered.
// So the nextPlacement argument allows chaining. In this case, nextPlacement
// is Maximizing and it will call placeCentered().
place(c, area, Centered);
place(c, area, PlacementCentered);
return;
}
}
@ -581,13 +581,13 @@ void Placement::placeOnMainWindow(Window *c, const QRect &area, Policy nextPlace
if (place_on == nullptr) {
// 'mains_count' is used because it doesn't include ignored mainwindows
if (mains_count != 1) {
place(c, area, Centered);
place(c, area, PlacementCentered);
return;
}
place_on = place_on2; // use the only window filtered together with 'mains_count'
}
if (place_on->isDesktop()) {
place(c, area, Centered);
place(c, area, PlacementCentered);
return;
}
QRect geom = c->frameGeometry().toRect();
@ -598,12 +598,12 @@ void Placement::placeOnMainWindow(Window *c, const QRect &area, Policy nextPlace
c->keepInArea(placementArea); // make sure it's kept inside workarea
}
void Placement::placeMaximizing(Window *c, const QRect &area, Policy nextPlacement)
void Placement::placeMaximizing(Window *c, const QRect &area, PlacementPolicy nextPlacement)
{
Q_ASSERT(area.isValid());
if (nextPlacement == Unknown) {
nextPlacement = Smart;
if (nextPlacement == PlacementUnknown) {
nextPlacement = PlacementSmart;
}
if (c->isMaximizable() && c->maxSize().width() >= area.width() && c->maxSize().height() >= area.height()) {
if (workspace()->clientArea(MaximizeArea, c) == area) {
@ -648,7 +648,7 @@ void Placement::unclutterDesktop()
#endif
const char *Placement::policyToString(Policy policy)
const char *Placement::policyToString(PlacementPolicy policy)
{
const char *const policies[] = {
"NoPlacement", "Default", "XXX should never see", "Random", "Smart", "Cascade", "Centered",

View file

@ -12,7 +12,7 @@
#ifndef KWIN_PLACEMENT_H
#define KWIN_PLACEMENT_H
// KWin
#include <kwinglobals.h>
#include "options.h"
// Qt
#include <QList>
#include <QPoint>
@ -30,30 +30,10 @@ class KWIN_EXPORT Placement
public:
explicit Placement();
/**
* Placement policies. How workspace decides the way windows get positioned
* on the screen. The better the policy, the heavier the resource use.
* Normally you don't have to worry. What the WM adds to the startup time
* is nil compared to the creation of the window itself in the memory
*/
enum Policy {
NoPlacement, // not really a placement
Default, // special, means to use the global default
Unknown, // special, means the function should use its default
Random,
Smart,
Cascade,
Centered,
ZeroCornered,
UnderMouse, // special
OnMainWindow, // special
Maximizing
};
void place(Window *c, const QRectF &area);
void placeSmart(Window *c, const QRectF &area, Policy next = Unknown);
void placeSmart(Window *c, const QRectF &area, PlacementPolicy next = PlacementUnknown);
void placeCentered(Window *c, const QRectF &area, Policy next = Unknown);
void placeCentered(Window *c, const QRectF &area, PlacementPolicy next = PlacementUnknown);
void reinitCascading(int desktop);
@ -66,20 +46,20 @@ public:
*/
void unclutterDesktop();
static const char *policyToString(Policy policy);
static const char *policyToString(PlacementPolicy policy);
private:
void place(Window *c, const QRectF &area, Policy policy, Policy nextPlacement = Unknown);
void placeUnderMouse(Window *c, const QRect &area, Policy next = Unknown);
void placeOnMainWindow(Window *c, const QRect &area, Policy next = Unknown);
void place(Window *c, const QRectF &area, PlacementPolicy policy, PlacementPolicy nextPlacement = PlacementUnknown);
void placeUnderMouse(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
void placeOnMainWindow(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
void placeTransient(Window *c);
void placeAtRandom(Window *c, const QRect &area, Policy next = Unknown);
void placeCascaded(Window *c, const QRect &area, Policy next = Unknown);
void placeMaximizing(Window *c, const QRect &area, Policy next = Unknown);
void placeZeroCornered(Window *c, const QRect &area, Policy next = Unknown);
void placeDialog(Window *c, const QRect &area, Policy next = Unknown);
void placeUtility(Window *c, const QRect &area, Policy next = Unknown);
void placeAtRandom(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
void placeCascaded(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
void placeMaximizing(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
void placeZeroCornered(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
void placeDialog(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
void placeUtility(Window *c, const QRect &area, PlacementPolicy next = PlacementUnknown);
void placeOnScreenDisplay(Window *c, const QRect &area);
// CT needed for cascading+

View file

@ -554,7 +554,7 @@ bool Rules::update(Window *c, int selection)
return checkForceStop(var##rule); \
}
APPLY_FORCE_RULE(placement, Placement, Placement::Policy)
APPLY_FORCE_RULE(placement, Placement, PlacementPolicy)
bool Rules::applyGeometry(QRectF &rect, bool init) const
{
@ -810,7 +810,7 @@ void WindowRules::update(Window *c, int selection)
return ret; \
}
CHECK_FORCE_RULE(Placement, Placement::Policy)
CHECK_FORCE_RULE(Placement, PlacementPolicy)
QRectF WindowRules::checkGeometry(QRectF rect, bool init) const
{

View file

@ -15,7 +15,6 @@
#include <netwm_def.h>
#include "options.h"
#include "placement.h"
#include "utils/common.h"
class QDebug;
@ -42,7 +41,7 @@ public:
void discardTemporary();
bool contains(const Rules *rule) const;
void remove(Rules *rule);
Placement::Policy checkPlacement(Placement::Policy placement) const;
PlacementPolicy checkPlacement(PlacementPolicy placement) const;
QRectF checkGeometry(QRectF rect, bool init = false) const;
// use 'invalidPoint' with checkPosition, unlike QSize() and QRect(), QPoint() is a valid point
QPointF checkPosition(QPointF pos, bool init = false) const;
@ -151,7 +150,7 @@ public:
bool update(Window *, int selection);
bool isTemporary() const;
bool discardTemporary(bool force); // removes if temporary and forced or too old
bool applyPlacement(Placement::Policy &placement) const;
bool applyPlacement(PlacementPolicy &placement) const;
bool applyGeometry(QRectF &rect, bool init) const;
// use 'invalidPoint' with applyPosition, unlike QSize() and QRect(), QPoint() is a valid point
bool applyPosition(QPointF &pos, bool init) const;
@ -221,7 +220,7 @@ private:
QByteArray clientmachine;
StringMatch clientmachinematch;
NET::WindowTypes types; // types for matching
Placement::Policy placement;
PlacementPolicy placement;
ForceRule placementrule;
QPoint position;
SetRule positionrule;

View file

@ -67,8 +67,8 @@
<entry name="placement" type="Enum">
<label>Initial placement</label>
<choices name="Placement::Policy"/>
<default code="true">Placement::Centered</default>
<choices name="PlacementPolicy"/>
<default code="true">PlacementCentered</default>
</entry>
<entry name="placementrule" type="Int">
<label>Initial placement rule type</label>

View file

@ -1,5 +1,5 @@
File=rulesettings.kcfg
IncludeFiles=\"rules.h\",\"placement.h\",netwm_def.h
IncludeFiles=\"rules.h\",netwm_def.h
NameSpace=KWin
ClassName=RuleSettings
UseEnumTypes=true

View file

@ -1,7 +1,6 @@
File=kwin.kcfg
NameSpace=KWin
ClassName=Settings
# options.h is needed for FocusPolicy
# placement.h is needed for Placement::Policy
IncludeFiles=\"options.h\", \"placement.h\"
# options.h is needed for FocusPolicy and PlacementPolicy
IncludeFiles=\"options.h\"
UseEnumTypes=true

View file

@ -23,6 +23,7 @@
#include "effects.h"
#include "focuschain.h"
#include "outline.h"
#include "placement.h"
#include "platform.h"
#if KWIN_BUILD_TABBOX
#include "tabbox.h"

View file

@ -76,6 +76,7 @@ class Screens;
class Activities;
#endif
class PlaceholderInputEventFilter;
class Placement;
class KWIN_EXPORT Workspace : public QObject
{

View file

@ -25,6 +25,7 @@
#include "focuschain.h"
#include "group.h"
#include "netinfo.h"
#include "placement.h"
#include "platform.h"
#include "screenedge.h"
#include "shadow.h"

View file

@ -15,6 +15,7 @@
#endif
#include "decorations/decorationbridge.h"
#include "deleted.h"
#include "placement.h"
#include "platform.h"
#include "screenedge.h"
#include "touch_input.h"