Files
PowerToys/src/modules/fancyzones/FancyZonesLib/DraggingState.h
Seraphima Zykova 6333e3157e [FancyZones]Use RawInput to detect Shift key, fix locking out Shift key (#32116)
* init RawInputDevice

* static

* handle input

* replace keyboard hooks (ctrl, shift)

* keep ctrl hook

* spellcheck
2024-03-28 16:53:17 +00:00

36 lines
848 B
C++

#pragma once
#include <FancyZonesLib/KeyState.h>
#include <FancyZonesLib/MouseButtonsHook.h>
class DraggingState
{
public:
DraggingState(const std::function<void()>& keyUpdateCallback);
~DraggingState() = default;
void Enable();
void Disable();
void UpdateDraggingState() noexcept;
bool IsDragging() const noexcept;
bool IsSelectManyZonesState() const noexcept;
void SetShiftState(bool value) noexcept;
private:
void OnSecondaryMouseDown();
void OnMiddleMouseDown();
std::atomic<bool> m_secondaryMouseState;
std::atomic<bool> m_middleMouseState;
MouseButtonsHook m_mouseHook;
KeyState<VK_LCONTROL, VK_RCONTROL> m_ctrlKeyState;
bool m_shift{};
std::function<void()> m_keyUpdateCallback;
bool m_dragging{}; // True if we should be showing zone hints while dragging
};