Generate mouse/keyboard events from your mouse.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

92 lines
2.8 KiB

#ifndef API_HPP
#define API_HPP
// ---------------------------------------------------------------------
// IMPORTANT! The definitions here must be kept in sync with their C# equivalents in AppConfig.cs.
// --- SETTINGS: application settings ---
struct ApiAppConfig
{
} ;
// --- DEVICE: device attributes ---
struct ApiDevice
{
int mDeviceId ;
const wchar_t* mpHID ;
int mDeviceNumber ;
const wchar_t* mpDisplayName ;
bool mIsEnabled ;
} ;
// --- DEVICE CONFIG: device configuration ---
// A DeviceConfig is associated with a single Device. We have 2 struct's to keep separate the configuration
// of the device itself, and how the user wants it to behave. A device can be configured to respond differently
// depending on which application is active, with each one managed by an AppProfile object.
struct ApiDeviceConfig
{
int mDeviceId ;
int mStrokeHistoryResetInterval ;
int mAppProfileStartIndex ;
int mAppProfileCount ;
} ;
// --- APP PROFILE: device configuration for an application ---
// This holds the configuration for how the user wants a device to behave, for a specific application e.g.
// Alt + mouseLeft => scrollLeft
struct ApiAppProfile
{
const wchar_t* mpApp ;
int mSensitivityX ;
int mSensitivityY ;
bool mFallbackToDefaultAppProfile ;
int mEventStartIndex ;
int mEventCount ;
} ;
// --- API EVENT: device event ---
// Represents an event that can be generated by a device e.g. mouse was moved left, button 3 was pressed.
// It also holds a list of Action's to be executed when the event happens.
struct ApiEvent
{
int mEventType ;
int mKeyModifiers ;
int mActionStartIndex ;
int mActionCount ;
} ;
// --- API ACTION: action to perform in response to a device event ---
struct ApiAction
{
int mActionType ;
int mActionParam ;
int mKeyModifiers ;
} ;
// ---------------------------------------------------------------------
// IMPORTANT! The definitions here must be kept in sync with their C# equivalents in MouseDll.cs.
typedef int (__stdcall *PCALLBACKFN)( int callbackType , const char* pCallbackMsg ) ;
#define CBTYPE_STARTED 1
#define CBTYPE_STOPPED 2
#define CBTYPE_FATAL_ERROR 3
#define CBTYPE_NEW_DEVICE 10
extern void openApi( PCALLBACKFN pCallbackFn , const wchar_t* pDebugConfigFilename ) ;
extern void closeApi() ;
extern void reloadConfig(
const ApiAppConfig* pAppConfig ,
const ApiDevice* pDevices , int nDevices ,
const ApiDeviceConfig* pDeviceConfigs , int nDeviceConfigs ,
const ApiAppProfile* pAppProfiles , int nAppProfiles ,
const ApiEvent* pEvents , int nEvents ,
const ApiAction* pActions , int nActions
) ;
extern void runMainLoop( int* pExitFlag ) ;
// ---------------------------------------------------------------------
#endif // API_HPP