Repository: iced-rs/iced (language: rust)

Issue:
Unintended input when text editor gains focus
### Is your issue REALLY a bug?

- [X] My issue is indeed a bug!
- [X] I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

### Is there an existing issue for this?

- [X] I have searched the existing issues.

### Is this issue related to iced?

- [X] My hardware is compatible and my graphics drivers are up-to-date.

### What happened?

This is a bit of niche one. I use the Awesome tiling window manager on Linux. I have `Super+j` and `Super+k` bound to cycle back/forward through windows. When the focus reaches an Iced application with a text input a j or k is typed in the message box. This doesn't happen with any other applications on my system. I first observed the behaviour in the [Halloy IRC client](https://github.com/squidowl/halloy) but it happens with the `editor` example too.

### Steps to Reproduce

- Run Awesome WM
- Cycle through applications with `Super+j` until the Iced editor example is reached
- Observe a `j` or `k` is typed.

Video of behaviour:


https://github.com/user-attachments/assets/a6e6b32e-0a2d-4ccb-a6cc-08afe7930d52



### Environment

OS: Arch Linux, kernel 6.9.7
WM: Awesome
Display Server: X11
GPU: AMD Radeon RX 6700 XT

### What is the expected behavior?

Expected behaviour is that when an iced application is focused via a keyboard shortcut no text is typed.

### Version

master

### Operating System

Linux

### Do you have any log output?

_No response_


Discussion / hints:
This is the case in several environments, including WindowMaker WM on FreeBSD: https://github.com/squidowl/halloy/issues/284

Fix patch:
diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs
index 5d0f834817..8e6f7aaef2 100644
--- a/winit/src/conversion.rs
+++ b/winit/src/conversion.rs
@@ -191,6 +191,8 @@ pub fn window_event(
                 }))
             }
         },
+        // Ignore keyboard presses/releases during window focus/unfocus
+        WindowEvent::KeyboardInput { is_synthetic, .. } if is_synthetic => None,
         WindowEvent::KeyboardInput { event, .. } => Some(Event::Keyboard({
             let key = {
                 #[cfg(not(target_arch = "wasm32"))]


Test patch: