Skip to content

Commit 6948b84

Browse files
committed
fix(input): cull capture *attempts* instead of captures
1 parent 18bbc78 commit 6948b84

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/core/client_state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl ClientStateParsed {
6969
let app_name = self
7070
.launch_info
7171
.as_ref()
72-
.map(|l| l.cmdline.first().unwrap().split('/').last().unwrap())
72+
.map(|l| l.cmdline.first().unwrap().split('/').next_back().unwrap())
7373
.unwrap_or("unknown");
7474
let state_file_path = directory
7575
.join(format!("{app_name}-{}", nanoid::nanoid!()))

src/nodes/input/method.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,31 @@ impl InputMethod {
152152
captured: self.captures.get_valid_contents().contains(handler),
153153
}
154154
}
155-
156155
pub(super) fn cull_capture_attempts(&self) {
157156
let sent = self
158157
.handler_order
159158
.lock()
160159
.iter()
161160
.filter_map(Weak::upgrade)
162161
.collect::<Registry<InputHandler>>();
163-
self.captures.retain(|handler| {
164-
!handler
162+
self.capture_attempts.retain(|handler| {
163+
let unresponsive = handler
165164
.spatial
166165
.node()
167166
.and_then(|n| n.get_client())
168167
.map(|c| c.unresponsive())
169-
.unwrap_or(false)
170-
&& sent.contains(handler)
168+
.unwrap_or(false);
169+
170+
let in_sent = sent.contains(handler);
171+
172+
if unresponsive {
173+
println!("Culling capture attempt from unresponsive handler");
174+
}
175+
if !in_sent {
176+
println!("Culling capture attempt from handler not in sent list");
177+
}
178+
179+
!unresponsive && in_sent
171180
});
172181
}
173182
}

src/objects/input/mouse_pointer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl MousePointer {
150150
let first_distance = handlers
151151
.first()
152152
.map(|(_, distance)| *distance)
153-
.unwrap_or(std::f32::NEG_INFINITY);
153+
.unwrap_or(f32::NEG_INFINITY);
154154

155155
self.pointer.set_handler_order(
156156
handlers

0 commit comments

Comments
 (0)