Libmacro  0.2
Libmacro is an extensible macro and hotkey library.
p_device.h File Reference

Currently Linux-specific. mcr_Device is a wrapper for creating uinput devices. More...

#include "mcr/base/base.h"
#include "mcr/util/linux/p_util.h"

Go to the source code of this file.

Classes

struct  mcr_EvbitRange_t
 
struct  mcr_Device
 

Functions

MCR_API int mcr_Device_set_uinput_path (struct mcr_context *ctx, const char *path)
 
MCR_API int mcr_Device_set_event_path (struct mcr_context *ctx, const char *directoryPath)
 
MCR_API int mcr_Device_set_absolute_resolution (struct mcr_context *ctx, __s32 resolution)
 
MCR_API void mcr_Device_ctor (struct mcr_Device *devPt, struct mcr_context *ctx, const char *name, const int *setEvents, size_t setEventCount, const mcr_EvbitRange_t *eventBits, size_t eventBitCount)
 
MCR_API void mcr_Device_deinit (struct mcr_Device *devPt)
 
MCR_API int mcr_Device_enable (struct mcr_Device *devPt, bool enable)
 
MCR_API int mcr_Device_enable_all (struct mcr_context *ctx, bool enable)
 
MCR_API void mcr_Device_set_uibit (struct mcr_Device *devPt, int *uiEvents, size_t count)
 
MCR_API void mcr_Device_set_evbits (struct mcr_Device *devPt, mcr_EvbitRange_t *evBits, size_t count)
 
MCR_API mcr_EvbitRange_tmcr_Device_bits (struct mcr_Device *devPt, int setUiBit)
 
MCR_API bool mcr_Device_has_evbit (struct mcr_Device *devPt)
 
MCR_API int mcr_Device_initialize (struct mcr_context *context)
 
MCR_API int mcr_Device_deinitialize (struct mcr_context *context)
 

Variables

MCR_API const struct input_event mcr_syncer
 

Detailed Description

Currently Linux-specific. mcr_Device is a wrapper for creating uinput devices.

The source file contains predefined devices for keyboard, absolute, and relative.

Definition in file p_device.h.

Function Documentation

§ mcr_Device_bits()

MCR_API mcr_EvbitRange_t* mcr_Device_bits ( struct mcr_Device devPt,
int  setUiBit 
)

Get all input bits to be set.

Parameters
bitTypeType of event to find values for
Returns
The set of all input bits to be set, or null if not found.

§ mcr_Device_ctor()

MCR_API void mcr_Device_ctor ( struct mcr_Device devPt,
struct mcr_context ctx,
const char *  name,
const int *  setEvents,
size_t  setEventCount,
const mcr_EvbitRange_t eventBits,
size_t  eventBitCount 
)

ctor

Parameters
devPtopt
Returns
reterr

§ mcr_Device_deinit()

MCR_API void mcr_Device_deinit ( struct mcr_Device devPt)

dtor

Parameters
devPtopt
Returns
reterr

§ mcr_Device_deinitialize()

MCR_API int mcr_Device_deinitialize ( struct mcr_context context)

Dealocate resources for linux devices.

§ mcr_Device_enable()

MCR_API int mcr_Device_enable ( struct mcr_Device devPt,
bool  enable 
)

Start or end user device. This will modify fd, event_fd, and enabled state.

Returns
reterr

§ mcr_Device_enable_all()

MCR_API int mcr_Device_enable_all ( struct mcr_context ctx,
bool  enable 
)

mcr_Device_enable for all devices

Returns
reterr

§ mcr_Device_has_evbit()

MCR_API bool mcr_Device_has_evbit ( struct mcr_Device devPt)

Does the device have UI_SET_EVBIT?

§ mcr_Device_initialize()

MCR_API int mcr_Device_initialize ( struct mcr_context context)

Initialize values for known mcr_Device objects, and allocate resources.

§ mcr_Device_set_absolute_resolution()

MCR_API int mcr_Device_set_absolute_resolution ( struct mcr_context ctx,
__s32  resolution 
)

Linux - Set absolute device resolution

Returns
reterr

§ mcr_Device_set_evbits()

MCR_API void mcr_Device_set_evbits ( struct mcr_Device devPt,
mcr_EvbitRange_t evBits,
size_t  count 
)

Set input bit values for a single bit type.

Parameters
bitTypeType of event to set values for
bitsSet of all values to set for bitType
bitLenLength of bits
Returns
reterr

§ mcr_Device_set_event_path()

MCR_API int mcr_Device_set_event_path ( struct mcr_context ctx,
const char *  directoryPath 
)

Linux - Set the directory event files are located in

Event files are used to read device state

Returns
reterr

§ mcr_Device_set_uinput_path()

MCR_API int mcr_Device_set_uinput_path ( struct mcr_context ctx,
const char *  path 
)

Linux - Set the uinput file to read and write uinput devices

Returns
reterr

Variable Documentation

§ mcr_syncer

MCR_API const struct input_event mcr_syncer

Linux - Append similar input_event to the end of all sending of events.