Skip to content

Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.

Windows: type emoji and IME text into the phone's windows

Beef312a4a5873b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fc16a20..9b83aea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -51,6 +51,9 @@ change things that need a step from you, and its notes say so.
which stopped the app and froze the window. While a window is open, the
phone now stays awake with its screen dimmed, and sleeps as usual once the
last window closes.
+- Windows: the emoji panel (**Win+.**) and input methods for Chinese and
+ other languages type into the phone's screen and app windows while you
+ control them. Only plain key presses got through before.
## 0.1.3 (2026-10-15)
diff --git a/desktop/app/cpp/video_view.cpp b/desktop/app/cpp/video_view.cpp
index 5142b53..6093d7e 100644
--- a/desktop/app/cpp/video_view.cpp
+++ b/desktop/app/cpp/video_view.cpp
@@ -3,8 +3,11 @@
#include <QtCore/QHash>
#include <QtCore/QUrl>
+#include <QtGui/QGuiApplication>
#include <QtGui/QIcon>
#include <QtGui/QImage>
+#include <QtGui/QInputMethod>
+#include <QtGui/QInputMethodEvent>
#include <QtGui/QPixmap>
#include <QtQuick/QQuickWindow>
#include <QtQuick/QSGSimpleTextureNode>
@@ -106,6 +109,47 @@ void VideoView::setWindowAppId(const QString &appId)
applyWindowChrome();
}
+void VideoView::setAcceptsText(bool on)
+{
+ if (on == m_acceptsText)
+ return;
+ m_acceptsText = on;
+ setFlag(ItemAcceptsInputMethod, on);
+ if (hasActiveFocus())
+ QGuiApplication::inputMethod()->update(Qt::ImEnabled);
+ emit acceptsTextChanged();
+}
+
+void VideoView::inputMethodEvent(QInputMethodEvent *event)
+{
+ // Text being composed stays in the input method's own window; only
+ // finished text goes to the phone.
+ if (m_acceptsText && !event->commitString().isEmpty())
+ emit textCommitted(event->commitString());
+ event->accept();
+}
+
+QVariant VideoView::inputMethodQuery(Qt::InputMethodQuery query) const
+{
+ switch (query) {
+ case Qt::ImEnabled:
+ return m_acceptsText;
+ case Qt::ImCursorRectangle: {
+ // There is no caret to point at: the emoji panel and candidate
+ // lists open at the middle of the phone's picture.
+ const QPointF middle = pictureRect().center();
+ return QRectF(middle.x(), middle.y(), 1, 1);
+ }
+ case Qt::ImSurroundingText:
+ return QString();
+ case Qt::ImCursorPosition:
+ case Qt::ImAnchorPosition:
+ return 0;
+ default:
+ return QQuickItem::inputMethodQuery(query);
+ }
+}
+
void VideoView::itemChange(ItemChange change, const ItemChangeData &value)
{
QQuickItem::itemChange(change, value);
diff --git a/desktop/app/cpp/video_view.h b/desktop/app/cpp/video_view.h
index e93f83c..685c8d4 100644
--- a/desktop/app/cpp/video_view.h
+++ b/desktop/app/cpp/video_view.h
@@ -28,6 +28,9 @@ class VideoView : public QQuickItem
Q_PROPERTY(QString windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged)
// Optional Windows AppUserModelID so each app window gets its own taskbar identity.
Q_PROPERTY(QString windowAppId READ windowAppId WRITE setWindowAppId NOTIFY windowAppIdChanged)
+ // Whether text from input methods (the emoji panel, IMEs for Chinese and
+ // other languages) is taken, and given out through `textCommitted`.
+ Q_PROPERTY(bool acceptsText READ acceptsText WRITE setAcceptsText NOTIFY acceptsTextChanged)
public:
explicit VideoView(QQuickItem *parent = nullptr);
@@ -41,6 +44,8 @@ public:
void setWindowIcon(const QString &icon);
QString windowAppId() const { return m_windowAppId; }
void setWindowAppId(const QString &appId);
+ bool acceptsText() const { return m_acceptsText; }
+ void setAcceptsText(bool on);
// Where the picture is drawn in the item (letterboxed).
Q_INVOKABLE QRectF pictureRect() const;
@@ -51,10 +56,15 @@ signals:
void framesChanged();
void windowIconChanged();
void windowAppIdChanged();
+ void acceptsTextChanged();
+ // An input method finished some text (an emoji, a word in Chinese...).
+ void textCommitted(const QString &text);
protected:
QSGNode *updatePaintNode(QSGNode *old, UpdatePaintNodeData *) override;
void itemChange(ItemChange change, const ItemChangeData &value) override;
+ void inputMethodEvent(QInputMethodEvent *event) override;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
private:
Q_INVOKABLE void frameArrived();
@@ -67,6 +77,7 @@ private:
quint64 m_shown = 0;
QString m_windowIcon;
QString m_windowAppId;
+ bool m_acceptsText = false;
};
// The latest picture of `stream`: `width` x `height`, 32-bit BGRX rows.
diff --git a/desktop/app/qml/MirrorWindow.qml b/desktop/app/qml/MirrorWindow.qml
index 7e105b6..1348e56 100644
--- a/desktop/app/qml/MirrorWindow.qml
+++ b/desktop/app/qml/MirrorWindow.qml
@@ -112,6 +112,10 @@ Window {
? "Nectarlink.App." + (win.info.device || "").slice(0, 8) + "." + win.info.pkg
: ""
focus: true
+ acceptsText: win.phase === "showing" && win.canControl
+ // The emoji panel (Win+.) and input methods give finished text here
+ // instead of as key presses.
+ onTextCommitted: (text) => Mirror.text(win.mirrorKey, text)
// Where on the phone's screen a point in the window is (0 to 1).
function at(x, y) {