Skip to content

Commit 233cca5

Browse files
perf: skip trigger settle when input is isolated
1 parent 5744dd3 commit 233cca5

10 files changed

Lines changed: 39 additions & 12 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lay"
3-
version = "0.1.207"
3+
version = "0.1.208"
44
edition = "2021"
55
description = "Alpha Double Shift RU/EN layout rescue for Linux desktops"
66
license = "MIT"

VERSIONING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ number from `git rev-list`.
1313

1414
Current publication branch version:
1515

16-
- `0.1.207`
16+
- `0.1.208`
1717

1818
Do not rely on commit counts. Before publishing or pushing, run the bump script
1919
or verify the version fields manually.

extension/lay@radislabus-star.github.io/lay-impl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ const STATS_PATH = GLib.get_home_dir() + '/.local/share/lay/stats.json';
2222
const RECENT_ACTIONS_PATH = GLib.get_home_dir() + '/.local/share/lay/recent_actions.jsonl';
2323
const PROJECT_DIR = GLib.get_home_dir() + '/projects/lay';
2424
const UPDATE_LOG_PATH = GLib.get_home_dir() + '/.local/state/lay/update.log';
25-
const APP_VERSION = '0.1.207';
25+
const APP_VERSION = '0.1.208';
2626
const APP_DESCRIPTION = 'Alpha RU/EN layout helper: double Shift и помощь при наборе';
27-
const APP_RELEASE_DATE = '2026-06-03';
27+
const APP_RELEASE_DATE = '2026-06-04';
2828
const APP_LICENSE = 'MIT';
2929
const APP_URL = 'https://github.com/radislabus-star/lay-public';
3030
const APP_PLATFORM = 'Linux desktops: GNOME, KDE, Wayland, X11';

extension/lay@radislabus-star.github.io/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"uuid": "lay@radislabus-star.github.io",
33
"name": "Lay Layout Switcher",
4-
"version": 207,
5-
"version-name": "0.1.207",
4+
"version": 208,
5+
"version-name": "0.1.208",
66
"description": "Alpha GNOME Shell extension для lay-daemon. Показывает EN/RU в трее, переключает раскладку по клику. Минимальный DBus bridge для layout activation и fallback text insert.",
77
"shell-version": ["45", "46", "47", "50"],
88
"url": "https://github.com/radislabus-star/lay-public"

src/bin/lay_daemon.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ struct DeviceGrabGuard<'a> {
6464
active: bool,
6565
}
6666

