Class HoverClick

Class Documentation

class HoverClick

Enables configuring hover click at runtime.

Hover click is an accessibility feature that allows users to dispatch primary clicks by holding the pointer still for some configurable period of time. The pointer may move by a configurable distance to accommodate users with disabilities. After a hover click, no further clicks are dispatched until the cursor moves by a configurable distance from the position of the previous click.

Remark

Since MirAL 5.5

Public Functions

explicit HoverClick(live_config::Store &config_store)

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

Available options:

  • {hover_click, enable}: Enable or disable hover click.

  • {hover_click, hover_duration}: How long in milliseconds the pointer has to stay still to dispatch a left click.

  • {hover_click, cancel_displacement}: The distance in pixels the pointer has to move from the initial hover click position to cancel it.

  • {hover_click, reclick_displacement}: the distance in pixels the pointer has to move from the the last hover click or hover click cancel position to initiate a new hover click

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

Enables hover click.

When already enabled, further calls have no effect.

HoverClick &disable()

Disables hover click.

When already disabled, further calls have no effect.

HoverClick &hover_duration(std::chrono::milliseconds hover_duration)

Configures how long the pointer has to stay still to dispatch a left click.

Note

The default hover duration is 1000 milliseconds.

HoverClick &cancel_displacement_threshold(int displacement)
HoverClick &reclick_displacement_threshold(int displacement)
HoverClick &on_hover_start(std::function<void()>&&)

Called shortly after a hover click is scheduled. Should be used to indicate to the user that a hover click has begun.

HoverClick &on_hover_cancel(std::function<void()>&&)
HoverClick &on_click_dispatched(std::function<void()>&&)

Public Static Functions

static auto enabled() -> HoverClick

Creates a HoverClick instance that’s enabled by default.

static auto disabled() -> HoverClick

Creates a HoverClick instance that’s disabled by default.