Repository: microsoft/terminal
File: src/cascadia/TerminalControl/ControlInteractivity.cpp (C++)

Code before:
using namespace winrt::Windows::ApplicationModel::DataTransfer;

static constexpr unsigned int MAX_CLICK_COUNT = 3;

namespace winrt::Microsoft::Terminal::Control::implementation
{
    std::atomic<uint64_t> ControlInteractivity::_nextId{ 1 };

    static constexpr TerminalInput::MouseButtonState toInternalMouseState(const Control::MouseButtonState& state)
    {
        return TerminalInput::MouseButtonState{
            WI_IsFlagSet(state, MouseButtonState::IsLeftButtonDown),
            WI_IsFlagSet(state, MouseButtonState::IsMiddleButtonDown),
            WI_IsFlagSet(state, MouseButtonState::IsRightButtonDown)
        };
    }

    ControlInteractivity::ControlInteractivity(IControlSettings settings,
                                               Control::IControlAppearance unfocusedAppearance,
                                               TerminalConnection::ITerminalConnection connection) :
        _touchAnchor{ std::nullopt },
        _lastMouseClickTimestamp{},
        _lastMouseClickPos{},
        _selectionNeedsToBeCopied{ false }
    {
        _id = ControlInteractivity::_nextId++;

        _core = winrt::make_self<ControlCore>(settings, unfocusedAppearance, connection);
    }

    uint64_t ControlInteractivity::Id()
    {
        return _id;
    }

    // Method Description:
    // - Updates our internal settings. These settings should be
    //   interactivity-specific. Right now, we primarily update _rowsToScroll
    //   with the current value of SPI_GETWHEELSCROLLLINES.
    // Arguments:
    // - <none>
    // Return Value:
    // - <none>
    void ControlInteractivity::UpdateSettings()
    {
        _updateSystemParameterSettings();
    }

    void ControlInteractivity::Initialize()
    {
        _updateSystemParameterSettings();

Review comment (suggestion):
nit: I think the existence of the operators on atomic structs is a bit of a mistake because they hide both the underlying behavior (load-modify vs. modify-load) and the memory model (relaxed, acquire, release, sequentially consistent). I would suggest using this:
```cpp
_id = _nextId.fetch_add(1, std::memory_order_relaxed);
```

Code after:
using namespace winrt::Windows::ApplicationModel::DataTransfer;

static constexpr unsigned int MAX_CLICK_COUNT = 3;

namespace winrt::Microsoft::Terminal::Control::implementation
{
    std::atomic<uint64_t> ControlInteractivity::_nextId{ 1 };

    static constexpr TerminalInput::MouseButtonState toInternalMouseState(const Control::MouseButtonState& state)
    {
        return TerminalInput::MouseButtonState{
            WI_IsFlagSet(state, MouseButtonState::IsLeftButtonDown),
            WI_IsFlagSet(state, MouseButtonState::IsMiddleButtonDown),
            WI_IsFlagSet(state, MouseButtonState::IsRightButtonDown)
        };
    }

    ControlInteractivity::ControlInteractivity(IControlSettings settings,
                                               Control::IControlAppearance unfocusedAppearance,
                                               TerminalConnection::ITerminalConnection connection) :
        _touchAnchor{ std::nullopt },
        _lastMouseClickTimestamp{},
        _lastMouseClickPos{},
        _selectionNeedsToBeCopied{ false }
    {
        _id = _nextId.fetch_add(1, std::memory_order_relaxed);

        _core = winrt::make_self<ControlCore>(settings, unfocusedAppearance, connection);
    }

    uint64_t ControlInteractivity::Id()
    {
        return _id;
    }

    // Method Description:
    // - Updates our internal settings. These settings should be
    //   interactivity-specific. Right now, we primarily update _rowsToScroll
    //   with the current value of SPI_GETWHEELSCROLLLINES.
    // Arguments:
    // - <none>
    // Return Value:
    // - <none>
    void ControlInteractivity::UpdateSettings()
    {
        _updateSystemParameterSettings();
    }

    void ControlInteractivity::Initialize()
    {
        _updateSystemParameterSettings();