2020-03-24 01:44:02 +08:00
# pragma once
2020-07-24 07:43:49 +08:00
# include "Shortcut.h"
2020-08-14 07:32:15 +08:00
class LayoutMap ;
2021-05-07 16:16:31 +08:00
namespace Helpers
2020-04-19 07:12:26 +08:00
{
2020-04-20 23:22:36 +08:00
// Type to distinguish between keys
enum class KeyType
{
Win ,
Ctrl ,
Alt ,
Shift ,
Action
} ;
2020-04-22 05:14:50 +08:00
2020-04-20 23:22:36 +08:00
// Function to check if the key is a modifier key
bool IsModifierKey ( DWORD key ) ;
2020-04-19 07:12:26 +08:00
2021-09-03 23:19:16 +08:00
// Function to get the combined key for modifier keys
DWORD GetCombinedKey ( DWORD key ) ;
2020-04-20 23:22:36 +08:00
// Function to get the type of the key
KeyType GetKeyType ( DWORD key ) ;
2020-04-19 07:12:26 +08:00
2020-05-29 05:47:32 +08:00
// Function to set the value of a key event based on the arguments
void SetKeyEvent ( LPINPUT keyEventArray , int index , DWORD inputType , WORD keyCode , DWORD flags , ULONG_PTR extraInfo ) ;
2020-10-09 02:28:37 +08:00
// Function to set the dummy key events used for remapping shortcuts, required to ensure releasing a modifier doesn't trigger another action (For example, Win->Start Menu or Alt->Menu bar)
void SetDummyKeyEvent ( LPINPUT keyEventArray , int & index , ULONG_PTR extraInfo ) ;
2020-07-07 07:45:53 +08:00
// Function to return window handle for a full screen UWP app
HWND GetFullscreenUWPWindowHandle ( ) ;
2020-05-29 05:47:32 +08:00
// Function to return the executable name of the application in focus
std : : wstring GetCurrentApplication ( bool keepPath ) ;
2020-07-24 07:43:49 +08:00
2020-10-31 02:41:37 +08:00
// Function to set key events for modifier keys: When shortcutToCompare is passed (non-empty shortcut), then the key event is sent only if both shortcut's don't have the same modifier key. When keyToBeReleased is passed (non-NULL), then the key event is sent if either the shortcuts don't have the same modifier or if the shortcutToBeSent's modifier matches the keyToBeReleased
2020-07-24 07:43:49 +08:00
void SetModifierKeyEvents ( const Shortcut & shortcutToBeSent , const ModifierKey & winKeyInvoked , LPINPUT keyEventArray , int & index , bool isKeyDown , ULONG_PTR extraInfoFlag , const Shortcut & shortcutToCompare = Shortcut ( ) , const DWORD & keyToBeReleased = NULL ) ;
// Function to filter the key codes for artificial key codes
2020-10-19 17:27:47 +08:00
int32_t FilterArtificialKeys ( const int32_t & key ) ;
2020-07-24 07:43:49 +08:00
// Function to sort a vector of shortcuts based on it's size
void SortShortcutVectorBasedOnSize ( std : : vector < Shortcut > & shortcutVector ) ;
2020-04-21 12:01:21 +08:00
}