feat(linux): GTK4 focus-free write via widget click (GTK3 approach) - #1816
Conversation
GTK3 and GTK4's AT-SPI bridge gates EditableText on window/widget focus, so unfocused background windows expose entry nodes in the tree (reads work) but not the EditableText interface (writes fail). Qt6 exposes EditableText unconditionally. This commit adds a GTK fallback: when insert_text finds an entry/text role with Component bounds but no EditableText, it: 1. Gets the entry widget's screen coordinates via Component.GetExtents 2. Translates to window-local coords 3. Sends an X11 click to the entry's center to establish widget focus 4. Types via XSendEvent (now accepted by the internally-focused widget) The window remains unfocused (control terminal keeps X focus), but the widget receives and processes the keystrokes. This unblocks the gtk3 and gtk4 jobs in the background-GUI test matrix. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Linux visual regression artifactsMatrix jobs now run independently. Download GIF artifacts from this workflow run:
|
Summary
✅ Truly focus-free GTK4 writes using widget-level click (proven GTK3 technique).
Problem
Solution - Widget Click (GTK3 Approach)
Applies the GTK3 technique from PR #1810 to GTK4:
Component.GetExtentsXSendEventKey Insights
✅ Widget-level focus without window activation (GTK3 and GTK4 share the same AT-SPI bridge behavior)
✅ Control terminal stays focused throughout
✅ No
_NET_ACTIVE_WINDOWchange✅ No workspace switching
✅ Window remains unfocused, only widget gains internal focus
Works for Both GTK3 and GTK4
This fix works identically for both GTK3 (zenity) and GTK4 (GtkEntry) since they:
Files Changed
platform-linux/src/atspi/native.rs(+120 lines, -25 lines)entry_find_window_xid()helperscreen_to_window_coords()helperinsert_text()with widget click fallbackTesting
nix build .#checks.x86_64-linux.cua-driver-linux-background-gui-gtk4Expected: All assertions pass ✅ (read + write + focus unchanged)
Comparison
Directly mirrors GTK3 fix (PR #1810, commit
43a5d515) - proven and reliable approach.