kwin/src/layershellv1window.h
David Edmundson 7292af3d04 Use floating geometry throughout
With fractional scaling integer based logical geometry may not match
device pixels. Once we have a floating point base we can fix that. This
also is
important for our X11 scale override, with a scale of 2 we could
get logical sizes with halves.

We already have all input being floating point, this doubles down on it
for all remaining geometry.

- Outputs remain integer to ensure that any screen on the right remains
aligned.
 - Placement also remains integer based for now.
- Repainting is untouched as we always expand outwards
 			   (QRectF::toAdjustedRect().
 - Decoration is untouched for now
 - Rules are integer in the config, but floating in the adjusting/API
This should also be fine.

At some point we'll add a method to snap to the device pixel
grid. Effectively `round(value * dpr)  / dpr` though right now things
mostly work.

This also gets rid of a lot of hacks for QRect right and bottom which
are very
confusing.

Parts to watch out in the port are:
 QRectF::contains now includes edges
QRectF::right and bottom are now sane so previous hacks have to be
removed
 QRectF(QPoint, QPoint) behaves differently for the same reason
 QRectF::center too

In test results some adjusted values which are the result of
QRect.center because using QRectF's center should behave the same to the
user.
2022-07-14 10:04:46 +01:00

68 lines
1.8 KiB
C++

/*
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "waylandwindow.h"
namespace KWaylandServer
{
class LayerSurfaceV1Interface;
}
namespace KWin
{
class Output;
class LayerShellV1Integration;
class LayerShellV1Window : public WaylandWindow
{
Q_OBJECT
public:
explicit LayerShellV1Window(KWaylandServer::LayerSurfaceV1Interface *shellSurface,
Output *output,
LayerShellV1Integration *integration);
KWaylandServer::LayerSurfaceV1Interface *shellSurface() const;
Output *desiredOutput() const;
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
bool isPlaceable() const override;
bool isCloseable() const override;
bool isMovable() const override;
bool isMovableAcrossScreens() const override;
bool isResizable() const override;
bool takeFocus() override;
bool wantsInput() const override;
StrutRect strutRect(StrutArea area) const override;
bool hasStrut() const override;
void destroyWindow() override;
void closeWindow() override;
void setVirtualKeyboardGeometry(const QRectF &geo) override;
protected:
Layer belongsToLayer() const override;
bool acceptsFocus() const override;
void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override;
private:
void handleSizeChanged();
void handleUnmapped();
void handleCommitted();
void handleAcceptsFocusChanged();
void handleOutputEnabledChanged();
void handleOutputDestroyed();
void scheduleRearrange();
Output *m_desiredOutput;
LayerShellV1Integration *m_integration;
KWaylandServer::LayerSurfaceV1Interface *m_shellSurface;
NET::WindowType m_windowType;
};
} // namespace KWin