Merge remote-tracking branch 'origin/main' into dev/snickler/net8-upgrade

This commit is contained in:
Jeremy Sinclair 2023-11-13 15:55:58 -05:00
commit b8822c7249
18 changed files with 46 additions and 99 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -23,7 +23,7 @@ If you enable this setting, all utilities will be always enabled and the user wo
If you disable this setting, all utilities will be always disabled and the user won't be able to enable it. If you disable this setting, all utilities will be always disabled and the user won't be able to enable it.
If you don't configure this setting, users are able to disable or enable the utilities. If you don't configure this setting, users are able to enable or disable the utilities.
The individual enabled state policies for the utilities will override this policy. The individual enabled state policies for the utilities will override this policy.
</string> </string>
@ -34,7 +34,7 @@ If you enable this setting, the utility will be always enabled and the user won'
If you disable this setting, the utility will be always disabled and the user won't be able to enable it. If you disable this setting, the utility will be always disabled and the user won't be able to enable it.
If you don't configure this setting, users are able to disable or enable the utility. If you don't configure this setting, users are able to enable or disable the utility.
This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it.
</string> </string>
@ -46,7 +46,7 @@ If you enable this setting, the utility will be always enabled and the user won'
If you disable this setting, the utility will be always disabled and the user won't be able to enable it. If you disable this setting, the utility will be always disabled and the user won't be able to enable it.
If you don't configure this setting, users are able to disable or enable the utility. If you don't configure this setting, users are able to enable or disable the utility.
This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it. This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it.
</string> </string>
@ -78,7 +78,7 @@ If disabled or not configured, the automatic update checks are enabled.
</string> </string>
<string id="AllowExperimentationDescription">This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.) <string id="AllowExperimentationDescription">This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.)
If this setting is not configured or enabled, the user can control experimentation in the PowerToys settings menu. If this setting is enabled or not configured, the user can control experimentation in the PowerToys settings menu.
If this setting is disabled, experimentation is not allowed. If this setting is disabled, experimentation is not allowed.
</string> </string>
@ -88,22 +88,22 @@ If you enable this setting, the plugins will be always enabled and the user won'
If you disable this setting, the plugins will be always disabled and the user won't be able to enable it. If you disable this setting, the plugins will be always disabled and the user won't be able to enable it.
If you don't configure this setting, users are able to disable or enable the plugins. If you don't configure this setting, users are able to enable or disable the plugins.
You can override this policy for individual plugins using the policy "Configure enabled state for individual plugins". You can override this policy for individual plugins using the policy "Configure enabled state for individual plugins".
Note: Changes require a restart of PowerToys Run. Note: Changes require a restart of PowerToys Run.
</string> </string>
<string id="PowerToysRunIndividualPluginEnabledStateDescription">With this policy you can configures an individual enabled state for each PowerToys Run plugin that you add to the list. <string id="PowerToysRunIndividualPluginEnabledStateDescription">With this policy you can configure an individual enabled state for each PowerToys Run plugin that you add to the list.
If you enable this setting, you can define the list of plugins and their enabled states: If you enable this setting, you can define the list of plugins and their enabled states:
- The value name (first column) is the plugin ID. You will find it in the plugin.json which is located in the plugin folder. - The value name (first column) is the plugin ID. You will find it in the plugin.json file which is located in the plugin folder.
- The value (second column) is a numeric value: 0 for disabled, 1 for enabled and 2 for user takes control. - The value (second column) is a numeric value: 0 for disabled, 1 for enabled and 2 for user takes control.
- Example to disable the Program plugin: 791FC278BA414111B8D1886DFE447410 | 0 - Example to disable the Program plugin: 791FC278BA414111B8D1886DFE447410 | 0
If you disable or don't configure this policy, either the user or the policy "Configure enabled state for all plugins" takes control over the enabled state of the plugins. If you disable or don't configure this policy, either the user or the policy "Configure enabled state for all plugins" takes control over the enabled state of the plugins.
You can set the enabled state for all plugins not listed here using the policy "Configure enabled state for all plugins". You can set the enabled state for all plugins not configured by this policy using the policy "Configure enabled state for all plugins".
Note: Changes require a restart of PowerToys Run. Note: Changes require a restart of PowerToys Run.
</string> </string>

