mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 12:11:09 +01:00
* Dpi unaware placement bug (#2121) Fix for bug when placing dpi unaware window such as Notepad++ in left of right part of monitor. In that application gap of about 7px was left or right. This fixes only single-monitor scenario It skips correction for dpi unaware window that leaves a gap * Move markdown parsing logic outside control thread (#2099) * Move markdown parsing logic outside control thread * Update MarkdownPreviewHandlerControl.cs * Remove trailing whitespace. That'll teach me for trying to make an edit from the GitHub page. * Migrate power rename MRU lists from registry to JSON (#2090) * Handle most recently used search/replace strings within settings. * Check for last modified time of json file and reload it if needed. * Handle changes in MRU search / replace lists size. * Improve handling of changes in MRU list size. * Don't check for last modified time in every getter method. Load only when starting application. * Add const identifier to getter methods. * Address PR comments: Add const to reg and json file paths and set them in constructor initializer. Check pushIdx validity. Move implementation to cpp of PowerRenameUI constructor. * Add error checking when getting values from registry. * Implementing changes suggested in #1992 (#2116) * Implementing changes suggested in #1992 * Update Product.wxs Co-authored-by: Ebenezer Ewumi <ebenezer.ewumi@wsu.edu> * Fix for issue #1532 - [PowerToys tray icon] Show version on tooltip (#2117) * Fix for issue #1532 [PowerToys] Show version on tooltip * Update src/runner/tray_icon.cpp Co-Authored-By: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com> Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com> * FZ editor: Splitted zones positioning (#2158) * Added a mutex to ZoneWindow, ensured no data races occur (#2154) * Added a mutex to ZoneWindow, ensured no data races occur * Protected draggedWindow* members with a mutex * Ensured that critical reads happen in a single transaction * Dpi unaware placement bug - multimontior with same DPI settings fix (#2156) * Dpi unaware placement bug - multimontior with same DPI settings fix * Using different enumerating method * Changed AllMonitorHaveSameDpiScaling method * Removed accidental file * small rename * Changed some methods to CamelCase * Review comments fixes Co-authored-by: PrzemyslawTusinski <61138537+PrzemyslawTusinski@users.noreply.github.com> Co-authored-by: Ben Randall <veleek@gmail.com> Co-authored-by: vldmr11080 <57061786+vldmr11080@users.noreply.github.com> Co-authored-by: eduardodextil <55205162+eduardodextil@users.noreply.github.com> Co-authored-by: Ebenezer Ewumi <ebenezer.ewumi@wsu.edu> Co-authored-by: Nghia M. Luong <32159519+sqrlmn@users.noreply.github.com> Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com> Co-authored-by: Seraphima Zykova <zykovas91@gmail.com> Co-authored-by: Ivan Stošić <ivan100sic@gmail.com>
65 lines
2.1 KiB
C++
65 lines
2.1 KiB
C++
#include "pch.h"
|
|
|
|
#include "monitors.h"
|
|
|
|
#include "common.h"
|
|
|
|
bool operator==(const ScreenSize& lhs, const ScreenSize& rhs)
|
|
{
|
|
auto lhs_tuple = std::make_tuple(lhs.rect.left, lhs.rect.right, lhs.rect.top, lhs.rect.bottom);
|
|
auto rhs_tuple = std::make_tuple(rhs.rect.left, rhs.rect.right, rhs.rect.top, rhs.rect.bottom);
|
|
return lhs_tuple == rhs_tuple;
|
|
}
|
|
|
|
static BOOL CALLBACK GetDisplaysEnumCb(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
|
|
{
|
|
MONITORINFOEX monitorInfo;
|
|
monitorInfo.cbSize = sizeof(MONITORINFOEX);
|
|
if (GetMonitorInfo(monitor, &monitorInfo))
|
|
{
|
|
reinterpret_cast<std::vector<MonitorInfo>*>(data)->emplace_back(monitor, monitorInfo.rcWork);
|
|
}
|
|
return true;
|
|
};
|
|
|
|
static BOOL CALLBACK GetDisplaysEnumCbWithNonWorkingArea(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
|
|
{
|
|
MONITORINFOEX monitorInfo;
|
|
monitorInfo.cbSize = sizeof(MONITORINFOEX);
|
|
if (GetMonitorInfo(monitor, &monitorInfo))
|
|
{
|
|
reinterpret_cast<std::vector<MonitorInfo>*>(data)->emplace_back(monitor, monitorInfo.rcMonitor);
|
|
}
|
|
return true;
|
|
};
|
|
|
|
std::vector<MonitorInfo> MonitorInfo::GetMonitors(bool includeNonWorkingArea)
|
|
{
|
|
std::vector<MonitorInfo> monitors;
|
|
EnumDisplayMonitors(NULL, NULL, includeNonWorkingArea ? GetDisplaysEnumCbWithNonWorkingArea : GetDisplaysEnumCb, reinterpret_cast<LPARAM>(&monitors));
|
|
std::sort(begin(monitors), end(monitors), [](const MonitorInfo& lhs, const MonitorInfo& rhs) {
|
|
return lhs.rect < rhs.rect;
|
|
});
|
|
return monitors;
|
|
}
|
|
|
|
static BOOL CALLBACK GetPrimaryDisplayEnumCb(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
|
|
{
|
|
MONITORINFOEX monitorInfo;
|
|
monitorInfo.cbSize = sizeof(MONITORINFOEX);
|
|
|
|
if (GetMonitorInfo(monitor, &monitorInfo) && (monitorInfo.dwFlags & MONITORINFOF_PRIMARY))
|
|
{
|
|
reinterpret_cast<MonitorInfo*>(data)->handle = monitor;
|
|
reinterpret_cast<MonitorInfo*>(data)->rect = monitorInfo.rcWork;
|
|
}
|
|
return true;
|
|
};
|
|
|
|
MonitorInfo MonitorInfo::GetPrimaryMonitor()
|
|
{
|
|
MonitorInfo primary({}, {});
|
|
EnumDisplayMonitors(NULL, NULL, GetPrimaryDisplayEnumCb, reinterpret_cast<LPARAM>(&primary));
|
|
return primary;
|
|
}
|