overlays/eww: patch out smooth scroll
This commit is contained in:
parent
9c6a64c708
commit
eec67e6c4d
2 changed files with 35 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
self: super: {
|
self: super: {
|
||||||
# Mainly for https://github.com/elkowar/eww/pull/280
|
# For https://github.com/elkowar/eww/pull/280
|
||||||
eww = super.eww.overrideAttrs (old: rec {
|
eww = super.eww.overrideAttrs (old: rec {
|
||||||
version = "unstable-fb0e57a";
|
version = "unstable-fb0e57a";
|
||||||
src = self.fetchFromGitHub {
|
src = self.fetchFromGitHub {
|
||||||
|
|
@ -8,6 +8,8 @@ self: super: {
|
||||||
rev = "fb0e57a0149904e76fb33807a2804d4af82350de";
|
rev = "fb0e57a0149904e76fb33807a2804d4af82350de";
|
||||||
sha256 = "089rvcswr0wy05fac8xbfrws1qacqi3iialpv8sai7mzlpsw21m0";
|
sha256 = "089rvcswr0wy05fac8xbfrws1qacqi3iialpv8sai7mzlpsw21m0";
|
||||||
};
|
};
|
||||||
|
# Use normal scroll events instead of smooth scroll ( due to https://bugzilla.gnome.org/show_bug.cgi?id=675959 )
|
||||||
|
patches = old.patches ++ [ ./patches/eww.patch ];
|
||||||
cargoSha256 = "1s7rxilqis2nbvjqjp5zarvmr9g6ndcicyx1rilgjv34qwna3mz1";
|
cargoSha256 = "1s7rxilqis2nbvjqjp5zarvmr9g6ndcicyx1rilgjv34qwna3mz1";
|
||||||
cargoDeps = self.rustPlatform.fetchCargoTarball {
|
cargoDeps = self.rustPlatform.fetchCargoTarball {
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
|
||||||
32
overlays/patches/eww.patch
Normal file
32
overlays/patches/eww.patch
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
diff --git a/crates/eww/src/widgets/widget_definitions.rs b/crates/eww/src/widgets/widget_definitions.rs
|
||||||
|
index ec307537407..49c70571d4b 100644
|
||||||
|
--- a/crates/eww/src/widgets/widget_definitions.rs
|
||||||
|
+++ b/crates/eww/src/widgets/widget_definitions.rs
|
||||||
|
@@ -6,7 +6,7 @@ use crate::{
|
||||||
|
use anyhow::*;
|
||||||
|
use codespan_reporting::diagnostic::Severity;
|
||||||
|
use eww_shared_util::Spanned;
|
||||||
|
-use gdk::NotifyType;
|
||||||
|
+use gdk::{NotifyType, ScrollDirection};
|
||||||
|
use gtk::{self, glib, prelude::*};
|
||||||
|
use itertools::Itertools;
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
@@ -523,11 +523,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) {
|
||||||
|
gtk_widget.add_events(gdk::EventMask::SCROLL_MASK);
|
||||||
|
- gtk_widget.add_events(gdk::EventMask::SMOOTH_SCROLL_MASK);
|
||||||
|
connect_single_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" });
|
||||||
|
+ let dir = match evt.direction() {
|
||||||
|
+ ScrollDirection::Up => "up",
|
||||||
|
+ ScrollDirection::Down => "down",
|
||||||
|
+ _ => "",
|
||||||
|
+ };
|
||||||
|
+ if dir != "" {
|
||||||
|
+ run_command(timeout, &onscroll, dir);
|
||||||
|
}
|
||||||
|
gtk::Inhibit(false)
|
||||||
|
}));
|
||||||
Loading…
Add table
Add a link
Reference in a new issue