View File

@ -85,28 +85,6 @@ namespace MouseWithoutBorders
return stack; return stack;
} }
internal static void SuspendAllThreadsBut(int threadId)
{
lock (ThreadsLock)
{
#pragma warning disable 618 // Temporary
threads.Where(t => t.IsAlive && t.ManagedThreadId != threadId).ToList().ForEach(
t =>
{
try
{
t.Suspend();
}
catch (Exception)
{
// This method is suspending every thread so that it can kill the process right after restarting.
// Makes no sense to crash on a thread suspension fail, since we're killing the process afterwards, anyway.
}
});
#pragma warning restore 618
}
}
internal void SetApartmentState(ApartmentState apartmentState) internal void SetApartmentState(ApartmentState apartmentState)
{ {
thread.SetApartmentState(apartmentState); thread.SetApartmentState(apartmentState);

View File

@ -349,8 +349,6 @@ namespace MouseWithoutBorders
_ = Process.Start(Application.ExecutablePath, desktop); _ = Process.Start(Application.ExecutablePath, desktop);
LogDebug($"Started on desktop {desktop}"); LogDebug($"Started on desktop {desktop}");
Thread.SuspendAllThreadsBut(Thread.CurrentThread.ManagedThreadId);
Process.GetCurrentProcess().KillProcess(true); Process.GetCurrentProcess().KillProcess(true);
}, },
$"{actionName} watchdog").Start(); $"{actionName} watchdog").Start();

View File

@ -44,7 +44,7 @@ namespace ImageResizer.ViewModels
{ {
if (_batch.Files.Count == 0) if (_batch.Files.Count == 0)
{ {
_batch.Files.AddRange(view?.OpenPictureFiles()); _batch.Files.AddRange(view.OpenPictureFiles());
} }
CurrentPage = new InputViewModel(_settings, this, view, _batch); CurrentPage = new InputViewModel(_settings, this, view, _batch);

View File

@ -55,12 +55,12 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
public List<Result> Query(Query query) public List<Result> Query(Query query)
{ {
ArgumentNullException.ThrowIfNull(query);
bool isGlobalQuery = string.IsNullOrEmpty(query.ActionKeyword); bool isGlobalQuery = string.IsNullOrEmpty(query.ActionKeyword);
CultureInfo inputCulture = _inputUseEnglishFormat ? new CultureInfo("en-us") : CultureInfo.CurrentCulture; CultureInfo inputCulture = _inputUseEnglishFormat ? new CultureInfo("en-us") : CultureInfo.CurrentCulture;
CultureInfo outputCulture = _outputUseEnglishFormat ? new CultureInfo("en-us") : CultureInfo.CurrentCulture; CultureInfo outputCulture = _outputUseEnglishFormat ? new CultureInfo("en-us") : CultureInfo.CurrentCulture;
ArgumentNullException.ThrowIfNull(query);
// Happens if the user has only typed the action key so far // Happens if the user has only typed the action key so far
if (string.IsNullOrEmpty(query.Search)) if (string.IsNullOrEmpty(query.Search))
{ {

View File

@ -9,27 +9,20 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using Common.UI; using Common.UI;
using interop; using interop;
using ManagedCommon; using ManagedCommon;
using Microsoft.PowerLauncher.Telemetry; using Microsoft.PowerLauncher.Telemetry;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
using PowerLauncher.Helper; using PowerLauncher.Helper;
using PowerLauncher.Plugin; using PowerLauncher.Plugin;
using PowerLauncher.ViewModel; using PowerLauncher.ViewModel;
using Wox; using Wox;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Infrastructure.Image; using Wox.Infrastructure.Image;
using Wox.Infrastructure.UserSettings; using Wox.Infrastructure.UserSettings;
using Wox.Plugin; using Wox.Plugin;
using Wox.Plugin.Logger; using Wox.Plugin.Logger;
using Stopwatch = Wox.Infrastructure.Stopwatch; using Stopwatch = Wox.Infrastructure.Stopwatch;
namespace PowerLauncher namespace PowerLauncher
@ -155,8 +148,6 @@ namespace PowerLauncher
_settingsReader.ReadSettingsOnChange(); _settingsReader.ReadSettingsOnChange();
_mainVM.MainWindowVisibility = Visibility.Visible;
_mainVM.ColdStartFix();
_themeManager.ThemeChanged += OnThemeChanged; _themeManager.ThemeChanged += OnThemeChanged;
textToLog.AppendLine("End PowerToys Run startup ---------------------------------------------------- "); textToLog.AppendLine("End PowerToys Run startup ---------------------------------------------------- ");
@ -164,11 +155,6 @@ namespace PowerLauncher
Log.Info(textToLog.ToString(), GetType()); Log.Info(textToLog.ToString(), GetType());
PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds }); PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
// [Conditional("RELEASE")]
// check update every 5 hours
// check updates on startup
}); });
} }

