Class SimulatedSecondaryClick

Class Documentation

class SimulatedSecondaryClick

Enables configuring simulated secondary click at runtime.

Simulated secondary click is an accessibility method that allows users to simulate secondary clicks by holding the left mouse button. The pointer is allowed to move slightly during the hold to accomodate users with disabilities.

Remark

Since MirAL 5.5

Public Functions

explicit SimulatedSecondaryClick(live_config::Store &config_store)

Construct a SimulatedSecondaryClick instance with access to a live config store.

Available options:

  • {simulated_secondary_click, enable}: Enable or disable simulated secondary click.

  • {simulated_secondary_click, displacement_threshold}: How much pointer displacement in pixels is allowed before a simulated secondary click is cancelled

  • {simulated_secondary_click, delay}: The delay in milliseconds between the cursor starting a simulated secondary click and the click being dispatched.

void operator()(mir::Server &server)
SimulatedSecondaryClick &enable()

Enables simulated secondary click. When already enabled, further calls have no effect.

SimulatedSecondaryClick &disable()

Disables simulated secondary click. When already disabled, further calls have no effect.

SimulatedSecondaryClick &hold_duration(std::chrono::milliseconds hold_duration)

Configures the duration users have to keep the left mouse button down to dispatch a secondary click.

Note

The default hold duration is 1000 milliseconds.

SimulatedSecondaryClick &displacement_threshold(float displacement)

Configures the maximum displacement the mouse pointer can move before the simulated secondary click is cancelled.

Note

The default displacement threshold is 20 pixels.

SimulatedSecondaryClick &on_hold_start(std::function<void()> &&on_hold_start)

Configures the callback to invoke when the user clicks down the left mouse button. Can be used to initialize animations for graphical feedback.

SimulatedSecondaryClick &on_hold_cancel(std::function<void()> &&on_hold_cancel)

Configures the callback to invoke when the user cancels a simulated secondary click either by letting go of the left button before the hold duration is up or moving the cursor. Can be used to indicate to the user that the action was cancelled.

SimulatedSecondaryClick &on_secondary_click(std::function<void()> &&on_secondary_click)

Configures the callback to invoke after the user successfully dispatches a simulated secondary click. Can be used to indicate to the user that their simulated click was successful.

Public Static Functions

static auto enabled() -> SimulatedSecondaryClick

Creates a SimulatedSecondaryClick instance that’s enabled by default.

static auto disabled() -> SimulatedSecondaryClick

Creates a SimulatedSecondaryClick instance that’s disabled by default.