Compare commits

...

7 Commits

Author SHA1 Message Date
Mykhailo Pylyp
831bf999bc Start PowerToys Run through the ActionRunner (#12043) 2021-07-01 02:30:23 -07:00
Seraphima Zykova
58e2a30837 [Hotfix][FancyZones] Unable to start correctly (#12038)
* fix event

* close handle on destroy
2021-07-01 02:30:05 -07:00
Clint Rutkas
79883e53b4 checking for NaN, not just zero (#12058) 2021-06-30 17:18:57 -07:00
Jaime Bernardo
67d6abc24a [Hotfix] PowerToys Awake - Show full name on tray (#12015) 2021-06-30 08:42:07 -07:00
Den Delimarsky
5e26a0a3af [Hotfix] PowerToys Awake - fixing CPU usage (#11978)
* Change how background threads operate
This should reduce CPU usage.

* Well there is just no need for the console here

* Need to keep the full name sanitized
2021-06-30 08:41:57 -07:00
Mykhailo Pylyp
15ba3d57be Fix clicking on text (#11968) 2021-06-30 08:41:48 -07:00
Clint Rutkas
a3435fcb50 Update pipeline.user.windows.yml (#11897) 2021-06-28 13:29:28 -07:00
8 changed files with 48 additions and 27 deletions

View File

@@ -93,8 +93,10 @@ build:
- 'modules\FancyZones\fancyzones.dll'
- 'modules\FancyZones\FancyZonesEditor.exe'
- 'modules\FancyZones\FancyZonesEditor.dll'
- 'modules\FancyZones\FancyZonesModuleInterface.dll'
- 'modules\FancyZones\ManagedCommon.dll'
- 'modules\FancyZones\ManagedTelemetry.dll'
- 'modules\FancyZones\PowerToys.FancyZones.exe'
- 'modules\FancyZones\Telemetry.dll'
- 'modules\FancyZones\Microsoft.PowerToys.Common.UI.dll'
- 'modules\FileExplorerPreview\ManagedTelemetry.dll'

View File

@@ -307,25 +307,17 @@ inline bool run_non_elevated(const std::wstring& file, const std::wstring& param
inline bool RunNonElevatedEx(const std::wstring& file, const std::wstring& params)
{
bool failedToStart = false;
try
{
CoInitialize(nullptr);
if (!ShellExecuteFromExplorer(file.c_str(), params.c_str()))
{
failedToStart = true;
return false;
}
}
catch(...)
{
failedToStart = true;
}
if (failedToStart)
{
Logger::warn(L"Failed to delegate process creation. Try a fallback");
DWORD returnPid;
return run_non_elevated(file, params, &returnPid);
return false;
}
return true;

View File

@@ -184,13 +184,10 @@ namespace Awake.Core
if (success)
{
_log.Info($"Initiated indefinite keep awake in background thread: {GetCurrentThreadId()}. Screen on: {keepDisplayOn}");
while (true)
{
if (_threadToken.IsCancellationRequested)
{
_threadToken.ThrowIfCancellationRequested();
}
}
WaitHandle.WaitAny(new[] { _threadToken.WaitHandle });
return success;
}
else
{

View File

@@ -28,6 +28,7 @@ namespace Awake
{
private static Mutex? _mutex = null;
private const string AppName = "Awake";
private const string FullAppName = "PowerToys " + AppName;
private static FileSystemWatcher? _watcher = null;
private static SettingsUtils? _settingsUtils = null;
@@ -127,7 +128,6 @@ namespace Awake
private static void ForceExit(string message, int exitCode)
{
_log.Info(message);
Console.ReadKey();
Environment.Exit(exitCode);
}
@@ -151,7 +151,7 @@ namespace Awake
try
{
#pragma warning disable CS8604 // Possible null reference argument.
TrayHelper.InitializeTray(AppName, new Icon(Application.GetResourceStream(new Uri("/Images/Awake.ico", UriKind.Relative)).Stream));
TrayHelper.InitializeTray(FullAppName, new Icon(Application.GetResourceStream(new Uri("/Images/Awake.ico", UriKind.Relative)).Stream));
#pragma warning restore CS8604 // Possible null reference argument.
var settingsPath = _settingsUtils.GetSettingsFilePath(AppName);
@@ -180,7 +180,7 @@ namespace Awake
.Select(e => e.EventArgs)
.Subscribe(HandleAwakeConfigChange);
TrayHelper.SetTray(AppName, new AwakeSettings());
TrayHelper.SetTray(FullAppName, new AwakeSettings());
// Initially the file might not be updated, so we need to start processing
// settings right away.
@@ -274,7 +274,7 @@ namespace Awake
}
}
TrayHelper.SetTray(AppName, settings);
TrayHelper.SetTray(FullAppName, settings);
}
else
{

View File

@@ -98,6 +98,13 @@ public:
virtual void destroy() override
{
Disable(false);
if (m_toggleEditorEvent)
{
CloseHandle(m_toggleEditorEvent);
m_toggleEditorEvent = nullptr;
}
delete this;
}
@@ -114,6 +121,15 @@ public:
m_settings = MakeFancyZonesSettings(reinterpret_cast<HINSTANCE>(&__ImageBase), FancyZonesModuleInterface::get_name(), FancyZonesModuleInterface::get_key());
m_toggleEditorEvent = CreateDefaultEvent(CommonSharedConstants::FANCY_ZONES_EDITOR_TOGGLE_EVENT);
if (!m_toggleEditorEvent)
{
Logger::error(L"Failed to create toggle editor event");
auto message = get_last_error_message(GetLastError());
if (message.has_value())
{
Logger::error(message.value());
}
}
}
private:
@@ -158,8 +174,10 @@ private:
Trace::FancyZones::EnableFancyZones(false);
}
ResetEvent(m_toggleEditorEvent);
CloseHandle(m_toggleEditorEvent);
if (m_toggleEditorEvent)
{
ResetEvent(m_toggleEditorEvent);
}
if (m_hProcess)
{

View File

@@ -84,7 +84,7 @@ namespace ImageResizer.Models
}
public bool HasAuto
=> Width == 0 || Height == 0;
=> Width == 0 || Height == 0 || double.IsNaN(Width) || double.IsNaN(Height);
[JsonProperty(PropertyName = "unit")]
public ResizeUnit Unit
@@ -125,7 +125,7 @@ namespace ImageResizer.Models
private double ConvertToPixels(double value, ResizeUnit unit, int originalValue, double dpi)
{
if (value == 0)
if (value == 0 || double.IsNaN(value))
{
if (Fit == ResizeFit.Fit)
{

View File

@@ -243,7 +243,18 @@ public:
}
else
{
Logger::error(L"Failed to start the process");
Logger::warn(L"RunNonElevatedEx() failed. Trying fallback");
std::wstring action_runner_path = get_module_folderpath() + L"\\PowerToys.ActionRunner.exe";
std::wstring newParams = L"-run-non-elevated -target modules\\launcher\\PowerLauncher.exe " + params;
if (run_non_elevated(action_runner_path, newParams, nullptr))
{
processStarted = true;
Logger::trace("Started PowerToys Run Process");
}
else
{
Logger::warn("Failed to start PowerToys Run");
}
}
}
}

View File

@@ -236,7 +236,8 @@
Grid.Column="1"
FontSize="20"
Margin="0,0,0,-2"
VerticalAlignment="Bottom">
VerticalAlignment="Bottom"
IsHitTestVisible="False">
<viewmodel:ResultsViewModel.FormattedText>
<MultiBinding Converter="{StaticResource highlightTextConverter}">
<Binding Path="Result.Title" />