overlays/eww: fix patch(?)

This commit is contained in:
LavaDesu 2022-10-05 12:00:04 +07:00
parent 2d9161522f
commit 8577e9180d
Signed by: cilly
GPG key ID: 6500251E087653C9

View file

@ -2,15 +2,6 @@ diff --git a/crates/eww/src/widgets/widget_definitions.rs b/crates/eww/src/widge
index 16f1f17d063..08d54cbe343 100644
--- a/crates/eww/src/widgets/widget_definitions.rs
+++ b/crates/eww/src/widgets/widget_definitions.rs
@@ -8,7 +8,7 @@ use crate::{
use anyhow::{anyhow, Context, Result};
use codespan_reporting::diagnostic::Severity;
use eww_shared_util::Spanned;
-use gdk::{ModifierType, NotifyType};
+use gdk::{ModifierType, NotifyType, ScrollDirection};
use glib::translate::FromGlib;
use gtk::{self, glib, prelude::*, DestDefaults, TargetEntry, TargetList};
@@ -679,11 +679,14 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result<gtk::EventBox> {
// @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) {
@ -22,8 +13,8 @@ index 16f1f17d063..08d54cbe343 100644
- run_command(timeout, &onscroll, &[if delta < 0f64 { "up" } else { "down" }]);
+ connect_single_handler!(gtk_widget, gtk_widget.connect_scroll_event(move |_, evt| {
+ let dir = match evt.direction() {
+ ScrollDirection::Left => "up",
+ ScrollDirection::Right => "down",
+ gdk::ScrollDirection::Left => "up",
+ gdk::ScrollDirection::Right => "down",
+ _ => "",
+ };
+ if dir != "" {