mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
FZ: fix incorrect snapping zoning behavior caused by calling MessageBox from LLKBHook cb (#8473)
* Revert "add logging to hide/show window and shift press (#8392)"
This reverts commit df3d007a1b.
* FZ: fix incorrect snapping zoning behavior caused by calling MessageBox from LLKBHook cb
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <common/common.h>
|
#include <common/common.h>
|
||||||
#include <common/dpi_aware.h>
|
#include <common/dpi_aware.h>
|
||||||
#include <common/logger/logger.h>
|
|
||||||
#include <common/on_thread_executor.h>
|
#include <common/on_thread_executor.h>
|
||||||
#include <common/window_helpers.h>
|
#include <common/window_helpers.h>
|
||||||
|
|
||||||
@@ -535,9 +534,6 @@ FancyZones::OnKeyDown(PKBDLLHOOKSTRUCT info) noexcept
|
|||||||
bool const win = GetAsyncKeyState(VK_LWIN) & 0x8000 || GetAsyncKeyState(VK_RWIN) & 0x8000;
|
bool const win = GetAsyncKeyState(VK_LWIN) & 0x8000 || GetAsyncKeyState(VK_RWIN) & 0x8000;
|
||||||
bool const alt = GetAsyncKeyState(VK_MENU) & 0x8000;
|
bool const alt = GetAsyncKeyState(VK_MENU) & 0x8000;
|
||||||
bool const ctrl = GetAsyncKeyState(VK_CONTROL) & 0x8000;
|
bool const ctrl = GetAsyncKeyState(VK_CONTROL) & 0x8000;
|
||||||
|
|
||||||
Logger::trace("OnKeyDown: shift {}", shift);
|
|
||||||
|
|
||||||
if ((win && !shift && !ctrl) || (win && ctrl && alt))
|
if ((win && !shift && !ctrl) || (win && ctrl && alt))
|
||||||
{
|
{
|
||||||
// Temporarily disable Win+Ctrl+Number functionality
|
// Temporarily disable Win+Ctrl+Number functionality
|
||||||
@@ -574,10 +570,8 @@ FancyZones::OnKeyDown(PKBDLLHOOKSTRUCT info) noexcept
|
|||||||
|
|
||||||
if (m_windowMoveHandler.IsDragEnabled() && shift)
|
if (m_windowMoveHandler.IsDragEnabled() && shift)
|
||||||
{
|
{
|
||||||
Logger::trace("OnKeyDown: drag enabled -> return true");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Logger::trace("OnKeyDown: return false");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,7 +634,7 @@ void FancyZones::ToggleEditor() noexcept
|
|||||||
|
|
||||||
const bool spanZonesAcrossMonitors = m_settings->GetSettings()->spanZonesAcrossMonitors;
|
const bool spanZonesAcrossMonitors = m_settings->GetSettings()->spanZonesAcrossMonitors;
|
||||||
params += std::to_wstring(spanZonesAcrossMonitors) + divider; /* Span zones */
|
params += std::to_wstring(spanZonesAcrossMonitors) + divider; /* Span zones */
|
||||||
|
|
||||||
std::vector<std::pair<HMONITOR, MONITORINFOEX>> allMonitors;
|
std::vector<std::pair<HMONITOR, MONITORINFOEX>> allMonitors;
|
||||||
allMonitors = FancyZonesUtils::GetAllMonitorInfo<&MONITORINFOEX::rcWork>();
|
allMonitors = FancyZonesUtils::GetAllMonitorInfo<&MONITORINFOEX::rcWork>();
|
||||||
|
|
||||||
@@ -697,10 +691,16 @@ void FancyZones::ToggleEditor() noexcept
|
|||||||
|
|
||||||
if (showDpiWarning)
|
if (showDpiWarning)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
// We must show the message box in a separate thread, since this code is called from a low-level
|
||||||
GET_RESOURCE_STRING(IDS_SPAN_ACROSS_ZONES_WARNING).c_str(),
|
// keyboard hook callback, and launching messageboxes from it has unexpected side effects,
|
||||||
GET_RESOURCE_STRING(IDS_POWERTOYS_FANCYZONES).c_str(),
|
// like triggering EVENT_SYSTEM_MOVESIZEEND prematurely.
|
||||||
MB_OK | MB_ICONWARNING);
|
// TODO: understand the root cause of this, until then it's commented out.
|
||||||
|
//std::thread{ [] {
|
||||||
|
// MessageBoxW(nullptr,
|
||||||
|
// GET_RESOURCE_STRING(IDS_SPAN_ACROSS_ZONES_WARNING).c_str(),
|
||||||
|
// GET_RESOURCE_STRING(IDS_POWERTOYS_FANCYZONES).c_str(),
|
||||||
|
// MB_OK | MB_ICONWARNING);
|
||||||
|
//} }.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& fancyZonesData = FancyZonesDataInstance();
|
const auto& fancyZonesData = FancyZonesDataInstance();
|
||||||
@@ -1294,7 +1294,6 @@ bool FancyZones::IsSplashScreen(HWND window)
|
|||||||
|
|
||||||
void FancyZones::OnEditorExitEvent() noexcept
|
void FancyZones::OnEditorExitEvent() noexcept
|
||||||
{
|
{
|
||||||
Logger::trace("OnEditorExitEvent");
|
|
||||||
// Collect information about changes in zone layout after editor exited.
|
// Collect information about changes in zone layout after editor exited.
|
||||||
FancyZonesDataInstance().ParseDataFromTmpFiles();
|
FancyZonesDataInstance().ParseDataFromTmpFiles();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#include <common/common.h>
|
#include <common/common.h>
|
||||||
#include <common/logger/logger.h>
|
|
||||||
#include <common/on_thread_executor.h>
|
#include <common/on_thread_executor.h>
|
||||||
|
|
||||||
#include "FancyZonesData.h"
|
#include "FancyZonesData.h"
|
||||||
@@ -319,11 +318,9 @@ ZoneWindow::SaveWindowProcessToZoneIndex(HWND window) noexcept
|
|||||||
IFACEMETHODIMP_(void)
|
IFACEMETHODIMP_(void)
|
||||||
ZoneWindow::ShowZoneWindow() noexcept
|
ZoneWindow::ShowZoneWindow() noexcept
|
||||||
{
|
{
|
||||||
Logger::trace("ShowZoneWindow: Enter");
|
|
||||||
auto window = m_window.get();
|
auto window = m_window.get();
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
Logger::trace("ShowZoneWindow: no window");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,16 +342,11 @@ ZoneWindow::HideZoneWindow() noexcept
|
|||||||
{
|
{
|
||||||
if (m_window)
|
if (m_window)
|
||||||
{
|
{
|
||||||
Logger::trace("HideZoneWindow: hiding");
|
|
||||||
m_zoneWindowDrawing->Hide();
|
m_zoneWindowDrawing->Hide();
|
||||||
m_keyLast = 0;
|
m_keyLast = 0;
|
||||||
m_windowMoveSize = nullptr;
|
m_windowMoveSize = nullptr;
|
||||||
m_highlightZone = {};
|
m_highlightZone = {};
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger::trace("HideZoneWindow: no window");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP_(void)
|
IFACEMETHODIMP_(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user