67+
impl DeviceGrabGuard<'_> {
68+
fn is_active(&self) -> bool {
69+
self.active
70+
}
71+
}
72+
6773
impl Drop for DeviceGrabGuard<'_> {
6874
fn drop(&mut self) {
6975
if self.active {

src/bin/lay_daemon/correction_runtime.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ pub(super) fn run_manual_correction_with_scope(
6262
executing: &mut bool,
6363
events_since_word_start: u32,
6464
label: &str,
65+
input_isolated: bool,
6566
) -> Option<bool> {
6667
log_manual_trigger_cross_check(buf, events_since_word_start);
6768
let engine = active_correction_engine();
@@ -73,6 +74,7 @@ pub(super) fn run_manual_correction_with_scope(
7374
auto_replace,
7475
virtual_kbd,
7576
executing,
77+
input_isolated,
7678
);
7779
log(&format!("· {label} fired with scope={replace_words}"));
7880
result
@@ -85,6 +87,7 @@ pub(super) fn handle_double_shift(
8587
auto_replace: bool,
8688
virtual_kbd: Option<&mut VirtualDevice>,
8789
executing: &mut bool,
90+
input_isolated: bool,
8891
) -> Option<bool> {
8992
let started_at = Instant::now();
9093
if let Some(undo) = buf.take_pending_auto_undo() {
@@ -158,5 +161,6 @@ pub(super) fn handle_double_shift(
158161
started_at,
159162
decision: &correction_result,
160163
virtual_kbd,
164+
input_isolated,
161165
})
162166
}

src/bin/lay_daemon/correction_runtime/output.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub(super) fn apply_manual_correction_output(
3131
started_at,
3232
decision,
3333
virtual_kbd,
34+
input_isolated,
3435
} = ctx;
3536
let mut common = ManualOutputCommon {
3637
buf,
@@ -44,6 +45,7 @@ pub(super) fn apply_manual_correction_output(
4445
force_replay_toggle,
4546
started_at,
4647
decision,
48+
input_isolated,
4749
};
4850

4951
if let Some(result) = try_ime_replace_output(&mut common) {
@@ -60,9 +62,18 @@ pub(super) fn apply_manual_correction_output(
6062
return None;
6163
}
6264
};
63-
settle_after_physical_trigger_release();
64-
if let Err(e) = release_possible_modifiers(kbd) {
65-
log(&format!("⚠ modifier cleanup before backspace failed: {e}"));
65+
if common.input_isolated {
66+
log(" input isolated: skip trigger settle");
67+
if let Err(e) = super::super::release_possible_modifiers_fast(kbd) {
68+
log(&format!(
69+
"⚠ fast modifier cleanup before backspace failed: {e}"
70+
));
71+
}
72+
} else {
73+
settle_after_physical_trigger_release();
74+
if let Err(e) = release_possible_modifiers(kbd) {
75+
log(&format!("⚠ modifier cleanup before backspace failed: {e}"));
76+
}
6677
}
6778

6879
match try_manual_text_replacement(&mut common, kbd) {

src/bin/lay_daemon/correction_runtime/output/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub(crate) struct ManualCorrectionOutputContext<'a> {
1717
pub(crate) started_at: Instant,
1818
pub(crate) decision: &'a ManualCorrectionDecision,
1919
pub(crate) virtual_kbd: Option<&'a mut VirtualDevice>,
20+
pub(crate) input_isolated: bool,
2021
}
2122

2223
pub(crate) struct ManualOutputCommon<'a> {
@@ -31,6 +32,7 @@ pub(crate) struct ManualOutputCommon<'a> {
3132
pub(crate) force_replay_toggle: bool,
3233
pub(crate) started_at: Instant,
3334
pub(crate) decision: &'a ManualCorrectionDecision,
35+
pub(crate) input_isolated: bool,
3436
}
3537

3638
pub(crate) enum OutputFlow {

src/bin/lay_daemon/trigger_dispatch.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ pub(super) fn run_configured_manual_correction(
3333
virtual_kbd: &Arc<Mutex<Option<VirtualDevice>>>,
3434
executing: &mut bool,
3535
) -> Option<bool> {
36-
let _physical_grab = grab_physical_device_for_correction(device);
36+
let physical_grab = grab_physical_device_for_correction(device);
37+
let input_isolated = physical_grab.is_active();
3738
let mut g = lock_virtual_keyboard(virtual_kbd);
3839
handle_double_shift(
3940
buffer,
@@ -42,6 +43,7 @@ pub(super) fn run_configured_manual_correction(
4243
active_auto_replace(),
4344
g.as_mut(),
4445
executing,
46+
input_isolated,
4547
)
4648
}
4749

@@ -54,7 +56,8 @@ pub(super) fn run_scoped_manual_correction(
5456
events_since_word_start: u32,
5557
reason: &str,
5658
) -> Option<bool> {
57-
let _physical_grab = grab_physical_device_for_correction(device);
59+
let physical_grab = grab_physical_device_for_correction(device);
60+
let input_isolated = physical_grab.is_active();
5861
let mut g = lock_virtual_keyboard(virtual_kbd);
5962
run_manual_correction_with_scope(
6063
buffer,
@@ -63,6 +66,7 @@ pub(super) fn run_scoped_manual_correction(
6366
executing,
6467
events_since_word_start,
6568
reason,
69+
input_isolated,
6670
)
6771
}
6872

0 commit comments

Comments
 (0)