mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[FancyZones] Secondary mouse buttons click to toggle zones activation (#3989)
* Changed option name in settings, changed behaviour of zones activation by mouse to switch * Removed IsDragEnabled from ZoneWindow
This commit is contained in:
committed by
GitHub
parent
e6408a0c37
commit
8410d7b08e
@@ -17,6 +17,7 @@
|
||||
#include "MonitorWorkAreaHandler.h"
|
||||
|
||||
#include <interface/win_hook_event_data.h>
|
||||
#include <lib/SecondaryMouseButtonsHook.h>
|
||||
|
||||
enum class DisplayChangeType
|
||||
{
|
||||
@@ -32,7 +33,8 @@ public:
|
||||
FancyZones(HINSTANCE hinstance, const winrt::com_ptr<IFancyZonesSettings>& settings) noexcept :
|
||||
m_hinstance(hinstance),
|
||||
m_settings(settings),
|
||||
m_windowMoveHandler(settings)
|
||||
m_mouseHook(std::bind(&FancyZones::OnMouseDown, this)),
|
||||
m_windowMoveHandler(settings, &m_mouseHook)
|
||||
{
|
||||
m_settings->SetCallback(this);
|
||||
}
|
||||
@@ -43,6 +45,14 @@ public:
|
||||
IFACEMETHODIMP_(void)
|
||||
Destroy() noexcept;
|
||||
|
||||
void OnMouseDown() noexcept
|
||||
{
|
||||
std::unique_lock writeLock(m_lock);
|
||||
m_windowMoveHandler.OnMouseDown();
|
||||
|
||||
PostMessageW(m_window, WM_PRIV_LOCATIONCHANGE, NULL, NULL);
|
||||
}
|
||||
|
||||
void MoveSizeStart(HWND window, HMONITOR monitor, POINT const& ptScreen) noexcept
|
||||
{
|
||||
std::unique_lock writeLock(m_lock);
|
||||
@@ -60,6 +70,7 @@ public:
|
||||
std::unique_lock writeLock(m_lock);
|
||||
m_windowMoveHandler.MoveSizeEnd(window, ptScreen, m_workAreaHandler.GetWorkAreasByDesktopId(m_currentDesktopId));
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
HandleWinHookEvent(const WinHookEvent* data) noexcept
|
||||
{
|
||||
@@ -213,6 +224,7 @@ private:
|
||||
HWND m_window{};
|
||||
WindowMoveHandler m_windowMoveHandler;
|
||||
MonitorWorkAreaHandler m_workAreaHandler;
|
||||
SecondaryMouseButtonsHook m_mouseHook;
|
||||
|
||||
winrt::com_ptr<IFancyZonesSettings> m_settings{};
|
||||
GUID m_previousDesktopId{}; // UUID of previously active virtual desktop.
|
||||
|
||||
Reference in New Issue
Block a user