Skip to content

iris window: release held keys on focus loss; Right Cmd releases the grab on macOS - #183

Merged
techomancer merged 2 commits into
techomancer:mainfrom
atomchild411:release-keys-on-focus-loss
Oct 7, 2026
Merged

techomancer merged 2 commits into
techomancer:mainfrom
atomchild411:release-keys-on-focus-loss

Conversation

@atomchild411

@atomchild411 atomchild411 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Switching away from the iris window with Cmd-Tab (or Alt-Tab) leaves keys stuck down in the guest. The switch keys are pressed while the window has focus and released after it has gone, so iris never sends their key-ups — nor the key-up of anything else held at that moment. IRIX keeps the key held until it is pressed and released again.

How it shows: with Shift stuck, every Motif scrollbar ignores clicks (their translations exclude Shift) while menus and lists keep working; with a stuck modifier, typed text comes out shifted. A mouse button held at the moment focus goes (mid-drag) stays down the same way. The README's note that Alt-tabbing away can garble keyboard input is this.

Separately: the iris window's only way to release the grab is Right Ctrl, which Mac keyboards (every MacBook, the Magic Keyboard) don't have.

Fix

One commit, in src/ui.rs (the iris window only; iris-gui already lifts its held modifiers when it releases capture on focus loss):

  • The window remembers the keys it has sent the guest as pressed and not yet released.
  • On WindowEvent::Focused(false) it sends their releases, clears held mouse buttons (one PS/2 report with no buttons), and forgets Right Ctrl, then releases the grab as before.
  • On macOS, Right Cmd releases the grab like Right Ctrl, and is not passed to the guest.

README (Input) and CHANGELOG updated.

Testing

  • cargo build --release, cargo test --release --lib: 887 passed.
  • Diagnosis on IRIX 6.5.22: after a Cmd-Tab away and back, XQueryKeymap on the guest's X server showed Shift_L down and Motif scrollbars ignored clicks; releasing Shift_L (XTest) made them work again.
  • By hand on macOS, IP28 running IRIX 6.5.22: with Shift held, Cmd-Tab away and back; no key stays down in the guest and Motif scrollbars keep working. Right Cmd releases the grab.

🤖 Generated with Claude Code

…ngrabs on macOS

Cmd-Tab (or Alt-Tab) is pressed in the iris window and released in the
next one, so the guest never saw the key-ups: whatever was held at that
moment stayed down in IRIX.  A stuck Shift made every Motif scrollbar
ignore clicks (their translations exclude Shift) while menus still
worked.

The window now remembers the keys it sent the guest as pressed and, on
Focused(false), sends their releases, clears the held mouse buttons and
forgets Right Ctrl.  iris-gui already lifts its held modifiers when it
releases capture on focus loss.

Mac keyboards have no Right Ctrl, the iris window's only way to release
the grab; on macOS Right Cmd releases it too, and is not passed to the
guest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@atomchild411
atomchild411 marked this pull request as ready for review October 7, 2026 05:29
@techomancer
techomancer merged commit e6b77c6 into techomancer:main Oct 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants