mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' into file_tooltip
This commit is contained in:
commit
407ad03bcb
6 changed files with 124 additions and 138 deletions
2
.github/ISSUE_TEMPLATE/bug-report.yaml
vendored
2
.github/ISSUE_TEMPLATE/bug-report.yaml
vendored
|
|
@ -16,6 +16,8 @@ body:
|
|||
I have checked that this issue has not already been reported.
|
||||
- label: >
|
||||
I am using the latest version of Flow Launcher.
|
||||
- label: >
|
||||
I am using the prerelease version of Flow Launcher.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
|
|
|
|||
35
.github/update_release_pr.py
vendored
35
.github/update_release_pr.py
vendored
|
|
@ -11,7 +11,7 @@ def get_github_prs(token: str, owner: str, repo: str, label: str = "", state: st
|
|||
token (str): GitHub token.
|
||||
owner (str): The owner of the repository.
|
||||
repo (str): The name of the repository.
|
||||
label (str): The label name.
|
||||
label (str): The label name. Filter is not applied when empty string.
|
||||
state (str): State of PR, e.g. open, closed, all
|
||||
|
||||
Returns:
|
||||
|
|
@ -89,7 +89,7 @@ def get_prs(pull_request_items: list[dict], label: str = "", state: str = "all")
|
|||
|
||||
Args:
|
||||
pull_request_items (list[dict]): List of PR items.
|
||||
label (str): The label name.
|
||||
label (str): The label name. Filter is not applied when empty string.
|
||||
state (str): State of PR, e.g. open, closed, all
|
||||
|
||||
Returns:
|
||||
|
|
@ -99,14 +99,36 @@ def get_prs(pull_request_items: list[dict], label: str = "", state: str = "all")
|
|||
pr_list = []
|
||||
count = 0
|
||||
for pr in pull_request_items:
|
||||
if pr["state"] == state and [item for item in pr["labels"] if item["name"] == label]:
|
||||
if state in [pr["state"], "all"] and (not label or [item for item in pr["labels"] if item["name"] == label]):
|
||||
pr_list.append(pr)
|
||||
count += 1
|
||||
|
||||
print(f"Found {count} PRs with {label if label else 'no'} label and state as {state}")
|
||||
print(f"Found {count} PRs with {label if label else 'no filter on'} label and state as {state}")
|
||||
|
||||
return pr_list
|
||||
|
||||
def get_prs_assignees(pull_request_items: list[dict], label: str = "", state: str = "all") -> list[str]:
|
||||
"""
|
||||
Returns a list of pull request assignees after applying the label and state filters, excludes jjw24.
|
||||
|
||||
Args:
|
||||
pull_request_items (list[dict]): List of PR items.
|
||||
label (str): The label name. Filter is not applied when empty string.
|
||||
state (str): State of PR, e.g. open, closed, all
|
||||
|
||||
Returns:
|
||||
list: A list of strs, where each string is an assignee name. List is not distinct, so can contain
|
||||
duplicate names.
|
||||
Returns an empty list if none are found.
|
||||
"""
|
||||
assignee_list = []
|
||||
for pr in pull_request_items:
|
||||
if state in [pr["state"], "all"] and (not label or [item for item in pr["labels"] if item["name"] == label]):
|
||||
[assignee_list.append(assignee["login"]) for assignee in pr["assignees"] if assignee["login"] != "jjw24" ]
|
||||
|
||||
print(f"Found {len(assignee_list)} assignees with {label if label else 'no filter on'} label and state as {state}")
|
||||
|
||||
return assignee_list
|
||||
|
||||
def get_pr_descriptions(pull_request_items: list[dict]) -> str:
|
||||
"""
|
||||
|
|
@ -208,6 +230,11 @@ if __name__ == "__main__":
|
|||
description_content += f"## Features\n{get_pr_descriptions(enhancement_prs)}" if enhancement_prs else ""
|
||||
description_content += f"## Bug fixes\n{get_pr_descriptions(bug_fix_prs)}" if bug_fix_prs else ""
|
||||
|
||||
assignees = list(set(get_prs_assignees(pull_requests, "enhancement", "closed") + get_prs_assignees(pull_requests, "bug", "closed")))
|
||||
assignees.sort(key=str.lower)
|
||||
|
||||
description_content += f"### Authors:\n{', '.join(assignees)}"
|
||||
|
||||
update_pull_request_description(
|
||||
github_token, repository_owner, repository_name, release_pr[0]["number"], description_content
|
||||
)
|
||||
|
|
|
|||
85
.github/workflows/default_plugins.yml
vendored
85
.github/workflows/default_plugins.yml
vendored
|
|
@ -3,11 +3,10 @@ name: Publish Default Plugins
|
|||
on:
|
||||
push:
|
||||
branches: ['master']
|
||||
paths: ['Plugins/**']
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
publish:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
|
|
@ -17,39 +16,24 @@ jobs:
|
|||
with:
|
||||
dotnet-version: 7.0.x
|
||||
|
||||
- name: Determine New Plugin Updates
|
||||
uses: dorny/paths-filter@v3
|
||||
id: changes
|
||||
with:
|
||||
filters: |
|
||||
browserbookmark:
|
||||
- 'Plugins/Flow.Launcher.Plugin.BrowserBookmark/plugin.json'
|
||||
calculator:
|
||||
- 'Plugins/Flow.Launcher.Plugin.Calculator/plugin.json'
|
||||
explorer:
|
||||
- 'Plugins/Flow.Launcher.Plugin.Explorer/plugin.json'
|
||||
pluginindicator:
|
||||
- 'Plugins/Flow.Launcher.Plugin.PluginIndicator/plugin.json'
|
||||
pluginsmanager:
|
||||
- 'Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json'
|
||||
processkiller:
|
||||
- 'Plugins/Flow.Launcher.Plugin.ProcessKiller/plugin.json'
|
||||
program:
|
||||
- 'Plugins/Flow.Launcher.Plugin.Program/plugin.json'
|
||||
shell:
|
||||
- 'Plugins/Flow.Launcher.Plugin.Shell/plugin.json'
|
||||
sys:
|
||||
- 'Plugins/Flow.Launcher.Plugin.Sys/plugin.json'
|
||||
url:
|
||||
- 'Plugins/Flow.Launcher.Plugin.Url/plugin.json'
|
||||
websearch:
|
||||
- 'Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json'
|
||||
windowssettings:
|
||||
- 'Plugins/Flow.Launcher.Plugin.WindowsSettings/plugin.json'
|
||||
base: 'master'
|
||||
- name: Update Plugins To Production Version
|
||||
run: |
|
||||
$version = "1.0.0"
|
||||
Get-Content appveyor.yml | ForEach-Object {
|
||||
if ($_ -match "version:\s*'(\d+\.\d+\.\d+)\.") {
|
||||
$version = $matches[1]
|
||||
}
|
||||
}
|
||||
|
||||
$jsonFiles = Get-ChildItem -Path ".\Plugins\*\plugin.json"
|
||||
foreach ($file in $jsonFiles) {
|
||||
$plugin_old_ver = Get-Content $file.FullName -Raw | ConvertFrom-Json
|
||||
(Get-Content $file) -replace '"Version"\s*:\s*".*?"', "`"Version`": `"$version`"" | Set-Content $file
|
||||
$plugin_new_ver = Get-Content $file.FullName -Raw | ConvertFrom-Json
|
||||
Write-Host "Updated" $plugin_old_ver.Name "version from" $plugin_old_ver.Version "to" $plugin_new_ver.Version
|
||||
}
|
||||
|
||||
- name: Get BrowserBookmark Version
|
||||
if: steps.changes.outputs.browserbookmark == 'true'
|
||||
id: updated-version-browserbookmark
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -57,14 +41,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build BrowserBookmark
|
||||
if: steps.changes.outputs.browserbookmark == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.BrowserBookmark"
|
||||
7z a -tzip "Flow.Launcher.Plugin.BrowserBookmark.zip" "./Flow.Launcher.Plugin.BrowserBookmark/*"
|
||||
rm -r "Flow.Launcher.Plugin.BrowserBookmark"
|
||||
|
||||
- name: Publish BrowserBookmark
|
||||
if: steps.changes.outputs.browserbookmark == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.BrowserBookmark"
|
||||
|
|
@ -76,7 +58,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get Calculator Version
|
||||
if: steps.changes.outputs.calculator == 'true'
|
||||
id: updated-version-calculator
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -84,14 +65,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build Calculator
|
||||
if: steps.changes.outputs.calculator == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.Calculator"
|
||||
7z a -tzip "Flow.Launcher.Plugin.Calculator.zip" "./Flow.Launcher.Plugin.Calculator/*"
|
||||
rm -r "Flow.Launcher.Plugin.Calculator"
|
||||
|
||||
- name: Publish Calculator
|
||||
if: steps.changes.outputs.calculator == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.Calculator"
|
||||
|
|
@ -103,7 +82,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get Explorer Version
|
||||
if: steps.changes.outputs.explorer == 'true'
|
||||
id: updated-version-explorer
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -111,14 +89,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build Explorer
|
||||
if: steps.changes.outputs.explorer == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.Explorer"
|
||||
7z a -tzip "Flow.Launcher.Plugin.Explorer.zip" "./Flow.Launcher.Plugin.Explorer/*"
|
||||
rm -r "Flow.Launcher.Plugin.Explorer"
|
||||
|
||||
- name: Publish Explorer
|
||||
if: steps.changes.outputs.explorer == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.Explorer"
|
||||
|
|
@ -130,7 +106,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get PluginIndicator Version
|
||||
if: steps.changes.outputs.pluginindicator == 'true'
|
||||
id: updated-version-pluginindicator
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -138,14 +113,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build PluginIndicator
|
||||
if: steps.changes.outputs.pluginindicator == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.PluginIndicator/Flow.Launcher.Plugin.PluginIndicator.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.PluginIndicator"
|
||||
7z a -tzip "Flow.Launcher.Plugin.PluginIndicator.zip" "./Flow.Launcher.Plugin.PluginIndicator/*"
|
||||
rm -r "Flow.Launcher.Plugin.PluginIndicator"
|
||||
|
||||
- name: Publish PluginIndicator
|
||||
if: steps.changes.outputs.pluginindicator == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.PluginIndicator"
|
||||
|
|
@ -157,7 +130,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get PluginsManager Version
|
||||
if: steps.changes.outputs.pluginsmanager == 'true'
|
||||
id: updated-version-pluginsmanager
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -165,14 +137,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build PluginsManager
|
||||
if: steps.changes.outputs.pluginsmanager == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.PluginsManager/Flow.Launcher.Plugin.PluginsManager.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.PluginsManager"
|
||||
7z a -tzip "Flow.Launcher.Plugin.PluginsManager.zip" "./Flow.Launcher.Plugin.PluginsManager/*"
|
||||
rm -r "Flow.Launcher.Plugin.PluginsManager"
|
||||
|
||||
- name: Publish PluginsManager
|
||||
if: steps.changes.outputs.pluginsmanager == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.PluginsManager"
|
||||
|
|
@ -184,7 +154,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get ProcessKiller Version
|
||||
if: steps.changes.outputs.processkiller == 'true'
|
||||
id: updated-version-processkiller
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -192,14 +161,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build ProcessKiller
|
||||
if: steps.changes.outputs.processkiller == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.ProcessKiller"
|
||||
7z a -tzip "Flow.Launcher.Plugin.ProcessKiller.zip" "./Flow.Launcher.Plugin.ProcessKiller/*"
|
||||
rm -r "Flow.Launcher.Plugin.ProcessKiller"
|
||||
|
||||
- name: Publish ProcessKiller
|
||||
if: steps.changes.outputs.processkiller == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.ProcessKiller"
|
||||
|
|
@ -211,7 +178,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get Program Version
|
||||
if: steps.changes.outputs.program == 'true'
|
||||
id: updated-version-program
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -219,14 +185,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build Program
|
||||
if: steps.changes.outputs.program == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj' --framework net7.0-windows10.0.19041.0 -c Release -o "Flow.Launcher.Plugin.Program"
|
||||
7z a -tzip "Flow.Launcher.Plugin.Program.zip" "./Flow.Launcher.Plugin.Program/*"
|
||||
rm -r "Flow.Launcher.Plugin.Program"
|
||||
|
||||
- name: Publish Program
|
||||
if: steps.changes.outputs.program == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.Program"
|
||||
|
|
@ -238,7 +202,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get Shell Version
|
||||
if: steps.changes.outputs.shell == 'true'
|
||||
id: updated-version-shell
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -246,14 +209,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build Shell
|
||||
if: steps.changes.outputs.shell == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.Shell"
|
||||
7z a -tzip "Flow.Launcher.Plugin.Shell.zip" "./Flow.Launcher.Plugin.Shell/*"
|
||||
rm -r "Flow.Launcher.Plugin.Shell"
|
||||
|
||||
- name: Publish Shell
|
||||
if: steps.changes.outputs.shell == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.Shell"
|
||||
|
|
@ -265,7 +226,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get Sys Version
|
||||
if: steps.changes.outputs.sys == 'true'
|
||||
id: updated-version-sys
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -273,14 +233,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build Sys
|
||||
if: steps.changes.outputs.sys == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.Sys"
|
||||
7z a -tzip "Flow.Launcher.Plugin.Sys.zip" "./Flow.Launcher.Plugin.Sys/*"
|
||||
rm -r "Flow.Launcher.Plugin.Sys"
|
||||
|
||||
- name: Publish Sys
|
||||
if: steps.changes.outputs.sys == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.Sys"
|
||||
|
|
@ -292,7 +250,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get Url Version
|
||||
if: steps.changes.outputs.url == 'true'
|
||||
id: updated-version-url
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -300,14 +257,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build Url
|
||||
if: steps.changes.outputs.url == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.Url"
|
||||
7z a -tzip "Flow.Launcher.Plugin.Url.zip" "./Flow.Launcher.Plugin.Url/*"
|
||||
rm -r "Flow.Launcher.Plugin.Url"
|
||||
|
||||
- name: Publish Url
|
||||
if: steps.changes.outputs.url == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.Url"
|
||||
|
|
@ -319,7 +274,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get WebSearch Version
|
||||
if: steps.changes.outputs.websearch == 'true'
|
||||
id: updated-version-websearch
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -327,14 +281,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build WebSearch
|
||||
if: steps.changes.outputs.websearch == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.WebSearch"
|
||||
7z a -tzip "Flow.Launcher.Plugin.WebSearch.zip" "./Flow.Launcher.Plugin.WebSearch/*"
|
||||
rm -r "Flow.Launcher.Plugin.WebSearch"
|
||||
|
||||
- name: Publish WebSearch
|
||||
if: steps.changes.outputs.websearch == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.WebSearch"
|
||||
|
|
@ -346,7 +298,6 @@ jobs:
|
|||
|
||||
|
||||
- name: Get WindowsSettings Version
|
||||
if: steps.changes.outputs.windowssettings == 'true'
|
||||
id: updated-version-windowssettings
|
||||
uses: notiz-dev/github-action-json-property@release
|
||||
with:
|
||||
|
|
@ -354,14 +305,12 @@ jobs:
|
|||
prop_path: 'Version'
|
||||
|
||||
- name: Build WindowsSettings
|
||||
if: steps.changes.outputs.windowssettings == 'true'
|
||||
run: |
|
||||
dotnet publish 'Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Launcher.Plugin.WindowsSettings.csproj' --framework net7.0-windows -c Release -o "Flow.Launcher.Plugin.WindowsSettings"
|
||||
7z a -tzip "Flow.Launcher.Plugin.WindowsSettings.zip" "./Flow.Launcher.Plugin.WindowsSettings/*"
|
||||
rm -r "Flow.Launcher.Plugin.WindowsSettings"
|
||||
|
||||
- name: Publish WindowsSettings
|
||||
if: steps.changes.outputs.windowssettings == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
repository: "Flow-Launcher/Flow.Launcher.Plugin.WindowsSettings"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ MONITORINFOEXW
|
|||
|
||||
WM_ENTERSIZEMOVE
|
||||
WM_EXITSIZEMOVE
|
||||
WM_NCLBUTTONDBLCLK
|
||||
WM_SYSCOMMAND
|
||||
|
||||
SC_MAXIMIZE
|
||||
SC_MINIMIZE
|
||||
|
||||
OleInitialize
|
||||
OleUninitialize
|
||||
|
|
|
|||
|
|
@ -324,6 +324,11 @@ namespace Flow.Launcher.Infrastructure
|
|||
|
||||
public const int WM_ENTERSIZEMOVE = (int)PInvoke.WM_ENTERSIZEMOVE;
|
||||
public const int WM_EXITSIZEMOVE = (int)PInvoke.WM_EXITSIZEMOVE;
|
||||
public const int WM_NCLBUTTONDBLCLK = (int)PInvoke.WM_NCLBUTTONDBLCLK;
|
||||
public const int WM_SYSCOMMAND = (int)PInvoke.WM_SYSCOMMAND;
|
||||
|
||||
public const int SC_MAXIMIZE = (int)PInvoke.SC_MAXIMIZE;
|
||||
public const int SC_MINIMIZE = (int)PInvoke.SC_MINIMIZE;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -465,6 +465,9 @@ namespace Flow.Launcher
|
|||
|
||||
private void OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
// When the window is maximized via Snap,
|
||||
// dragging attempts will first switch the window from Maximized to Normal state,
|
||||
// and adjust the drag position accordingly.
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
try
|
||||
|
|
@ -472,8 +475,8 @@ namespace Flow.Launcher
|
|||
if (WindowState == WindowState.Maximized)
|
||||
{
|
||||
// Calculate ratio based on maximized window dimensions
|
||||
double maxWidth = this.ActualWidth;
|
||||
double maxHeight = this.ActualHeight;
|
||||
double maxWidth = ActualWidth;
|
||||
double maxHeight = ActualHeight;
|
||||
var mousePos = e.GetPosition(this);
|
||||
double xRatio = mousePos.X / maxWidth;
|
||||
double yRatio = mousePos.Y / maxHeight;
|
||||
|
|
@ -486,7 +489,7 @@ namespace Flow.Launcher
|
|||
// Switch to Normal state
|
||||
WindowState = WindowState.Normal;
|
||||
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
Application.Current?.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
double normalWidth = Width;
|
||||
double normalHeight = Height;
|
||||
|
|
@ -535,83 +538,78 @@ namespace Flow.Launcher
|
|||
|
||||
#region Window WndProc
|
||||
|
||||
private const int WM_NCLBUTTONDBLCLK = 0x00A3;
|
||||
private const int WM_SYSCOMMAND = 0x0112;
|
||||
private const int SC_MAXIMIZE = 0xF030;
|
||||
private const int SC_RESTORE = 0xF120;
|
||||
private const int SC_MINIMIZE = 0xF020;
|
||||
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
if (msg == Win32Helper.WM_ENTERSIZEMOVE)
|
||||
{
|
||||
_initialWidth = (int)Width;
|
||||
_initialHeight = (int)Height;
|
||||
handled = true;
|
||||
}
|
||||
else if (msg == Win32Helper.WM_EXITSIZEMOVE)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
//Prevent updating the number of results when the window height is below the height of a single result item.
|
||||
//This situation occurs not only when the user manually resizes the window, but also when the window is released from a side snap, as the OS automatically adjusts the window height.
|
||||
//(Without this check, releasing from a snap can cause the window height to hit the minimum, resulting in only 2 results being shown.)
|
||||
if (_initialHeight != (int)Height && Height> (_settings.WindowHeightSize + _settings.ItemHeightSize))
|
||||
{
|
||||
if (!_settings.KeepMaxResults)
|
||||
case Win32Helper.WM_ENTERSIZEMOVE:
|
||||
_initialWidth = (int)Width;
|
||||
_initialHeight = (int)Height;
|
||||
handled = true;
|
||||
break;
|
||||
case Win32Helper.WM_EXITSIZEMOVE:
|
||||
//Prevent updating the number of results when the window height is below the height of a single result item.
|
||||
//This situation occurs not only when the user manually resizes the window, but also when the window is released from a side snap, as the OS automatically adjusts the window height.
|
||||
//(Without this check, releasing from a snap can cause the window height to hit the minimum, resulting in only 2 results being shown.)
|
||||
if (_initialHeight != (int)Height && Height > (_settings.WindowHeightSize + _settings.ItemHeightSize))
|
||||
{
|
||||
// Get shadow margin
|
||||
var shadowMargin = 0;
|
||||
var (_, useDropShadowEffect) = _theme.GetActualValue();
|
||||
if (useDropShadowEffect)
|
||||
if (!_settings.KeepMaxResults)
|
||||
{
|
||||
shadowMargin = 32;
|
||||
// Get shadow margin
|
||||
var shadowMargin = 0;
|
||||
var (_, useDropShadowEffect) = _theme.GetActualValue();
|
||||
if (useDropShadowEffect)
|
||||
{
|
||||
shadowMargin = 32;
|
||||
}
|
||||
|
||||
// Calculate max results to show
|
||||
var itemCount = (Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize;
|
||||
if (itemCount < 2)
|
||||
{
|
||||
_settings.MaxResultsToShow = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
_settings.MaxResultsToShow = Convert.ToInt32(Math.Truncate(itemCount));
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate max results to show
|
||||
var itemCount = (Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize;
|
||||
if (itemCount < 2)
|
||||
{
|
||||
_settings.MaxResultsToShow = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
_settings.MaxResultsToShow = Convert.ToInt32(Math.Truncate(itemCount));
|
||||
}
|
||||
SizeToContent = SizeToContent.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update height when exiting maximized snap state.
|
||||
SizeToContent = SizeToContent.Height;
|
||||
}
|
||||
|
||||
SizeToContent = SizeToContent.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update height when exiting maximized snap state.
|
||||
SizeToContent = SizeToContent.Height;
|
||||
}
|
||||
|
||||
if (_initialWidth != (int)Width)
|
||||
{
|
||||
if (!_settings.KeepMaxResults)
|
||||
if (_initialWidth != (int)Width)
|
||||
{
|
||||
// Update width
|
||||
_viewModel.MainWindowWidth = Width;
|
||||
if (!_settings.KeepMaxResults)
|
||||
{
|
||||
// Update width
|
||||
_viewModel.MainWindowWidth = Width;
|
||||
}
|
||||
|
||||
SizeToContent = SizeToContent.Height;
|
||||
}
|
||||
|
||||
SizeToContent = SizeToContent.Height;
|
||||
}
|
||||
|
||||
handled = true;
|
||||
}
|
||||
if (msg == WM_NCLBUTTONDBLCLK)
|
||||
{
|
||||
SizeToContent = SizeToContent.Height;
|
||||
handled = true;
|
||||
}
|
||||
else if (msg == WM_SYSCOMMAND)
|
||||
{
|
||||
int command = wParam.ToInt32() & 0xFFF0;
|
||||
if (command == SC_MAXIMIZE || command == SC_MINIMIZE)
|
||||
{
|
||||
handled = true;
|
||||
break;
|
||||
case Win32Helper.WM_NCLBUTTONDBLCLK: // Block the double click in frame
|
||||
SizeToContent = SizeToContent.Height;
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
case Win32Helper.WM_SYSCOMMAND: // Block Maximize/Minimize by Win+Up and Win+Down Arrow
|
||||
var command = wParam.ToInt32() & 0xFFF0;
|
||||
if (command == Win32Helper.SC_MAXIMIZE || command == Win32Helper.SC_MINIMIZE)
|
||||
{
|
||||
SizeToContent = SizeToContent.Height;
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue