-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux: Fixed scrolling with mouse wheel sometimes scrolling far more …
…than intended
- Loading branch information
Showing
8 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Avalonia.Input; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mesen.Utilities; | ||
|
||
static class PointerWheelEventArgsExtensions | ||
{ | ||
public static double GetDeltaY(this PointerWheelEventArgs e) | ||
{ | ||
if(OperatingSystem.IsWindows() || OperatingSystem.IsMacOS()) { | ||
return e.Delta.Y; | ||
} | ||
|
||
if(Math.Abs(e.Delta.Y) > 8) { | ||
//Avalonia currently seems to have an issue with mouse wheel events on Linux | ||
//Alt-tabbing to another application, scrolling, alt-tabbing back, and then | ||
//trying to scroll will return a large delta value that includes the amount | ||
//of scrolling done in the other application. In this case, return 0. | ||
return 0; | ||
} | ||
return e.Delta.Y; | ||
} | ||
} |