From d92f47746f3eb83e90de8319f0e945a7b2fb8ed0 Mon Sep 17 00:00:00 2001 From: Bo He Date: Wed, 14 Jan 2026 11:04:30 +0800 Subject: [PATCH] linux: Fix duplicate IME input on Wayland and Sunshine remotes (#46560) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary This PR fixes a issue where Chinese characters (and other IME-based inputs) would duplicate in the editor on Linux Wayland after remote desktop connected (e.g., via Sunshine) . ## Steps to Reproduce requirement: linux with wayland, and Sunshine(this is remote desktop server) installed 1. opening zed 2. using other device connect to Sunshine 3. input Chinese characters such as "的" ### Expected Result "的" ### Actual Result "的的" ### bug recording https://github.com/user-attachments/assets/d18961ec-48cb-4c06-a396-9fc604591769 --- crates/gpui/src/platform/linux/wayland/client.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rs index 227791324efe550390c3679cd917d6ce145f277a..494ae855594ead6a72bce3e710092c19b3b66938 100644 --- a/crates/gpui/src/platform/linux/wayland/client.rs +++ b/crates/gpui/src/platform/linux/wayland/client.rs @@ -1224,6 +1224,12 @@ impl Dispatch for WaylandClientStatePtr { if capabilities.contains(wl_seat::Capability::Keyboard) { let keyboard = seat.get_keyboard(qh, ()); + if let Some(text_input) = state.text_input.take() { + text_input.destroy(); + state.ime_pre_edit = None; + state.composing = false; + } + state.text_input = state .globals .text_input_manager @@ -1238,6 +1244,11 @@ impl Dispatch for WaylandClientStatePtr { } if capabilities.contains(wl_seat::Capability::Pointer) { let pointer = seat.get_pointer(qh, ()); + + if let Some(cursor_shape_device) = state.cursor_shape_device.take() { + cursor_shape_device.destroy(); + } + state.cursor_shape_device = state .globals .cursor_shape_manager