Skip to content

Commit

Permalink
Stop IME just before shutting down (#767)
Browse files Browse the repository at this point in the history
This works around a janky behaviour where IME content is transferred to
new instances of the same app.

This might not be needed on other systems, but I don't think that this
change can cause any harm either.
  • Loading branch information
DJMcNab authored Dec 3, 2024
1 parent 89085cf commit ce8387a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion masonry/src/event_loop_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,13 @@ impl MasonryState<'_> {
};
accesskit_adapter.update_if_active(|| tree_update);
}
WinitWindowEvent::CloseRequested => event_loop.exit(),
WinitWindowEvent::CloseRequested => {
// HACK: When we exit, on some systems (known to happen with Wayland on KDE),
// the IME state gets preserved until the app next opens. We work around this by force-deleting
// the IME state just before exiting.
window.set_ime_allowed(false);
event_loop.exit();
}
WinitWindowEvent::Resized(size) => {
self.render_root
.handle_window_event(WindowEvent::Resize(size));
Expand Down

0 comments on commit ce8387a

Please sign in to comment.