Spike: KWin input-method backend with floating layer-shell window
Registers as KWin's virtual keyboard (input-method-unstable-v1), shows a non-focusable layer-shell overlay, and commits Unicode text. Verified in a nested headless KWin with the textprobe tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
|
||||
class QWindow;
|
||||
namespace LayerShellQt { class Window; }
|
||||
|
||||
// Places a keyboard window as a free-floating overlay that never takes focus.
|
||||
// On Wayland: a layer-shell surface anchored top-left, positioned via margins.
|
||||
// On X11: a frameless, non-focusable, always-on-top tool window.
|
||||
class FloatingWindow : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged)
|
||||
|
||||
public:
|
||||
// Must be called before the window is shown for the first time.
|
||||
explicit FloatingWindow(QWindow *window, QObject *parent = nullptr);
|
||||
|
||||
QPoint position() const { return m_position; }
|
||||
void setPosition(QPoint position);
|
||||
|
||||
Q_INVOKABLE void moveBy(qreal dx, qreal dy);
|
||||
Q_INVOKABLE void show();
|
||||
Q_INVOKABLE void hide();
|
||||
|
||||
Q_SIGNALS:
|
||||
void positionChanged();
|
||||
|
||||
private:
|
||||
QPoint clamped(QPoint position) const;
|
||||
QPoint defaultPosition() const;
|
||||
void apply();
|
||||
|
||||
QWindow *m_window;
|
||||
LayerShellQt::Window *m_layerSurface = nullptr;
|
||||
QPoint m_position;
|
||||
};
|
||||
Reference in New Issue
Block a user