diff --git a/src/core/engine/engine.cpp b/src/core/engine/engine.cpp index b7528308..f41fd49e 100644 --- a/src/core/engine/engine.cpp +++ b/src/core/engine/engine.cpp @@ -238,7 +238,7 @@ void Engine::arrangeWindowsOnSurface(const Surface &surface) layout.apply(tilingArea, windowsThatCanBeTiled); } -QRect Engine::workingArea(const Surface &surface) const +QRectF Engine::workingArea(const Surface &surface) const { return m_plasmaApi.workspace().clientArea(PlasmaApi::Workspace::PlacementArea, surface.screen(), surface.desktop()); } diff --git a/src/core/engine/engine.hpp b/src/core/engine/engine.hpp index 873dbd28..79ff8013 100644 --- a/src/core/engine/engine.hpp +++ b/src/core/engine/engine.hpp @@ -37,7 +37,7 @@ struct Engine { Surface activeSurface() const; void arrangeWindowsOnSurface(const Surface &); - QRect workingArea(const Surface &surface) const; + QRectF workingArea(const Surface &surface) const; const Bismuth::Config &m_config; WindowsList m_windows; diff --git a/src/core/engine/layout/layout.cpp b/src/core/engine/layout/layout.cpp index de21cd42..55aceb2c 100644 --- a/src/core/engine/layout/layout.cpp +++ b/src/core/engine/layout/layout.cpp @@ -10,7 +10,7 @@ Layout::Layout(const Bismuth::Config &config) { } -QRect Layout::tilingArea(QRect workingArea) const +QRectF Layout::tilingArea(QRectF workingArea) const { auto marginLeft = m_config.screenGapLeft(); auto marginTop = m_config.screenGapTop(); diff --git a/src/core/engine/layout/layout.hpp b/src/core/engine/layout/layout.hpp index d36983bf..fcbbd46a 100644 --- a/src/core/engine/layout/layout.hpp +++ b/src/core/engine/layout/layout.hpp @@ -19,12 +19,12 @@ struct Layout { * Apply layout for the @p windows on tiling @p area. Method changes the * geometry of the windows to match the particular layout. */ - virtual void apply(QRect area, std::vector &windows) const = 0; + virtual void apply(QRectF area, std::vector &windows) const = 0; /** * Get the area on which tiled windows could be placed given the general @p workingArea */ - virtual QRect tilingArea(QRect workingArea) const; + virtual QRectF tilingArea(QRectF workingArea) const; protected: const Bismuth::Config &m_config; diff --git a/src/core/engine/layout/monocle.cpp b/src/core/engine/layout/monocle.cpp index 2db5908b..814ea549 100644 --- a/src/core/engine/layout/monocle.cpp +++ b/src/core/engine/layout/monocle.cpp @@ -5,7 +5,7 @@ namespace Bismuth { -void Monocle::apply(QRect area, std::vector &windows) const +void Monocle::apply(QRectF area, std::vector &windows) const { for (auto &window : windows) { // Place the window on the all available area diff --git a/src/core/engine/layout/monocle.hpp b/src/core/engine/layout/monocle.hpp index 1d550bb1..00b0da81 100644 --- a/src/core/engine/layout/monocle.hpp +++ b/src/core/engine/layout/monocle.hpp @@ -10,6 +10,6 @@ namespace Bismuth struct Monocle : Layout { using Layout::Layout; - virtual void apply(QRect area, std::vector &windows) const override; + virtual void apply(QRectF area, std::vector &windows) const override; }; } diff --git a/src/core/engine/layout/stacked.cpp b/src/core/engine/layout/stacked.cpp index 0e5dbe10..812bfbd3 100644 --- a/src/core/engine/layout/stacked.cpp +++ b/src/core/engine/layout/stacked.cpp @@ -5,7 +5,7 @@ namespace Bismuth { -void Stacked::apply(QRect area, std::vector &windows) const +void Stacked::apply(QRectF area, std::vector &windows) const { } } diff --git a/src/core/engine/layout/stacked.hpp b/src/core/engine/layout/stacked.hpp index 6723581f..6547d5c4 100644 --- a/src/core/engine/layout/stacked.hpp +++ b/src/core/engine/layout/stacked.hpp @@ -10,6 +10,6 @@ namespace Bismuth struct Stacked : Layout { using Layout::Layout; - virtual void apply(QRect area, std::vector &windows) const override; + virtual void apply(QRectF area, std::vector &windows) const override; }; } diff --git a/src/core/engine/window.cpp b/src/core/engine/window.cpp index 96a36f45..bc421253 100644 --- a/src/core/engine/window.cpp +++ b/src/core/engine/window.cpp @@ -31,12 +31,12 @@ void Window::activate() m_workspace.get().setActiveClient(m_client); } -QRect Window::geometry() const +QRectF Window::geometry() const { return m_client.frameGeometry(); } -void Window::setGeometry(QRect newGeometry) +void Window::setGeometry(QRectF newGeometry) { m_client.setFrameGeometry(newGeometry); } diff --git a/src/core/engine/window.hpp b/src/core/engine/window.hpp index 95aa2724..644dd33e 100644 --- a/src/core/engine/window.hpp +++ b/src/core/engine/window.hpp @@ -28,8 +28,8 @@ struct Window { void activate(); - QRect geometry() const; - void setGeometry(QRect); + QRectF geometry() const; + void setGeometry(QRectF); void setMode(Mode); Mode mode() const; diff --git a/src/core/plasma-api/window.hpp b/src/core/plasma-api/window.hpp index abb40e09..103106d1 100644 --- a/src/core/plasma-api/window.hpp +++ b/src/core/plasma-api/window.hpp @@ -45,8 +45,8 @@ class Window : public QObject * occupies on the screen. This rectangle includes invisible portions of the * window, e.g. client-side drop shadows, etc. */ - BI_READONLY_PROPERTY(QRect, bufferGeometry) - // Q_PROPERTY(QRect bufferGeometry READ bufferGeometry) + BI_READONLY_PROPERTY(QRectF, bufferGeometry) + // Q_PROPERTY(QRectF bufferGeometry READ bufferGeometry) /** * This property holds the position of the Window's frame geometry. @@ -84,8 +84,8 @@ class Window : public QObject BI_READONLY_PROPERTY(int, height) // Q_PROPERTY(int height READ height NOTIFY frameGeometryChanged) - BI_READONLY_PROPERTY(QRect, visibleRect) - // Q_PROPERTY(QRect visibleRect READ visibleGeometry) + BI_READONLY_PROPERTY(QRectF, visibleRect) + // Q_PROPERTY(QRectF visibleRect READ visibleGeometry) BI_READONLY_PROPERTY(qreal, opacity) // Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) @@ -96,8 +96,8 @@ class Window : public QObject BI_READONLY_PROPERTY(qulonglong, windowId) // Q_PROPERTY(qulonglong windowId READ window CONSTANT) - BI_READONLY_PROPERTY(QRect, rect) - // Q_PROPERTY(QRect rect READ rect) + BI_READONLY_PROPERTY(QRectF, rect) + // Q_PROPERTY(QRectF rect READ rect) BI_READONLY_PROPERTY(QPoint, clientPos) // Q_PROPERTY(QPoint clientPos READ clientPos) @@ -432,8 +432,8 @@ class Window : public QObject * The value is evaluated each time the getter is called. * Because of that no changed signal is provided. */ - BI_READONLY_PROPERTY(QRect, iconGeometry) - // Q_PROPERTY(QRect iconGeometry READ iconGeometry) + BI_READONLY_PROPERTY(QRectF, iconGeometry) + // Q_PROPERTY(QRectF iconGeometry READ iconGeometry) /** * Returns whether the window is any of special windows types (desktop, dock, splash, ...), @@ -507,14 +507,14 @@ class Window : public QObject * * @deprecated Use frameGeometry */ - // Q_PROPERTY(QRect geometry READ frameGeometry WRITE moveResize NOTIFY frameGeometryChanged) + // Q_PROPERTY(QRectF geometry READ frameGeometry WRITE moveResize NOTIFY frameGeometryChanged) /** * The geometry of this Window. Be aware that depending on resize mode the frameGeometryChanged * signal might be emitted at each resize step or only at the end of the resize operation. */ - BI_PROPERTY(QRect, frameGeometry, setFrameGeometry) - // Q_PROPERTY(QRect frameGeometry READ frameGeometry WRITE moveResize NOTIFY frameGeometryChanged) + BI_PROPERTY(QRectF, frameGeometry, setFrameGeometry) + // Q_PROPERTY(QRectF frameGeometry READ frameGeometry WRITE moveResize NOTIFY frameGeometryChanged) /** * Whether the Window is currently being moved by the user. diff --git a/src/core/plasma-api/workspace.cpp b/src/core/plasma-api/workspace.cpp index e3592562..c768c528 100644 --- a/src/core/plasma-api/workspace.cpp +++ b/src/core/plasma-api/workspace.cpp @@ -52,9 +52,9 @@ void Workspace::wrapSignals() WRAP_SIGNAL_WITH_KWIN_TYPE(clientMaximizeSet(KWin::Window *, bool, bool)); }; -QRect Workspace::clientArea(ClientAreaOption option, int screen, int desktop) +QRectF Workspace::clientArea(ClientAreaOption option, int screen, int desktop) { - BI_METHOD_IMPL_WRAP(QRect, "clientArea(ClientAreaOption, int, int)", Q_ARG(ClientAreaOption, option), Q_ARG(int, screen), Q_ARG(int, desktop)); + BI_METHOD_IMPL_WRAP(QRectF, "clientArea(ClientAreaOption, int, int)", Q_ARG(ClientAreaOption, option), Q_ARG(int, screen), Q_ARG(int, desktop)); }; std::vector Workspace::clientList() const diff --git a/src/core/plasma-api/workspace.hpp b/src/core/plasma-api/workspace.hpp index f0d29495..c361ca3a 100644 --- a/src/core/plasma-api/workspace.hpp +++ b/src/core/plasma-api/workspace.hpp @@ -62,7 +62,7 @@ class Workspace : public QObject * @param desktop The desktop for which the area should be considered, in general there should not be a difference * @returns The specified screen geometry */ - Q_INVOKABLE QRect clientArea(ClientAreaOption, int screen, int desktop); + Q_INVOKABLE QRectF clientArea(ClientAreaOption, int screen, int desktop); Q_INVOKABLE std::vector clientList() const; diff --git a/src/kwinscript/extern/kwin.d.ts b/src/kwinscript/extern/kwin.d.ts index e6c67baf..2d427cf6 100644 --- a/src/kwinscript/extern/kwin.d.ts +++ b/src/kwinscript/extern/kwin.d.ts @@ -68,7 +68,7 @@ declare namespace KWin { /* functions */ clientList(): Client[]; - clientArea(option: number, screen: number, desktop: number): QRect; + clientArea(option: number, screen: number, desktop: number): QRectF; } interface Options { @@ -231,7 +231,7 @@ declare namespace KWin { * This property holds the geometry of the Toplevel, excluding invisible * portions, e.g. server-side and client-side drop-shadows, etc. */ - frameGeometry: QRect; + frameGeometry: QRectF; /** * Whether the window is set to be above all diff --git a/src/kwinscript/extern/qt.d.ts b/src/kwinscript/extern/qt.d.ts index 091e4a4c..62a1a828 100644 --- a/src/kwinscript/extern/qt.d.ts +++ b/src/kwinscript/extern/qt.d.ts @@ -10,7 +10,7 @@ interface QByteArray { /* keep it empty for now */ } -interface QRect { +interface QRectF { height: number; width: number; x: number; @@ -49,5 +49,5 @@ interface QQmlTimer { declare namespace Qt { function createQmlObject(qml: string, parent: object, filepath?: string): any; - function rect(x: number, y: number, width: number, height: number): QRect; + function rect(x: number, y: number, width: number, height: number): QRectF; } diff --git a/src/kwinscript/util/rect.ts b/src/kwinscript/util/rect.ts index 9e86344a..2157b4e5 100644 --- a/src/kwinscript/util/rect.ts +++ b/src/kwinscript/util/rect.ts @@ -11,7 +11,7 @@ export class Rect { public height: number ) {} - public static fromQRect(qRect: QRect): Rect { + public static fromQRect(qRect: QRectF): Rect { return new Rect(qRect.x, qRect.y, qRect.width, qRect.height); } @@ -86,7 +86,7 @@ export class Rect { ); } - public toQRect(): QRect { + public toQRect(): QRectF { return Qt.rect(this.x, this.y, this.width, this.height); } diff --git a/tests/core/plasma-api/window.mock.hpp b/tests/core/plasma-api/window.mock.hpp index 260106ee..2460c33a 100644 --- a/tests/core/plasma-api/window.mock.hpp +++ b/tests/core/plasma-api/window.mock.hpp @@ -16,7 +16,7 @@ class FakeKWinClient : public QObject Q_PROPERTY(int desktop MEMBER m_desktop) Q_PROPERTY(int screen MEMBER m_screen) Q_PROPERTY(QStringList activities MEMBER m_activities) - Q_PROPERTY(QRect frameGeometry MEMBER m_frameGeometry) + Q_PROPERTY(QRectF frameGeometry MEMBER m_frameGeometry) public: FakeKWinClient &operator=(const FakeKWinClient &); @@ -26,5 +26,5 @@ class FakeKWinClient : public QObject int m_desktop{}; int m_screen{}; QStringList m_activities{}; - QRect m_frameGeometry{}; + QRectF m_frameGeometry{}; };