diff --git a/crates/eww/src/widgets/widget_definitions.rs b/crates/eww/src/widgets/widget_definitions.rs index 16f1f17d063..08d54cbe343 100644 --- a/crates/eww/src/widgets/widget_definitions.rs +++ b/crates/eww/src/widgets/widget_definitions.rs @@ -679,11 +679,14 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result { // @prop onscroll - event to execute when the user scrolls with the mouse over the widget. The placeholder `{}` used in the command will be replaced with either `up` or `down`. prop(timeout: as_duration = Duration::from_millis(200), onscroll: as_string) { gtk_widget.add_events(gdk::EventMask::SCROLL_MASK); - gtk_widget.add_events(gdk::EventMask::SMOOTH_SCROLL_MASK); - connect_signal_handler!(gtk_widget, gtk_widget.connect_scroll_event(move |_, evt| { - let delta = evt.delta().1; - if delta != 0f64 { // Ignore the first event https://bugzilla.gnome.org/show_bug.cgi?id=675959 - run_command(timeout, &onscroll, &[if delta < 0f64 { "up" } else { "down" }]); + connect_signal_handler!(gtk_widget, gtk_widget.connect_scroll_event(move |_, evt| { + let dir = match evt.direction() { + gdk::ScrollDirection::Left => "up", + gdk::ScrollDirection::Right => "down", + _ => "", + }; + if dir != "" { + run_command(timeout, &onscroll, &[dir]); } gtk::Inhibit(false) }));