Skip to content

Commit 66b3f5a

Browse files
authored
Merge branch 'dev' into dev2
2 parents abe943b + 0b8db59 commit 66b3f5a

File tree

17 files changed

+105
-297
lines changed

17 files changed

+105
-297
lines changed

Flow.Launcher.Infrastructure/FileExplorerHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private static IEnumerable<int> GetZOrder(List<dynamic> hWnds)
6868
var numRemaining = hWnds.Count;
6969
PInvoke.EnumWindows((wnd, _) =>
7070
{
71-
var searchIndex = hWnds.FindIndex(x => x.HWND == wnd.Value);
71+
var searchIndex = hWnds.FindIndex(x => new IntPtr(x.HWND) == wnd);
7272
if (searchIndex != -1)
7373
{
7474
z[searchIndex] = index;

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
<ItemGroup>
5555
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
56-
<PackageReference Include="BitFaster.Caching" Version="2.5.2" />
56+
<PackageReference Include="BitFaster.Caching" Version="2.5.3" />
5757
<PackageReference Include="Fody" Version="6.5.5">
5858
<PrivateAssets>all</PrivateAssets>
5959
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

Flow.Launcher.Infrastructure/NativeMethods.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,4 @@ WM_KEYUP
1616
WM_SYSKEYDOWN
1717
WM_SYSKEYUP
1818

19-
EnumWindows
20-
21-
OleInitialize
22-
OleUninitialize
19+
EnumWindows

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public SearchPrecisionScore QuerySearchPrecision
230230
[JsonIgnore]
231231
public ObservableCollection<BuiltinShortcutModel> BuiltinShortcuts { get; set; } = new()
232232
{
233-
new BuiltinShortcutModel("{clipboard}", "shortcut_clipboard_description", () => Win32Helper.StartSTATaskAsync(Clipboard.GetText).Result),
233+
new BuiltinShortcutModel("{clipboard}", "shortcut_clipboard_description", Clipboard.GetText),
234234
new BuiltinShortcutModel("{active_explorer_path}", "shortcut_active_explorer_path", FileExplorerHelper.GetActiveExplorerPath)
235235
};
236236

Flow.Launcher.Infrastructure/Win32Helper.cs

Lines changed: 0 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,12 @@
11
using System;
22
using System.Runtime.InteropServices;
3-
using System.Threading;
4-
using System.Threading.Tasks;
53
using System.Windows.Interop;
64
using System.Windows;
7-
using Windows.Win32;
85

96
namespace Flow.Launcher.Infrastructure
107
{
118
public static class Win32Helper
129
{
13-
#region STA Thread
14-
15-
/*
16-
Found on https://github.com/files-community/Files
17-
*/
18-
19-
public static Task StartSTATaskAsync(Action action)
20-
{
21-
var taskCompletionSource = new TaskCompletionSource();
22-
Thread thread = new(() =>
23-
{
24-
PInvoke.OleInitialize();
25-
26-
try
27-
{
28-
action();
29-
taskCompletionSource.SetResult();
30-
}
31-
catch (System.Exception)
32-
{
33-
taskCompletionSource.SetResult();
34-
}
35-
finally
36-
{
37-
PInvoke.OleUninitialize();
38-
}
39-
})
40-
{
41-
IsBackground = true,
42-
Priority = ThreadPriority.Normal
43-
};
44-
45-
thread.SetApartmentState(ApartmentState.STA);
46-
thread.Start();
47-
48-
return taskCompletionSource.Task;
49-
}
50-
51-
public static Task StartSTATaskAsync(Func<Task> func)
52-
{
53-
var taskCompletionSource = new TaskCompletionSource();
54-
Thread thread = new(async () =>
55-
{
56-
PInvoke.OleInitialize();
57-
58-
try
59-
{
60-
await func();
61-
taskCompletionSource.SetResult();
62-
}
63-
catch (System.Exception)
64-
{
65-
taskCompletionSource.SetResult();
66-
}
67-
finally
68-
{
69-
PInvoke.OleUninitialize();
70-
}
71-
})
72-
{
73-
IsBackground = true,
74-
Priority = ThreadPriority.Normal
75-
};
76-
77-
thread.SetApartmentState(ApartmentState.STA);
78-
thread.Start();
79-
80-
return taskCompletionSource.Task;
81-
}
82-
83-
public static Task<T?> StartSTATaskAsync<T>(Func<T> func)
84-
{
85-
var taskCompletionSource = new TaskCompletionSource<T?>();
86-
87-
Thread thread = new(() =>
88-
{
89-
PInvoke.OleInitialize();
90-
91-
try
92-
{
93-
taskCompletionSource.SetResult(func());
94-
}
95-
catch (System.Exception)
96-
{
97-
taskCompletionSource.SetResult(default);
98-
}
99-
finally
100-
{
101-
PInvoke.OleUninitialize();
102-
}
103-
})
104-
{
105-
IsBackground = true,
106-
Priority = ThreadPriority.Normal
107-
};
108-
109-
thread.SetApartmentState(ApartmentState.STA);
110-
thread.Start();
111-
112-
return taskCompletionSource.Task;
113-
}
114-
115-
public static Task<T?> StartSTATaskAsync<T>(Func<Task<T>> func)
116-
{
117-
var taskCompletionSource = new TaskCompletionSource<T?>();
118-
119-
Thread thread = new(async () =>
120-
{
121-
PInvoke.OleInitialize();
122-
try
123-
{
124-
taskCompletionSource.SetResult(await func());
125-
}
126-
catch (System.Exception)
127-
{
128-
taskCompletionSource.SetResult(default);
129-
}
130-
finally
131-
{
132-
PInvoke.OleUninitialize();
133-
}
134-
})
135-
{
136-
IsBackground = true,
137-
Priority = ThreadPriority.Normal
138-
};
139-
140-
thread.SetApartmentState(ApartmentState.STA);
141-
thread.Start();
142-
143-
return taskCompletionSource.Task;
144-
}
145-
146-
#endregion
147-
14810
#region Blur Handling
14911

15012
/*

Flow.Launcher.Plugin/Result.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,6 @@ public string PluginDirectory
157157
}
158158
}
159159

160-
/// <inheritdoc />
161-
public override bool Equals(object obj)
162-
{
163-
var r = obj as Result;
164-
165-
var equality = string.Equals(r?.Title, Title) &&
166-
string.Equals(r?.SubTitle, SubTitle) &&
167-
string.Equals(r?.AutoCompleteText, AutoCompleteText) &&
168-
string.Equals(r?.CopyText, CopyText) &&
169-
string.Equals(r?.IcoPath, IcoPath) &&
170-
TitleHighlightData == r.TitleHighlightData;
171-
172-
return equality;
173-
}
174-
175-
/// <inheritdoc />
176-
public override int GetHashCode()
177-
{
178-
return HashCode.Combine(Title, SubTitle, AutoCompleteText, CopyText, IcoPath);
179-
}
180-
181160
/// <inheritdoc />
182161
public override string ToString()
183162
{

Flow.Launcher.Test/Plugins/JsonRPCPluginTest.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,5 @@ public async Task GivenVariousJsonText_WhenVariousNamingCase_ThenExpectNotNullRe
6363
})
6464
};
6565

66-
[TestCaseSource(typeof(JsonRPCPluginTest), nameof(ResponseModelsSource))]
67-
public async Task GivenModel_WhenSerializeWithDifferentNamingPolicy_ThenExpectSameResult_Async(JsonRPCQueryResponseModel reference)
68-
{
69-
var camelText = JsonSerializer.Serialize(reference, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
70-
71-
var pascalText = JsonSerializer.Serialize(reference);
72-
73-
var results1 = await QueryAsync(new Query { Search = camelText }, default);
74-
var results2 = await QueryAsync(new Query { Search = pascalText }, default);
75-
76-
Assert.IsNotNull(results1);
77-
Assert.IsNotNull(results2);
78-
79-
foreach (var ((result1, result2), referenceResult) in results1.Zip(results2).Zip(reference.Result))
80-
{
81-
Assert.AreEqual(result1, result2);
82-
Assert.AreEqual(result1, referenceResult);
83-
84-
Assert.IsNotNull(result1);
85-
Assert.IsNotNull(result1.AsyncAction);
86-
}
87-
}
88-
8966
}
9067
}

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
100100
<PackageReference Include="NHotkey.Wpf" Version="3.0.0" />
101101
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
102-
<PackageReference Include="SemanticVersioning" Version="3.0.0-beta2" />
102+
<PackageReference Include="SemanticVersioning" Version="3.0.0" />
103103
<PackageReference Include="VirtualizingWrapPanel" Version="2.1.0" />
104104
</ItemGroup>
105105

Flow.Launcher/Languages/de.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
<system:String x:Key="LastQueryPreserved">Letzte Abfrage beibehalten</system:String>
6666
<system:String x:Key="LastQuerySelected">Letzte Abfrage auswählen</system:String>
6767
<system:String x:Key="LastQueryEmpty">Letzte Abfrage leeren</system:String>
68-
<system:String x:Key="LastQueryActionKeywordPreserved">Preserve Last Action Keyword</system:String>
69-
<system:String x:Key="LastQueryActionKeywordSelected">Select Last Action Keyword</system:String>
68+
<system:String x:Key="LastQueryActionKeywordPreserved">Letztes Aktions-Schlüsselwort beibehalten</system:String>
69+
<system:String x:Key="LastQueryActionKeywordSelected">Letztes Aktions-Schlüsselwort auswählen</system:String>
7070
<system:String x:Key="KeepMaxResults">Feste Fensterhöhe</system:String>
7171
<system:String x:Key="KeepMaxResultsToolTip">Die Fensterhöhe ist durch Ziehen nicht anpassbar.</system:String>
7272
<system:String x:Key="maxShowResults">Maximal gezeigte Ergebnisse</system:String>

Flow.Launcher/Languages/es.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
<system:String x:Key="LastQueryPreserved">Mantener la última consulta</system:String>
6666
<system:String x:Key="LastQuerySelected">Seleccionar la última consulta</system:String>
6767
<system:String x:Key="LastQueryEmpty">Limpiar la última consulta</system:String>
68-
<system:String x:Key="LastQueryActionKeywordPreserved">Conservar palabra clave de última acción</system:String>
69-
<system:String x:Key="LastQueryActionKeywordSelected">Seleccionar palabra clave de última acción</system:String>
68+
<system:String x:Key="LastQueryActionKeywordPreserved">Conservar última palabra clave de acción</system:String>
69+
<system:String x:Key="LastQueryActionKeywordSelected">Seleccionar última palabra clave de acción</system:String>
7070
<system:String x:Key="KeepMaxResults">Altura de la ventana fija</system:String>
7171
<system:String x:Key="KeepMaxResultsToolTip">La altura de la ventana no se puede ajustar arrastrando el ratón.</system:String>
7272
<system:String x:Key="maxShowResults">Número máximo de resultados mostrados</system:String>

0 commit comments

Comments
 (0)