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.

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.

SimulatedSecondaryClick &displacement_threshold(float displacement)

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

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.