-
Notifications
You must be signed in to change notification settings - Fork 2k
touchscreen click events are not detected properly (on Linux) #4895
Description
Describe the bug
With any widget, such as a Button or Label, .clicked() events are not recognized when the screen is tapped once. Instead, a single tap triggers long_touched() after a delay. Tapping twice in a quick succession generates a clicked() followed by a long_touched().
To Reproduce
Cargo.toml:
[package]
name = "repro"
version = "0.1.0"
edition = "2021"
[dependencies]
egui = { git = "https://github.com/emilk/egui", branch = "master" }
eframe = { git = "https://github.com/emilk/egui", branch = "master" }
src/main.rs:
#[derive(Default)]
struct App {
log: String,
}
impl eframe::App for App {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
let button = ui.button("click me");
if button.clicked() {
self.log.push_str("clicked()\n");
}
if button.long_touched() {
self.log.push_str("long_touched()\n");
}
ui.label(&self.log);
});
}
}
fn main() {
eframe::run_native(
"test",
eframe::NativeOptions::default(),
Box::new(|_cc| Ok(Box::new(App::default()))),
)
.unwrap();
}
Steps to reproduce the behavior:
cargo runthe above code- tap on "click me" button
Expected behavior
clicked() gets shown on the screen.
This can also be reproduced by egui_demo_app, built from latest master (d856f7b), by opening "Input Test" and tapping on "Sense::click" label:
Desktop:
- OS: Ubuntu 24.04
- Device: Lenovo Yoga 7 2-in-1 14IML9
- Wayland
(I tested on Windows, on a slightly different touchscreen-equipped Lenovo laptop, and it works correctly there.)
Additional context
This might be related to the observations found in #4668 ?
I bisected the behavior using egui_demo_app: last working commit is 8503a85, and it breaks at 8e5959d.

