diff --git a/autotests/integration/kwin_wayland_test.cpp b/autotests/integration/kwin_wayland_test.cpp index 4c71d7dea2..7886fd9c8d 100644 --- a/autotests/integration/kwin_wayland_test.cpp +++ b/autotests/integration/kwin_wayland_test.cpp @@ -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); diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index 3b70173083..99e3095f36 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -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" diff --git a/autotests/integration/placement_test.cpp b/autotests/integration/placement_test.cpp index 3a19b6d273..018a411f11 100644 --- a/autotests/integration/placement_test.cpp +++ b/autotests/integration/placement_test.cpp @@ -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> TestPla void TestPlacement::testPlaceSmart() { - setPlacementPolicy(Placement::Smart); + setPlacementPolicy(PlacementSmart); std::vector> surfaces; QRegion usedArea; @@ -154,7 +155,7 @@ void TestPlacement::testPlaceSmart() void TestPlacement::testPlaceZeroCornered() { - setPlacementPolicy(Placement::ZeroCornered); + setPlacementPolicy(PlacementZeroCornered); std::vector> 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 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 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 outputs = workspace()->outputs(); - setPlacementPolicy(Placement::Smart); + setPlacementPolicy(PlacementSmart); std::unique_ptr surface(Test::createSurface()); std::unique_ptr shellSurface(Test::createXdgToplevelSurface(surface.get())); diff --git a/src/kcmkwin/kwinrules/rulesmodel.cpp b/src/kcmkwin/kwinrules/rulesmodel.cpp index dd196969cb..5d02c97990 100644 --- a/src/kcmkwin/kwinrules/rulesmodel.cpp +++ b/src/kcmkwin/kwinrules/rulesmodel.cpp @@ -789,16 +789,16 @@ QList RulesModel::activitiesModelData() const QList RulesModel::placementModelData() const { static const auto modelData = QList{ - {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; } diff --git a/src/kwin.kcfg b/src/kwin.kcfg index 05d6b1dcbd..b668b7cc89 100644 --- a/src/kwin.kcfg +++ b/src/kwin.kcfg @@ -112,24 +112,24 @@ 4 - - - - - - - - - - - - + + + + + + + + + + + + [] { #if KWIN_BUILD_DECORATIONS - return Placement::Centered; + return PlacementCentered; #else - return Placement::Maximizing; + return PlacementMaximizing; #endif }() diff --git a/src/options.cpp b/src/options.cpp index ec2b41ba84..b8be19d389 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -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)) { + if (m_placement == placement) { return; } - m_placement = static_cast(placement); + m_placement = placement; Q_EMIT placementChanged(); } diff --git a/src/options.h b/src/options.h index cc2ac3c626..7040cec0f1 100644 --- a/src/options.h +++ b/src/options.h @@ -13,7 +13,6 @@ #define KWIN_OPTIONS_H #include "main.h" -#include "placement.h" #include @@ -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; diff --git a/src/placement.cpp b/src/placement.cpp index e32ed75a87..60a0956bf6 100644 --- a/src/placement.cpp +++ b/src/placement.cpp @@ -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", diff --git a/src/placement.h b/src/placement.h index ba0fed6878..28b8288af7 100644 --- a/src/placement.h +++ b/src/placement.h @@ -12,7 +12,7 @@ #ifndef KWIN_PLACEMENT_H #define KWIN_PLACEMENT_H // KWin -#include +#include "options.h" // Qt #include #include @@ -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+ diff --git a/src/rules.cpp b/src/rules.cpp index 5ba332cf6f..d8daa2c34b 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -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 { diff --git a/src/rules.h b/src/rules.h index fbd0ded832..03e1990999 100644 --- a/src/rules.h +++ b/src/rules.h @@ -15,7 +15,6 @@ #include #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; diff --git a/src/rulesettings.kcfg b/src/rulesettings.kcfg index 78cd22691b..68ab361919 100644 --- a/src/rulesettings.kcfg +++ b/src/rulesettings.kcfg @@ -67,8 +67,8 @@ - - Placement::Centered + + PlacementCentered diff --git a/src/rulesettings.kcfgc b/src/rulesettings.kcfgc index d244e98601..2a5e26aa19 100644 --- a/src/rulesettings.kcfgc +++ b/src/rulesettings.kcfgc @@ -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 diff --git a/src/settings.kcfgc b/src/settings.kcfgc index 5656eb1a18..8ed482e26c 100644 --- a/src/settings.kcfgc +++ b/src/settings.kcfgc @@ -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 diff --git a/src/window.cpp b/src/window.cpp index a2a1b696cb..df62bd2870 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -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" diff --git a/src/workspace.h b/src/workspace.h index 050f51b3b5..0d09aa0822 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -76,6 +76,7 @@ class Screens; class Activities; #endif class PlaceholderInputEventFilter; +class Placement; class KWIN_EXPORT Workspace : public QObject { diff --git a/src/x11window.cpp b/src/x11window.cpp index e52f936357..c122765ee3 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -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" diff --git a/src/xdgshellwindow.cpp b/src/xdgshellwindow.cpp index 52f226f17e..9c0b70560c 100644 --- a/src/xdgshellwindow.cpp +++ b/src/xdgshellwindow.cpp @@ -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"