PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.
Dart airdrop-alternativeclipboardclipboard-sharingclipboard-synccopy-pastecross-platformend-to-end-encryptionfile-syncfile-transferfluttergolanglinuxmacosnat-traversalp2pself-hostedtailscaleuniversal-clipboardwebrtcwindows
revert(ui): drop the Linux input method focus workaround
baiyuze857a4285ec5b
diff --git a/ui/lib/picker/picker_host.dart b/ui/lib/picker/picker_host.dartindex 453653a..0718a46 100644--- a/ui/lib/picker/picker_host.dart+++ b/ui/lib/picker/picker_host.dart@@ -17,7 +17,6 @@ import 'package:flutter/services.dart';/// onShow 窗口刚显示出来/// onHide 窗口被收起(点了窗口外面、切到别的程序)/// onHotkeyChanged {hotkey} Wayland 上用户在系统设置里改了快捷键-/// onFocusIn Linux:窗口拿到了焦点,重新打开输入法(见 linux/runner/picker_application.cc)class PickerHost {PickerHost([MethodChannel? channel]) : _ch = channel ?? const MethodChannel('pasteferry/picker');@@ -36,11 +35,6 @@ class PickerHost {onHide?.call();case 'onHotkeyChanged':onHotkeyChanged?.call('${(call.arguments as Map?)?['hotkey'] ?? ''}');- case 'onFocusIn':- // 引擎收到 TextInput.hide、TextInput.show 时调用 gtk_im_context_focus_out、focus_in。- // 先 hide:IBus 的输入上下文自认为还有焦点时(窗口收起时没人告诉它失去了焦点),focus_in 什么都不做- await SystemChannels.textInput.invokeMethod<void>('TextInput.hide');- await SystemChannels.textInput.invokeMethod<void>('TextInput.show');}return null;});diff --git a/ui/linux/runner/picker_application.cc b/ui/linux/runner/picker_application.ccindex 4f38bf2..b4f02a6 100644--- a/ui/linux/runner/picker_application.cc+++ b/ui/linux/runner/picker_application.cc@@ -477,16 +477,6 @@ static void toggle_from_portal(PickerApplication* self, const gchar* token) {toggle(self, GDK_CURRENT_TIME);}-// 窗口拿到焦点时告诉 Dart,由它重新连一次输入法(TextInput.hide 再 TextInput.show,见 picker_host.dart)。-// Flutter 只在这两条消息上调用 gtk_im_context_focus_out、focus_in,不管窗口焦点;搜索框的焦点在窗口隐藏时-// 就有了、之后不再变,X11 上 IBus 就一直不知道该把按键交给这个窗口,打不出中文。-// Wayland 上由合成器通知输入法,本来就没问题-static gboolean on_focus_in(GtkWidget*, GdkEvent*, gpointer data) {- auto* self = PICKER_APPLICATION(data);- if (gtk_widget_get_visible(GTK_WIDGET(self->window))) invoke(self, "onFocusIn");- return FALSE;-}-static gboolean on_focus_out(GtkWidget*, GdkEvent*, gpointer data) {// 点了窗口外面、切到别的程序:收起,什么都不粘贴hide(PICKER_APPLICATION(data), TRUE);@@ -663,7 +653,6 @@ static void create_window(PickerApplication* self) {gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_DIALOG);gtk_window_set_default_size(window, kWidth, kHeight);gtk_window_set_position(window, GTK_WIN_POS_CENTER);- g_signal_connect(window, "focus-in-event", G_CALLBACK(on_focus_in), self);g_signal_connect(window, "focus-out-event", G_CALLBACK(on_focus_out), self);g_signal_connect(window, "delete-event", G_CALLBACK(on_delete), self);diff --git a/ui/test/picker_test.dart b/ui/test/picker_test.dartindex 596391e..cc1db81 100644--- a/ui/test/picker_test.dart+++ b/ui/test/picker_test.dart@@ -288,19 +288,6 @@ void main() {await tester.pump(const Duration(milliseconds: 200));});- testWidgets('窗口拿到焦点(Linux 外壳发 onFocusIn)时重新打开输入法', (tester) async {- final s = await open(tester);- s.host.listen();- tester.testTextInput.log.clear();- await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage(- _channel.name,- _channel.codec.encodeMethodCall(const MethodCall('onFocusIn')),- (_) {},- );- await tester.pump();- expect(tester.testTextInput.log.map((c) => c.method), containsAllInOrder(['TextInput.hide', 'TextInput.show']));- });-testWidgets('每次呼出都从「全部」、第一条、空搜索开始', (tester) async {final s = await open(tester);await tester.sendKeyEvent(LogicalKeyboardKey.tab);