View File

@ -560,7 +560,7 @@ namespace PowerLauncher
// To populate the AutoCompleteTextBox as soon as the selection is changed or set. // To populate the AutoCompleteTextBox as soon as the selection is changed or set.
// Setting it here instead of when the text is changed as there is a delay in executing the query and populating the result // Setting it here instead of when the text is changed as there is a delay in executing the query and populating the result
if (_viewModel.Results != null && !string.IsNullOrEmpty(SearchBox.QueryTextBox.Text)) if (!string.IsNullOrEmpty(SearchBox.QueryTextBox.Text))
{ {
SearchBox.AutoCompleteTextBlock.Text = MainViewModel.GetAutoCompleteText( SearchBox.AutoCompleteTextBlock.Text = MainViewModel.GetAutoCompleteText(
_viewModel.Results.SelectedIndex, _viewModel.Results.SelectedIndex,

View File

@ -11,8 +11,8 @@ using System.IO.Abstractions;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using global::PowerToys.GPOWrapper; using global::PowerToys.GPOWrapper;
using ManagedCommon;
using PowerLauncher.Properties; using PowerLauncher.Properties;
using Wox.Infrastructure.Storage; using Wox.Infrastructure.Storage;
using Wox.Plugin; using Wox.Plugin;
@ -59,12 +59,14 @@ namespace PowerLauncher.Plugin
{ {
try try
{ {
// Return a comparable produce version. // Return a comparable product version.
var fileVersion = FileVersionInfo.GetVersionInfo(x.ExecuteFilePath); var fileVersion = FileVersionInfo.GetVersionInfo(x.ExecuteFilePath);
return ((uint)fileVersion.ProductMajorPart << 48)
| ((uint)fileVersion.ProductMinorPart << 32) // Convert each part to an unsigned 32 bit integer, then extend to 64 bit.
| ((uint)fileVersion.ProductBuildPart << 16) return ((ulong)(uint)fileVersion.ProductMajorPart << 48)
| ((uint)fileVersion.ProductPrivatePart); | ((ulong)(uint)fileVersion.ProductMinorPart << 32)
| ((ulong)(uint)fileVersion.ProductBuildPart << 16)
| (ulong)(uint)fileVersion.ProductPrivatePart;
} }
catch (System.IO.FileNotFoundException) catch (System.IO.FileNotFoundException)
{ {
@ -180,7 +182,7 @@ namespace PowerLauncher.Plugin
{ {
var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name)); var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name));
var description = string.Format(CultureInfo.CurrentCulture, Resources.FailedToInitializePluginsDescription, failed); var description = string.Format(CultureInfo.CurrentCulture, Resources.FailedToInitializePluginsDescription, failed);
API.ShowMsg(Resources.FailedToInitializePluginsTitle, description, string.Empty, false); Application.Current.Dispatcher.InvokeAsync(() => API.ShowMsg(Resources.FailedToInitializePluginsTitle, description, string.Empty, false));
} }
} }

View File

@ -1022,34 +1022,6 @@ namespace PowerLauncher.ViewModel
} }
} }
public void ColdStartFix()
{
// Fix Cold start for List view xaml island
List<Result> list = new List<Result>();
Result r = new Result
{
Title = "hello",
};
list.Add(r);
Results.AddResults(list, _updateToken);
Results.Clear();
// Fix Cold start for plugins, "m" is just a random string needed to query results
var pluginQueryPairs = QueryBuilder.Build("m");
// To execute a query corresponding to each plugin
foreach (KeyValuePair<PluginPair, Query> pluginQueryItem in pluginQueryPairs)
{
var plugin = pluginQueryItem.Key;
var query = pluginQueryItem.Value;
if (!plugin.Metadata.Disabled && plugin.Metadata.Name != "Window Walker")
{
_ = PluginManager.QueryForPlugin(plugin, query);
}
}
}
public void HandleContextMenu(Key acceleratorKey, ModifierKeys acceleratorModifiers) public void HandleContextMenu(Key acceleratorKey, ModifierKeys acceleratorModifiers)
{ {
var results = SelectedResults; var results = SelectedResults;

View File

@ -223,9 +223,7 @@ namespace Wox.Infrastructure
} }
else else
{ {
int? ind = spaceIndices.OrderBy(item => (firstMatchIndex - item)).Where(item => firstMatchIndex > item).FirstOrDefault(); return spaceIndices.OrderBy(item => (firstMatchIndex - item)).Where(item => firstMatchIndex > item).FirstOrDefault(-1);
int closestSpaceIndex = ind ?? -1;
return closestSpaceIndex;
} }
} }

