Commit Graph

134 Commits

Author SHA1 Message Date
khmyznikov
780abe199c add more details for API state 2026-06-16 16:43:55 -07:00
khmyznikov
4ce652945c Address PR review 2026-06-13 13:58:35 -07:00
khmyznikov
714da1ab92 add unlock status 2026-06-12 09:42:36 -07:00
khmyznikov
64071b7af0 add model prepare 2026-06-11 10:51:11 -07:00
khmyznikov
a2ee84f285 fix xaml warnings 2026-06-10 11:13:18 -07:00
Gleb Khmyznikov
e7e3db830f Merge branch 'main' into gleb/advanced-paste 2026-05-28 23:09:45 -07:00
Gordon Lam
85b9191b7c [AdvancedPaste] Harden ToJsonFromXmlOrCsvAsync against clipboard read failures (#48124)
## Summary

`ToJsonFromXmlOrCsvAsync` in `AdvancedPaste/Helpers/JsonHelper.cs`
documents that it never throws and returns an empty string on any
failure. The clipboard read at the top of the method
(`clipboardData.GetTextAsync()`) was not wrapped, so a transient
clipboard failure could surface as an exception to callers, contrary to
the documented contract.

This PR:

- Wraps `GetTextAsync()` in a try/catch and returns `string.Empty` on
failure, matching the pattern already used by the JSON/XML/CSV parsing
branches further down in the same method.
- Updates the matching unit test to decode input bytes as UTF-8
(`Encoding.UTF8.GetString(input)`) and consume the awaited task via
`GetAwaiter().GetResult()`, for consistency with sibling tests elsewhere
in the solution.

## Validation

- Local build of `AdvancedPaste.sln`. (Note: my machine has a
pre-existing NuGet SDK resolver issue unrelated to this change — the
same baseline fails on `main` for me. CI should be the source of truth.)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-26 10:59:24 +08:00
khmyznikov
020dd67316 Revert PRI to PowerToys.AdvancedPaste.pri: resources.pri breaks Settings
Having resources.pri in the shared WinUI3Apps directory causes Settings and QuickAccess to crash (.NET CLR exception) because MRT picks up AP's resources.pri as a fallback for other apps' resource loading. The earlier XamlParseException was actually caused by a stale/broken sparse identity registration (ExternalLocation pointing nowhere), not the PRI name — confirmed by reproducing the same crash with Settings launched from the same dev build. ImageResizer successfully uses a custom PRI name under sparse identity, so AP should too.
2026-05-20 15:59:00 -07:00
khmyznikov
c6176fb436 AdvancedPaste: revert PRI to resources.pri for XAML LoadComponent
WinUI's Application.LoadComponent hard-codes 'resources.pri' lookup under sparse identity (WinAppSDK 2.0.1). Custom PRI names work for ResourceLoader (explicit path) but not for the XAML framework's built-in ms-appx:/// URI resolution. Reverts ProjectPriFileName to resources.pri and downgrades the audit check from error to warning.
2026-05-20 14:58:19 -07:00
khmyznikov
0f7c3f70d3 AdvancedPaste: pass PRI filename to ResourceLoader explicitly
Under sparse identity, ResourceLoader() defaults to 'resources.pri' which doesn't exist (our PRI is PowerToys.AdvancedPaste.pri). This caused ERROR_MRM_MAP_NOT_FOUND (0x80073B01) crashing XAML's MeasureOverride. Match ImageResizer's pattern: new ResourceLoader('PowerToys.AdvancedPaste.pri').
2026-05-20 12:52:51 -07:00
khmyznikov
7a3539f6d8 Revert heat-based installer: AP is flat in WinUI3Apps like ImageResizer
AP on main already outputs flat to WinUI3Apps\ and is harvested by WinUI3ApplicationsFiles. Adding sparse identity (like ImageResizer) requires zero installer changes. Reverts the heat script, Product.wxs changes, and generateAllFileComponents.ps1 churn. Only non-main installer change is CmdPal.wxs fix (unrelated) and CmdPalPackagePath/Dir wixproj defines.
2026-05-20 10:58:23 -07:00
khmyznikov
f4ddb79707 Revert flatten: restore AP subfolder layout with heat harvest + ICE03 fix
Flattening AP into WinUI3Apps\ broke the installed build because the existing flat WinUI3ApplicationsFiles harvester doesn't recurse into subdirectories. AP's XBF files (AdvancedPasteXAML\), locale satellites, and arm64\ native DLLs were missing from the MSI. Restore the WinUI3Apps\AdvancedPaste\ subfolder layout with heat-based recursive harvest (like Monaco). Three CI fixes: 1) Language='0' on all heat File entries to prevent ICE03 on gd-GB/mi-NZ/ug-CN .mui files 2) ESRPSigning paths 3) Unique PRI name (PowerToys.AdvancedPaste.pri) passes audit.
2026-05-20 10:43:24 -07:00
khmyznikov
abcb77dea1 AdvancedPaste: rename ProjectPriFileName to PowerToys.AdvancedPaste.pri
After flattening AP into WinUI3Apps\, its 'resources.pri' collided with the WinUI3Apps root convention and tripped verifyPossibleAssetConflicts.ps1. Use the same per-module naming pattern as Settings/Peek/FileLocksmith/etc. The stale comment about sparse XAML needing 'resources.pri' was wrong -- Settings already runs sparse with PowerToys.Settings.pri.
2026-05-19 16:11:05 -07:00
khmyznikov
7da7a0b277 AdvancedPaste: flatten install layout to WinUI3Apps root
AP was the only WinUI3 module shipping into a WinUI3Apps\AdvancedPaste subfolder, which forced a separate heat-based harvest in the installer. Move output to WinUI3Apps\ alongside Settings/Hosts/Peek so the existing WinUI3ApplicationsFiles harvester + dedup/CreateWinAppSDKHardlinksCA path covers AP for free. Reverts the installer scaffolding (heat script, Product.wxs/wixproj edits, generateAllFileComponents.ps1 churn, CustomAction.cpp + WinUI3Applications.wxs hardlinks rollback) so the diff is back to what main does for every other unpackaged WinUI3 app. Also drops the stale subfolder reference in verify-installation-script.ps1 and the sparse AppxManifest Executable path.
2026-05-19 15:01:09 -07:00
khmyznikov
361959374b get back to sparse 2026-05-18 16:15:34 -07:00
khmyznikov
17a0533d08 fix ap tests 2026-05-11 22:36:57 -07:00
khmyznikov
ca7bc16b7a to prev 2026-05-10 14:24:15 -07:00
khmyznikov
7416209cc7 address PR review 2026-05-09 14:57:27 -07:00
Gleb Khmyznikov
3269de6172 Merge branch 'main' into gleb/advanced-paste 2026-05-08 14:30:55 -07:00
Jeremy Sinclair
05cd66c9bc [Dev][Build] .NET 10 Upgrade (#41280)
## Summary of the Pull Request
.NET 10 Upgrade. Requires Visual Studio 2026.


## PR Checklist

- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx


## Detailed Description of the Pull Request / Additional comments

- Upgraded target framework from `net9.0` to `net10.0` across all
projects
- Removed redundant package references now included by default in .NET
10
- Updated package versions to .NET 10 releases
- Modernized regex usage with source generators for better performance
- Added `vbcscompiler` to the spell-check allowlist
(`.github/actions/spell-check/expect.txt`)

## Validation Steps Performed

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent
pull requests. You can protect all pull requests by enabling Advanced
Security for your repositories. [Learn more about Advanced
Security.](https://gh.io/cca-advanced-security)

---------

Co-authored-by: Jeroen van Warmerdam <jeronevw@hotmail.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-04-30 14:40:43 +08:00
moooyo
dbc390ab0d fix: default 8 modules to disabled to match EnabledModules.cs (#47144)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Fixes a mismatch where 8 modules inherited the default
`is_enabled_by_default() = true` from `PowertoyModuleIface` while
`EnabledModules.cs` declared them `false`. On a clean install the Runner
would enable these modules on first launch, then Settings UI would flip
them back off once it persisted `settings.json` — a one-time visible
flicker and a DSC compliance gap.

Adds an explicit `is_enabled_by_default() const override { return false;
}` in the following module interfaces so both sides of the default
agree:

- `src/modules/launcher/Microsoft.Launcher/dllmain.cpp` (PowerToys Run)
- `src/modules/CropAndLock/CropAndLockModuleInterface/dllmain.cpp`
- `src/modules/AdvancedPaste/AdvancedPasteModuleInterface/dllmain.cpp`
- `src/modules/Hosts/HostsModuleInterface/dllmain.cpp`
- `src/modules/registrypreview/RegistryPreviewExt/dllmain.cpp`
-
`src/modules/EnvironmentVariables/EnvironmentVariablesModuleInterface/dllmain.cpp`
- `src/modules/Workspaces/WorkspacesModuleInterface/dllmain.cpp`
- `src/modules/powerdisplay/PowerDisplayModuleInterface/dllmain.cpp`

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 13:48:20 +00:00
Gordon Lam
befb5c672e Fix AdvancedPaste auto-copy failing on Electron/Chromium apps (#46486)
## Summary

Fixes #46485

AdvancedPaste's auto-copy feature fails on Electron/Chromium-based apps
(e.g. Microsoft Teams, VS Code, browsers) because `WM_COPY` is delivered
successfully but silently ignored by these apps.

## Problem

The auto-copy code sends `WM_COPY` via `SendMessageTimeout`. For
standard Win32 controls this works, but Electron apps accept the message
delivery without actually copying to clipboard. The code treated
successful delivery as success and **never fell back to `SendInput`
Ctrl+C**.

## Changes


**`src/modules/AdvancedPaste/AdvancedPasteModuleInterface/dllmain.cpp`**:

- **Changed retry logic**: Each attempt now tries both `WM_COPY` and
`SendInput` Ctrl+C. If `WM_COPY` is delivered but clipboard is
unchanged, it falls through to Ctrl+C instead of giving up.
- **Extracted `poll_clipboard_sequence()` helper**: Reusable clipboard
polling logic (checks `GetClipboardSequenceNumber` over N polls with
configurable delay).
- **Extracted `send_ctrl_c_input()` helper**: Sends Ctrl+C via
`SendInput` with `CENTRALIZED_KEYBOARD_HOOK_DONT_TRIGGER_FLAG`.
- **Improved logging**: Each strategy logs clearly whether it succeeded
or fell through, making future debugging easier.

## Validation

- [x] Manual testing with Microsoft Teams (Electron): auto-copy now
works for selected text
- [x] Standard Win32 apps (Notepad, etc.): `WM_COPY` still works on
first try, no regression
- [x] No new warnings or errors in build

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 10:49:40 +08:00
Clint Rutkas
4dfdf46e0d Fix WMC1506 XAML compiler warnings in AdvancedPaste (#46726)
## Summary

Fixes all 13 **WMC1506** XAML compiler warnings ("OneWay bindings
require at least one of their steps to support raising notifications
when their value changes") by changing \Mode=OneWay\ to \Mode=OneTime\
on \x:Bind\ expressions bound to non-observable properties.

## Details

**Root cause:** \PasteFormat\ (plain sealed class) and \ClipboardItem\
(plain class) do not implement \INotifyPropertyChanged\. Using
\Mode=OneWay\ on their properties creates subscriptions that will never
fire, generating WMC1506 warnings.

**Fix:** Changed to \Mode=OneTime\ which is semantically correct — these
properties are set once and never change after construction.

**Files changed:**
- \ClipboardHistoryItemPreviewControl.xaml\ — 2 bindings (\Header\,
\Timestamp\)
- \MainPage.xaml\ — 11 bindings across \PasteFormat\ and \ClipboardItem\
DataTemplates

**Note on ClipboardHistoryItemPreviewControl:** Its computed properties
(\Header\, \Timestamp\) are refreshed via \Bindings.Update()\ when the
\ClipboardItem\ DependencyProperty changes. \Bindings.Update()\ forces
re-evaluation of all \x:Bind\ bindings regardless of mode, so \OneTime\
works correctly here.

## Validation

- [x] Full solution build passes (exit code 0)
- [x] Zero WMC1506 warnings after changes (was 13 before)
- [x] No behavioral changes — only binding mode optimization

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-02 00:52:57 +02:00
Gleb Khmyznikov
822303a68c fix LAF tokens 2026-03-31 15:56:57 -07:00
Gleb Khmyznikov
68eb695626 maybe final fix? 2026-03-30 17:00:55 -07:00
Gleb Khmyznikov
d776b64a64 another thing 2026-03-30 14:41:20 -07:00
Gleb Khmyznikov
dbae67dfaa Fixing AP crash 2026-03-30 12:18:22 -07:00
Gleb Khmyznikov
d628d73e0b AP DisableTransitiveFrameworkReferences 2026-03-29 19:50:32 -07:00
Gleb Khmyznikov
3281c0e1a5 fix missing VCLibs 2026-03-27 23:17:18 -07:00
Gleb Khmyznikov
00bc7ec822 to prev 2 2026-03-27 14:01:20 -07:00
Gleb Khmyznikov
c43261f7cc keep fixing msix 2026-03-27 08:35:00 -07:00
Gleb Khmyznikov
ce8508ef97 fix ap vnext 2026-03-26 16:16:19 -07:00
Gleb Khmyznikov
9befd280a2 another try 3 2026-03-26 14:02:05 -07:00
Gleb Khmyznikov
7436b46fd6 another try 2 2026-03-26 13:18:36 -07:00
Gleb Khmyznikov
26bbfdeb8f another try 2026-03-26 11:14:23 -07:00
Gleb Khmyznikov
c46e6147b5 fix build 2026-03-26 10:32:02 -07:00
Gleb Khmyznikov
401ddcd95e move AP to packaged identity 2026-03-24 16:55:19 -07:00
gkhmyznikov
9f6d6b9cf2 Fix build 2026-03-23 16:34:54 -07:00
Gleb Khmyznikov
9421efe015 update readme 2026-03-21 22:44:53 -07:00
Gleb Khmyznikov
32ffd3a3b2 change workaround 2026-03-21 22:18:45 -07:00
Gleb Khmyznikov
a60eab4d03 add more params from sample 2026-03-21 14:44:46 -07:00
Gleb Khmyznikov
c2789d6080 launch hacks 2026-03-20 23:04:49 -07:00
Gleb Khmyznikov
8224062c3b add workaround 2026-03-19 17:04:56 -07:00
gkhmyznikov
dc1484549a Add LAF helper 2026-03-19 14:13:12 -07:00
gkhmyznikov
b5fc9fea78 Revert "WinAppSdk 2.0 try"
This reverts commit a25ce4ed02.
2026-03-19 13:47:03 -07:00
gkhmyznikov
a25ce4ed02 WinAppSdk 2.0 try 2026-03-19 12:31:28 -07:00
gkhmyznikov
f8b158659e Phi Silica not tested 2026-03-17 15:15:41 -07:00
gkhmyznikov
74eafb56b3 Custom models picker, default models picker 2026-03-12 16:13:15 -07:00
gkhmyznikov
1c78950d83 more improvements 2026-03-11 18:24:34 -07:00
gkhmyznikov
ecc93eaa33 more customization 2026-03-11 15:18:51 -07:00