mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-07-07 11:00:32 +02:00
Compare commits
3 Commits
issue/4695
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9679b937d | ||
|
|
36300d3c75 | ||
|
|
1cde68ae04 |
@@ -36,7 +36,6 @@ namespace HotkeyConflictDetector
|
||||
|
||||
HotkeyConflictType HotkeyConflictManager::HasConflict(Hotkey const& _hotkey, const wchar_t* _moduleName, const int _hotkeyID)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(hotkeyMutex);
|
||||
if (disabledHotkeys.find(_moduleName) != disabledHotkeys.end())
|
||||
{
|
||||
return HotkeyConflictType::NoConflict;
|
||||
@@ -80,7 +79,6 @@ namespace HotkeyConflictDetector
|
||||
|
||||
HotkeyConflictType HotkeyConflictManager::HasConflict(Hotkey const& _hotkey)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(hotkeyMutex);
|
||||
uint16_t handle = GetHotkeyHandle(_hotkey);
|
||||
|
||||
if (handle == 0)
|
||||
@@ -115,7 +113,6 @@ namespace HotkeyConflictDetector
|
||||
// It returns a list of all conflicting shortcuts.
|
||||
std::vector<HotkeyConflictInfo> HotkeyConflictManager::GetAllConflicts(Hotkey const& _hotkey)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(hotkeyMutex);
|
||||
std::vector<HotkeyConflictInfo> conflicts;
|
||||
uint16_t handle = GetHotkeyHandle(_hotkey);
|
||||
|
||||
@@ -167,7 +164,6 @@ namespace HotkeyConflictDetector
|
||||
|
||||
bool HotkeyConflictManager::AddHotkey(Hotkey const& _hotkey, const wchar_t* _moduleName, const int _hotkeyID, bool isEnabled)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(hotkeyMutex);
|
||||
if (!isEnabled)
|
||||
{
|
||||
disabledHotkeys[_moduleName].push_back({ _hotkey, _moduleName, _hotkeyID });
|
||||
@@ -213,13 +209,14 @@ namespace HotkeyConflictDetector
|
||||
|
||||
std::vector<HotkeyConflictInfo> HotkeyConflictManager::RemoveHotkeyByModule(const std::wstring& moduleName)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(hotkeyMutex);
|
||||
std::vector<HotkeyConflictInfo> removedHotkeys;
|
||||
|
||||
if (disabledHotkeys.find(moduleName) != disabledHotkeys.end())
|
||||
{
|
||||
disabledHotkeys.erase(moduleName);
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(hotkeyMutex);
|
||||
bool foundRecord = false;
|
||||
|
||||
for (auto it = sysConflictHotkeyMap.begin(); it != sysConflictHotkeyMap.end();)
|
||||
@@ -313,7 +310,6 @@ namespace HotkeyConflictDetector
|
||||
|
||||
void HotkeyConflictManager::EnableHotkeyByModule(const std::wstring& moduleName)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(hotkeyMutex);
|
||||
if (disabledHotkeys.find(moduleName) == disabledHotkeys.end())
|
||||
{
|
||||
return; // No disabled hotkeys for this module
|
||||
@@ -331,7 +327,6 @@ namespace HotkeyConflictDetector
|
||||
|
||||
void HotkeyConflictManager::DisableHotkeyByModule(const std::wstring& moduleName)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(hotkeyMutex);
|
||||
auto hotkeys = RemoveHotkeyByModule(moduleName);
|
||||
disabledHotkeys[moduleName] = hotkeys;
|
||||
}
|
||||
@@ -387,7 +382,7 @@ namespace HotkeyConflictDetector
|
||||
|
||||
json::JsonObject HotkeyConflictManager::GetHotkeyConflictsAsJson()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(hotkeyMutex);
|
||||
std::lock_guard<std::mutex> lock(hotkeyMutex);
|
||||
|
||||
using namespace json;
|
||||
JsonObject root;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace HotkeyConflictDetector
|
||||
static std::mutex instanceMutex;
|
||||
static HotkeyConflictManager* instance;
|
||||
|
||||
std::recursive_mutex hotkeyMutex;
|
||||
std::mutex hotkeyMutex;
|
||||
// Hotkey in hotkeyMap means the hotkey has been registered successfully
|
||||
std::unordered_map<uint16_t, HotkeyConflictInfo> hotkeyMap;
|
||||
// Hotkey in sysConflictHotkeyMap means the hotkey has conflict with system defined hotkeys
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
@@ -135,7 +136,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
throw e.Exception;
|
||||
var sourcePage = e.SourcePageType?.FullName ?? "<unknown>";
|
||||
|
||||
if (e.Exception is null)
|
||||
{
|
||||
Logger.LogWarning($"Navigation to '{sourcePage}' failed without an exception.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Navigation to '{sourcePage}' failed.", e.Exception);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Frame_Navigated(object sender, NavigationEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user