View File

@ -4,10 +4,10 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.Loader; using System.Runtime.Loader;
using System.Windows;
using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library;
using Wox.Plugin.Logger; using Wox.Plugin.Logger;
using Wox.Plugin.Properties; using Wox.Plugin.Properties;
@ -74,7 +74,7 @@ namespace Wox.Plugin
if (!IsPluginInitialized) if (!IsPluginInitialized)
{ {
string description = $"{Resources.FailedToLoadPluginDescription} {Metadata.Name}\n\n{Resources.FailedToLoadPluginDescriptionPartTwo}"; string description = $"{Resources.FailedToLoadPluginDescription} {Metadata.Name}\n\n{Resources.FailedToLoadPluginDescriptionPartTwo}";
api.ShowMsg(Resources.FailedToLoadPluginTitle, description, string.Empty, false); Application.Current.Dispatcher.InvokeAsync(() => api.ShowMsg(Resources.FailedToLoadPluginTitle, description, string.Empty, false));
} }
} }
else else

View File

@ -198,7 +198,7 @@ namespace PowerAccent.Core
LetterKey.VK_P => new[] { "£", "₽" }, LetterKey.VK_P => new[] { "£", "₽" },
LetterKey.VK_R => new[] { "₹", "៛", "﷼" }, LetterKey.VK_R => new[] { "₹", "៛", "﷼" },
LetterKey.VK_S => new[] { "$", "₪" }, LetterKey.VK_S => new[] { "$", "₪" },
LetterKey.VK_T => new[] { "₮", "₺" }, LetterKey.VK_T => new[] { "₮", "₺", "₸" },
LetterKey.VK_W => new[] { "₩" }, LetterKey.VK_W => new[] { "₩" },
LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Y => new[] { "¥" },
LetterKey.VK_Z => new[] { "z" }, LetterKey.VK_Z => new[] { "z" },

