mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
Some typical scenarios can cause KeyUp only on regular keys, which can be annoying (e.g pressing Esc to exit a configuration dialog ends up toggling pause)
28 lines
610 B
C#
28 lines
610 B
C#
using Avalonia.Input;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mesen.Utilities
|
|
{
|
|
public static class KeyExtensions
|
|
{
|
|
public static bool IsSpecialKey(this Key key)
|
|
{
|
|
//Some keys only trigger a KeyUp event without a matching KeyDown event
|
|
//And some trigger both events at the same time, causing the emulator to never see the key press.
|
|
switch(key) {
|
|
case Key.PrintScreen:
|
|
case Key.Pause:
|
|
case Key.Scroll:
|
|
return true;
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|