mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
Cleanup
This commit is contained in:
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" />
|
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" />
|
||||||
<PackageReference Include="System.Diagnostics.Tracing" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -265,7 +265,6 @@ If you don't configure this policy, the user takes control over the setting and
|
|||||||
<string id="MwbDisableUserDefinedIpMappingRules">Disable user defined IP Address mapping rules</string>
|
<string id="MwbDisableUserDefinedIpMappingRules">Disable user defined IP Address mapping rules</string>
|
||||||
<string id="MwbPolicyDefinedIpMappingRules">Predefined IP Address mapping rules</string>
|
<string id="MwbPolicyDefinedIpMappingRules">Predefined IP Address mapping rules</string>
|
||||||
<string id="NewPlusHideTemplateFilenameExtension">Hide template filename extension</string>
|
<string id="NewPlusHideTemplateFilenameExtension">Hide template filename extension</string>
|
||||||
<string id="AllowPowerToysAdvancedPasteOnlineAIModels">Advanced Paste: Allow using online AI models</string>
|
|
||||||
<string id="AllowDiagnosticData">Allow sending diagnostic data</string>
|
<string id="AllowDiagnosticData">Allow sending diagnostic data</string>
|
||||||
</stringTable>
|
</stringTable>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include <common/Telemetry/EtwTrace/EtwTrace.h>
|
#include <common/Telemetry/EtwTrace/EtwTrace.h>
|
||||||
|
|
||||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
|
||||||
namespace winrt
|
namespace winrt
|
||||||
{
|
{
|
||||||
@@ -114,8 +114,7 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
|
|||||||
HANDLE m_exit_event_handle;
|
HANDLE m_exit_event_handle;
|
||||||
std::thread m_event_triggers_thread;
|
std::thread m_event_triggers_thread;
|
||||||
|
|
||||||
std::function<void(HWND)> removeWindowCallback = [&](HWND windowHandle)
|
std::function<void(HWND)> removeWindowCallback = [&](HWND windowHandle) {
|
||||||
{
|
|
||||||
if (!m_running)
|
if (!m_running)
|
||||||
{
|
{
|
||||||
// If we're not running, the reference to croppedWindows might no longer be valid and cause a crash at exit time, due to being called by destructors after wWinMain returns.
|
// If we're not running, the reference to croppedWindows might no longer be valid and cause a crash at exit time, due to being called by destructors after wWinMain returns.
|
||||||
@@ -129,8 +128,7 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::function<void(CropAndLockType)> ProcessCommand = [&](CropAndLockType mode)
|
std::function<void(CropAndLockType)> ProcessCommand = [&](CropAndLockType mode) {
|
||||||
{
|
|
||||||
std::function<void(HWND, RECT)> windowCroppedCallback = [&, mode](HWND targetWindow, RECT cropRect) {
|
std::function<void(HWND, RECT)> windowCroppedCallback = [&, mode](HWND targetWindow, RECT cropRect) {
|
||||||
auto targetInfo = util::WindowInfo(targetWindow);
|
auto targetInfo = util::WindowInfo(targetWindow);
|
||||||
// TODO: Fix WindowInfo.h to not contain the null char at the end.
|
// TODO: Fix WindowInfo.h to not contain the null char at the end.
|
||||||
@@ -160,7 +158,6 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
|
|||||||
croppedWindow = std::make_shared<ThumbnailCropAndLockWindow>(title, 800, 600);
|
croppedWindow = std::make_shared<ThumbnailCropAndLockWindow>(title, 800, 600);
|
||||||
Logger::trace(L"Creating a thumbnail window");
|
Logger::trace(L"Creating a thumbnail window");
|
||||||
Trace::CropAndLock::CreateThumbnailWindow();
|
Trace::CropAndLock::CreateThumbnailWindow();
|
||||||
Trace::CropAndLock::ActivateThumbnail();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@@ -203,9 +200,8 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_event_triggers_thread = std::thread([&]() {
|
m_event_triggers_thread = std::thread([&]() {
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
HANDLE event_handles[3] = {m_reparent_event_handle, m_thumbnail_event_handle, m_exit_event_handle};
|
HANDLE event_handles[3] = { m_reparent_event_handle, m_thumbnail_event_handle, m_exit_event_handle };
|
||||||
while (m_running)
|
while (m_running)
|
||||||
{
|
{
|
||||||
DWORD dwEvt = MsgWaitForMultipleObjects(3, event_handles, false, INFINITE, QS_ALLINPUT);
|
DWORD dwEvt = MsgWaitForMultipleObjects(3, event_handles, false, INFINITE, QS_ALLINPUT);
|
||||||
|
|||||||
@@ -19,13 +19,8 @@ namespace ColorPickerUI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application, IDisposable
|
public partial class App : Application, IDisposable
|
||||||
{
|
{
|
||||||
#pragma warning disable CA1051 // Do not declare visible instance fields
|
public ETWTrace EtwTrace { get; private set; } = new ETWTrace();
|
||||||
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
|
|
||||||
#pragma warning disable SA1401 // Accessible fields should begin with upper-case letter
|
|
||||||
public ETWTrace etwTrace = new ETWTrace();
|
|
||||||
#pragma warning restore SA1401 // Accessible fields should begin with upper-case letter
|
|
||||||
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter
|
|
||||||
#pragma warning restore CA1051 // Do not declare visible instance fields
|
|
||||||
private Mutex _instanceMutex;
|
private Mutex _instanceMutex;
|
||||||
private static string[] _args;
|
private static string[] _args;
|
||||||
private int _powerToysRunnerPid;
|
private int _powerToysRunnerPid;
|
||||||
@@ -51,7 +46,7 @@ namespace ColorPickerUI
|
|||||||
Logger.LogError("CultureNotFoundException: " + ex.Message);
|
Logger.LogError("CultureNotFoundException: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
etwTrace.Start();
|
EtwTrace.Start();
|
||||||
NativeThreadCTS = new CancellationTokenSource();
|
NativeThreadCTS = new CancellationTokenSource();
|
||||||
ExitToken = NativeThreadCTS.Token;
|
ExitToken = NativeThreadCTS.Token;
|
||||||
|
|
||||||
@@ -105,7 +100,7 @@ namespace ColorPickerUI
|
|||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
_instanceMutex?.Dispose();
|
_instanceMutex?.Dispose();
|
||||||
etwTrace?.Dispose();
|
EtwTrace?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
disposedValue = true;
|
disposedValue = true;
|
||||||
|
|||||||
@@ -3,10 +3,8 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
using ColorPicker.Helpers;
|
using ColorPicker.Helpers;
|
||||||
using ColorPickerUI;
|
|
||||||
using Common.UI;
|
using Common.UI;
|
||||||
using Wpf.Ui.Controls;
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ using System.Windows;
|
|||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
|
||||||
using ColorPicker.ViewModelContracts;
|
using ColorPicker.ViewModelContracts;
|
||||||
using ColorPickerUI;
|
|
||||||
using Microsoft.PowerToys.Telemetry;
|
|
||||||
using Wpf.Ui.Controls;
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
namespace ColorPicker
|
namespace ColorPicker
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ using namespace PowerRenameUI::implementation;
|
|||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
#define DEBUG_BENCHMARK_100K_ENTRIES
|
//#define DEBUG_BENCHMARK_100K_ENTRIES
|
||||||
|
|
||||||
std::vector<std::wstring> g_files;
|
std::vector<std::wstring> g_files;
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ void App::OnLaunched(LaunchActivatedEventArgs const&)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_BENCHMARK_100K_ENTRIES
|
#ifdef DEBUG_BENCHMARK_100K_ENTRIES
|
||||||
const std::wstring_view ROOT_PATH = L"C:\\PowerRenameBenchmark";
|
const std::wstring_view ROOT_PATH = L"R:\\PowerRenameBenchmark";
|
||||||
|
|
||||||
std::wstring subdirectory_name = L"0";
|
std::wstring subdirectory_name = L"0";
|
||||||
std::error_code _;
|
std::error_code _;
|
||||||
@@ -136,7 +136,7 @@ void App::OnLaunched(LaunchActivatedEventArgs const&)
|
|||||||
|
|
||||||
g_files.push_back(fs::path{ ROOT_PATH });
|
g_files.push_back(fs::path{ ROOT_PATH });
|
||||||
constexpr int pow2_threshold = 10;
|
constexpr int pow2_threshold = 10;
|
||||||
constexpr int num_files = 10;
|
constexpr int num_files = 100'000;
|
||||||
for (int i = 0; i < num_files; ++i)
|
for (int i = 0; i < num_files; ++i)
|
||||||
{
|
{
|
||||||
fs::path file_path{ ROOT_PATH };
|
fs::path file_path{ ROOT_PATH };
|
||||||
|
|||||||
Reference in New Issue
Block a user