7292af3d04
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.
95 lines
2 KiB
C++
95 lines
2 KiB
C++
/*
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "wayland/inputmethod_v1_interface.h"
|
|
#include "waylandwindow.h"
|
|
#include <QPointer>
|
|
|
|
namespace KWin
|
|
{
|
|
class Output;
|
|
|
|
class InputPanelV1Window : public WaylandWindow
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
InputPanelV1Window(KWaylandServer::InputPanelSurfaceV1Interface *panelSurface);
|
|
|
|
enum Mode {
|
|
Toplevel,
|
|
Overlay,
|
|
};
|
|
Q_ENUM(Mode)
|
|
|
|
void destroyWindow() override;
|
|
bool isPlaceable() const override
|
|
{
|
|
return false;
|
|
}
|
|
bool isCloseable() const override
|
|
{
|
|
return false;
|
|
}
|
|
bool isResizable() const override
|
|
{
|
|
return false;
|
|
}
|
|
bool isMovable() const override
|
|
{
|
|
return false;
|
|
}
|
|
bool isMovableAcrossScreens() const override
|
|
{
|
|
return false;
|
|
}
|
|
bool acceptsFocus() const override
|
|
{
|
|
return false;
|
|
}
|
|
void closeWindow() override
|
|
{
|
|
}
|
|
bool takeFocus() override
|
|
{
|
|
return false;
|
|
}
|
|
bool wantsInput() const override
|
|
{
|
|
return false;
|
|
}
|
|
bool isInputMethod() const override
|
|
{
|
|
return true;
|
|
}
|
|
NET::WindowType windowType(bool /*direct*/, int /*supported_types*/) const override;
|
|
QRectF inputGeometry() const override;
|
|
|
|
Mode mode() const
|
|
{
|
|
return m_mode;
|
|
}
|
|
void allow();
|
|
|
|
protected:
|
|
void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override;
|
|
|
|
private:
|
|
void showTopLevel(KWaylandServer::OutputInterface *output, KWaylandServer::InputPanelSurfaceV1Interface::Position position);
|
|
void showOverlayPanel();
|
|
void reposition();
|
|
void setOutput(KWaylandServer::OutputInterface *output);
|
|
|
|
QPointer<Output> m_output;
|
|
Mode m_mode = Toplevel;
|
|
const QPointer<KWaylandServer::InputPanelSurfaceV1Interface> m_panelSurface;
|
|
};
|
|
|
|
}
|