stmm-input-doc  0.17.0
Public Member Functions | Static Public Member Functions | List of all members
stmi::GdkKeyConverter Class Referenceabstract

Gdk key event (keycode) to hardware key conversion class. More...

Inheritance diagram for stmi::GdkKeyConverter:
Inheritance graph
[legend]

Public Member Functions

virtual ~GdkKeyConverter () noexcept=default
 
virtual bool convertKeyCodeToHardwareKey (guint16 nGdkKeycode, HARDWARE_KEY &eHardwareKey) const noexcept=0
 Converts a Gdk keycode to a hardware key. More...
 
virtual bool convertEventKeyToHardwareKey (GdkEventKey const *p0GdkEvent, HARDWARE_KEY &eHardwareKey) const noexcept=0
 Converts a GdkEventKey to a hardware key. More...
 

Static Public Member Functions

static const shared_ptr< GdkKeyConverter > & getConverter () noexcept
 Get the key converter instance (creating the default if not set). More...
 
static bool isConverterSet () noexcept
 Whether the singleton converter was already set. More...
 
static bool setConverter (const shared_ptr< GdkKeyConverter > &refConverter) noexcept
 Set the key converter instance. More...
 

Detailed Description

Gdk key event (keycode) to hardware key conversion class.

Constructor & Destructor Documentation

◆ ~GdkKeyConverter()

virtual stmi::GdkKeyConverter::~GdkKeyConverter ( )
virtualdefaultnoexcept

Member Function Documentation

◆ convertEventKeyToHardwareKey()

virtual bool stmi::GdkKeyConverter::convertEventKeyToHardwareKey ( GdkEventKey const *  p0GdkEvent,
HARDWARE_KEY eHardwareKey 
) const
pure virtualnoexcept

Converts a GdkEventKey to a hardware key.

If the keycode isn't enough to determine the hardware key, the whole key event (if available) can be used.

Parameters
p0GdkEventThe event to convert. Cannot be null.
eHardwareKeyThe resulting hardware key.
Returns
Whether the conversion was successful.

Implemented in stmi::GdkKeyConverterEvDev.

◆ convertKeyCodeToHardwareKey()

virtual bool stmi::GdkKeyConverter::convertKeyCodeToHardwareKey ( guint16  nGdkKeycode,
HARDWARE_KEY eHardwareKey 
) const
pure virtualnoexcept

Converts a Gdk keycode to a hardware key.

Parameters
nGdkKeycodeThe Gdk keycode.
eHardwareKeyThe resulting hardware key.
Returns
Whether the conversion was successful.

Implemented in stmi::GdkKeyConverterEvDev.

◆ getConverter()

static const shared_ptr<GdkKeyConverter>& stmi::GdkKeyConverter::getConverter ( )
staticnoexcept

Get the key converter instance (creating the default if not set).

If the converter was not set with setConverter() the default one is created.

This global singleton converter can be used as an implicit parameter to device managers that are loaded as plugins by PluginsDeviceManager (libstmm-input-dl).

After this function is called, the global singleton converter can no longer be changed.

Returns
The converter. Cannot be null.

◆ isConverterSet()

static bool stmi::GdkKeyConverter::isConverterSet ( )
staticnoexcept

Whether the singleton converter was already set.

Returns
Whether the converter was yet set.

◆ setConverter()

static bool stmi::GdkKeyConverter::setConverter ( const shared_ptr< GdkKeyConverter > &  refConverter)
staticnoexcept

Set the key converter instance.

If the converter was already set by calling getConverter() or this very function, the setting fails and false is returned. This means that this function should be called very early in your program before getConverter() has a chance to be called (that is the plugins get loaded).

Parameters
refConverterCannot be null.
Returns
Whether the converter was set.