Class Magnifier

Class Documentation

class Magnifier

Renders a magnified region of the scene. By default, the magnifier captures a 300x300 region centred on the cursor and displays it at 1.5x, producing a 450x450 visual area. Changing the magnification preserves the visual area and adjusts the captured region.

In the freely positioned mode, the magnifier is initially centred on the primary output. The magnifier does not follow the cursor. A handle is displayed in the bottom-right corner that allows the user to drag the magnifier around the screen. To change the size of the magnifier, a handle is displayed in the top-left corner. Two buttons are available at the right edge of the magnifier for zooming in and out. All controls are compatible with pointer and touch input.

Remark

Since MirAL 5.5

Public Types

enum class Behavior

Describes how the magnifier is positioned.

Remark

Since MirAL 6.0

Values:

enumerator follow_cursor
enumerator freely_positioned

Public Functions

Magnifier()
explicit Magnifier(live_config::Store &config_store)

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

Available options:

  • {magnifier, enable}: Whether the magnifier is enabled.

  • {magnifier, magnification}: The magnification scale.

  • {magnifier, capture_size, width}: The width of the rectangular region that will be magnified.

  • {magnifier, capture_size, height}: The height of the rectangular region that will be magnified.

  • {magnifier, behavior}: How the magnifier is positioned, either “follow_cursor” or “freely_positioned”.

Magnifier &enable(bool enabled)
Magnifier &magnification(float magnification)
Magnifier &capture_size(mir::geometry::Size const &size)

Sets the size of the captured region. If either dimension is zero or less, the magnifier keeps its current capture size.

Magnifier &set_behavior(Behavior behavior)

Sets how the magnifier is positioned.

When freely positioned, the magnifier can be dragged with the pointer or a single touch contact.

Remark

Since MirAL 6.0

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