stmm-input-doc  0.17.0
Public Types | Static Public Member Functions | List of all members
stmi::KeyRepeat Class Reference

Key repeat translation type. More...

Public Types

enum  MODE { MODE_NOT_SET = 0, MODE_SUPPRESS = 1, MODE_ADD_RELEASE = 2, MODE_ADD_RELEASE_CANCEL = 3 }
 

Static Public Member Functions

static MODE getMode () noexcept
 Get the global key repeat mode (or the default if not set). More...
 
static bool isModeSet () noexcept
 Whether global key repeat mode was already set. More...
 
static bool setMode (MODE eKeyRepeatMode) noexcept
 Set the global key repeat mode (creating the default if not set). More...
 

Detailed Description

Key repeat translation type.

Key presses unanswered by a release are not allowed.

For example the gdk event sequence for a specific key

Press  Press  Press  Release

is translated in either

Press Release  Press Release  Press Release  (add release mode)

or

Press Cancel   Press Cancel   Press Release  (add release cancel mode)

or

Press                               Release  (suppress mode)

Member Enumeration Documentation

◆ MODE

Enumerator
MODE_NOT_SET 

Mode not set, can be used to require the default to be used.

MODE_SUPPRESS 

Suppress repeated key presses.

MODE_ADD_RELEASE 

Send a release to listeners prior a repeated key press.

MODE_ADD_RELEASE_CANCEL 

Send a release cancel to listeners prior a repeated key press.

Member Function Documentation

◆ getMode()

static MODE stmi::KeyRepeat::getMode ( )
staticnoexcept

Get the global key repeat mode (or the default if not set).

If the mode was not set with setMode() the default is set and returned.

This global key repeat mode 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 key repeat mode can no longer be changed.

The default key repeat mode is MODE_SUPPRESS.

Returns
The converter. Cannot be null.

◆ isModeSet()

static bool stmi::KeyRepeat::isModeSet ( )
staticnoexcept

Whether global key repeat mode was already set.

Returns
Whether the mode was yet set.

◆ setMode()

static bool stmi::KeyRepeat::setMode ( MODE  eKeyRepeatMode)
staticnoexcept

Set the global key repeat mode (creating the default if not set).

If the mode was already set by calling getMode() 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 getMode() has a chance to be called (that is the plugins get loaded).

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