diff --git a/src/modules/fancyzones/lib/FancyZones.cpp b/src/modules/fancyzones/lib/FancyZones.cpp index dd5f467a4e..09fef91991 100644 --- a/src/modules/fancyzones/lib/FancyZones.cpp +++ b/src/modules/fancyzones/lib/FancyZones.cpp @@ -579,7 +579,32 @@ void FancyZones::MoveWindowsOnDisplayChange() noexcept void FancyZones::UpdateDragState(require_write_lock) noexcept { const bool shift = GetAsyncKeyState(VK_SHIFT) & 0x8000; - m_dragEnabled = m_settings->GetSettings().shiftDrag ? shift : !shift; + const bool mouseL = GetAsyncKeyState(VK_LBUTTON) & 0x8000; + const bool mouseR = GetAsyncKeyState(VK_RBUTTON) & 0x8000; + const bool mouseM = GetAsyncKeyState(VK_MBUTTON) & 0x8000; + const bool mouseX1 = GetAsyncKeyState(VK_XBUTTON1) & 0x8000; + const bool mouseX2 = GetAsyncKeyState(VK_XBUTTON2) & 0x8000; + + // Note, Middle, X1 and X2 can also be used in addition to R/L + bool mouse = mouseM | mouseX1 | mouseX2; + // If the user has swapped their Right and Left Buttons, use the "Right" equivalent + if (GetSystemMetrics(SM_SWAPBUTTON)) + { + mouse |= mouseL; + } + else + { + mouse |= mouseR; + } + + if (m_settings->GetSettings().shiftDrag) + { + m_dragEnabled = (shift | mouse); + } + else + { + m_dragEnabled = !(shift | mouse); + } } void FancyZones::CycleActiveZoneSet(DWORD vkCode) noexcept diff --git a/src/modules/fancyzones/lib/fancyzones.rc b/src/modules/fancyzones/lib/fancyzones.rc index 963aa95239..a006552a2c 100644 --- a/src/modules/fancyzones/lib/fancyzones.rc +++ b/src/modules/fancyzones/lib/fancyzones.rc @@ -6,7 +6,7 @@ STRINGTABLE BEGIN IDS_SETTING_DESCRIPTION "Create window layouts to help make multi-tasking easy" - IDS_SETTING_DESCRIPTION_SHIFTDRAG "On: Hold Shift key to enable zones while dragging" + IDS_SETTING_DESCRIPTION_SHIFTDRAG "On: Hold Shift key or any non-primary mouse button to enable zones while dragging" IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS "Override Windows Snap hotkeys (win+arrow) to move windows between zones" IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS "Keep windows in their zones when the screen resolution changes" IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS "Keep windows in their zones when the active FancyZones layout changes"