View File

@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using Common.Utilities; using Common.Utilities;
namespace Microsoft.PowerToys.ThumbnailHandler.Gcode namespace Microsoft.PowerToys.ThumbnailHandler.Gcode
@ -47,9 +48,20 @@ namespace Microsoft.PowerToys.ThumbnailHandler.Gcode
var gcodeThumbnail = GcodeHelper.GetBestThumbnail(reader); var gcodeThumbnail = GcodeHelper.GetBestThumbnail(reader);
var thumbnail = gcodeThumbnail?.GetBitmap(); Bitmap thumbnail = null;
if (thumbnail != null && thumbnail.Width != cx && thumbnail.Height != cx) try
{
thumbnail = gcodeThumbnail?.GetBitmap();
}
catch (Exception)
{
// TODO: add logger
}
if (thumbnail != null && (
((thumbnail.Width != cx || thumbnail.Height > cx) && (thumbnail.Height != cx || thumbnail.Width > cx)) ||
thumbnail.PixelFormat != PixelFormat.Format32bppArgb))
{ {
// We are not the appropriate size for caller. Resize now while // We are not the appropriate size for caller. Resize now while
// respecting the aspect ratio. // respecting the aspect ratio.
@ -80,7 +92,7 @@ namespace Microsoft.PowerToys.ThumbnailHandler.Gcode
return null; return null;
} }
Bitmap destImage = new Bitmap(width, height); Bitmap destImage = new Bitmap(width, height, PixelFormat.Format32bppArgb);
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
@ -95,6 +107,8 @@ namespace Microsoft.PowerToys.ThumbnailHandler.Gcode
graphics.DrawImage(image, 0, 0, width, height); graphics.DrawImage(image, 0, 0, width, height);
} }
image.Dispose();
return destImage; return destImage;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -70,7 +70,7 @@
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Polish" /> <ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Polish" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Portuguese" /> <ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Portuguese" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Romanian" /> <ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Romanian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Slovakian" /> <ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Slovak" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Spanish" /> <ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Spanish" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Serbian" /> <ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Serbian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Swedish" /> <ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Swedish" />

View File

@ -3366,8 +3366,8 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="QuickAccent_SelectedLanguage_Portuguese.Content" xml:space="preserve"> <data name="QuickAccent_SelectedLanguage_Portuguese.Content" xml:space="preserve">
<value>Portuguese</value> <value>Portuguese</value>
</data> </data>
<data name="QuickAccent_SelectedLanguage_Slovakian.Content" xml:space="preserve"> <data name="QuickAccent_SelectedLanguage_Slovak.Content" xml:space="preserve">
<value>Slovakian</value> <value>Slovak</value>
</data> </data>
<data name="QuickAccent_SelectedLanguage_Spanish.Content" xml:space="preserve"> <data name="QuickAccent_SelectedLanguage_Spanish.Content" xml:space="preserve">
<value>Spanish</value> <value>Spanish</value>

View File

@ -48,13 +48,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
AddFlyoutMenuItem(ModuleType.MeasureTool); AddFlyoutMenuItem(ModuleType.MeasureTool);
AddFlyoutMenuItem(ModuleType.ShortcutGuide); AddFlyoutMenuItem(ModuleType.ShortcutGuide);
updatingSettingsConfig = UpdatingSettings.LoadSettings();
if (updatingSettingsConfig == null) if (updatingSettingsConfig == null)
{ {
updatingSettingsConfig = new UpdatingSettings(); updatingSettingsConfig = new UpdatingSettings();
} }
updatingSettingsConfig = UpdatingSettings.LoadSettings();
if (updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToInstall || updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToDownload) if (updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToInstall || updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToDownload)
{ {
IsUpdateAvailable = true; IsUpdateAvailable = true;