diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-09 17:55:36 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-10 14:50:51 +0400 |
| commit | 9a5f8910021a7c3f0a54d907044be8ad0d47a199 (patch) | |
| tree | 6462aa69d9a12eae9e5d64cf59002e7ab50acd23 /src | |
| parent | 1035f3e6cd4e9c530451f29d1903f43530b85df0 (diff) | |
| download | niri-9a5f8910021a7c3f0a54d907044be8ad0d47a199.tar.gz niri-9a5f8910021a7c3f0a54d907044be8ad0d47a199.tar.bz2 niri-9a5f8910021a7c3f0a54d907044be8ad0d47a199.zip | |
input: Fix crash on scrolling
Diffstat (limited to 'src')
| -rw-r--r-- | src/input.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/input.rs b/src/input.rs index c10f3e15..011378db 100644 --- a/src/input.rs +++ b/src/input.rs @@ -160,13 +160,12 @@ impl Niri { InputEvent::PointerAxis { event, .. } => { let source = event.source(); - // FIXME: this crashes on keyboard scroll. - let horizontal_amount = event - .amount(Axis::Horizontal) - .unwrap_or_else(|| event.amount_discrete(Axis::Horizontal).unwrap() * 3.0); + let horizontal_amount = event.amount(Axis::Horizontal).unwrap_or_else(|| { + event.amount_discrete(Axis::Horizontal).unwrap_or(0.0) * 3.0 + }); let vertical_amount = event .amount(Axis::Vertical) - .unwrap_or_else(|| event.amount_discrete(Axis::Vertical).unwrap() * 3.0); + .unwrap_or_else(|| event.amount_discrete(Axis::Vertical).unwrap_or(0.0) * 3.0); let horizontal_amount_discrete = event.amount_discrete(Axis::Horizontal); let vertical_amount_discrete = event.amount_discrete(Axis::Vertical); |
