fix: use floating geometry to be compatible with KWin 5.26

This commit is contained in:
Mikhail Zolotukhin 2022-09-17 21:36:05 +03:00
parent 042123bdd2
commit 8fd8a0f95e
17 changed files with 35 additions and 35 deletions

View File

@ -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());
}

View File

@ -37,7 +37,7 @@ private:
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;

View File

@ -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();

View File

@ -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<Window> &windows) const = 0;
virtual void apply(QRectF area, std::vector<Window> &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;

View File

@ -5,7 +5,7 @@
namespace Bismuth
{
void Monocle::apply(QRect area, std::vector<Window> &windows) const
void Monocle::apply(QRectF area, std::vector<Window> &windows) const
{
for (auto &window : windows) {
// Place the window on the all available area

View File

@ -10,6 +10,6 @@ namespace Bismuth
struct Monocle : Layout {
using Layout::Layout;
virtual void apply(QRect area, std::vector<Window> &windows) const override;
virtual void apply(QRectF area, std::vector<Window> &windows) const override;
};
}

View File

@ -5,7 +5,7 @@
namespace Bismuth
{
void Stacked::apply(QRect area, std::vector<Window> &windows) const
void Stacked::apply(QRectF area, std::vector<Window> &windows) const
{
}
}

View File

@ -10,6 +10,6 @@ namespace Bismuth
struct Stacked : Layout {
using Layout::Layout;
virtual void apply(QRect area, std::vector<Window> &windows) const override;
virtual void apply(QRectF area, std::vector<Window> &windows) const override;
};
}

View File

@ -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);
}

View File

@ -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;

View File

@ -45,8 +45,8 @@ public:
* 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 @@ public:
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 @@ public:
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 @@ public:
* 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 @@ public:
*
* @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.

View File

@ -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<PlasmaApi::Window> Workspace::clientList() const

View File

@ -62,7 +62,7 @@ public:
* @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<PlasmaApi::Window> clientList() const;

View File

@ -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

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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 @@ public:
int m_desktop{};
int m_screen{};
QStringList m_activities{};
QRect m_frameGeometry{};
QRectF m_frameGeometry{};
};