2 Commits
Author SHA1 Message Date
rogierandCursor 9b9ac36261 1.1.2
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-09 00:38:41 +01:00
rogier ceec9ecdc0 Toon alleen de laatste versie. 2026-11-09 00:26:57 +01:00
7 changed files with 129 additions and 9 deletions

No files matched your search

+6
View File
@@ -2,6 +2,12 @@
Alle noemenswaardige wijzigingen in kniip staan in dit bestand. De nieuwste versie staat bovenaan. Alle noemenswaardige wijzigingen in kniip staan in dit bestand. De nieuwste versie staat bovenaan.
## 1.1.2 - 2026-11-09
### Opgelost
- **Link kopiëren na uploaden.** Na het uploaden kon kniip de link soms niet op het klembord zetten en meldde dan dat het klembord bezet was. Dat gebeurde vooral als de klembordgeschiedenis van Windows (Win+V) of een ander klembordprogramma actief is. kniip zet de link nu op een directere manier op het klembord en probeert het langer opnieuw. Dit geldt ook voor het uploaden van screencasts en de test-upload in de instellingen.
## 1.1.1 - 2026-11-09 ## 1.1.1 - 2026-11-09
### Gewijzigd ### Gewijzigd
+5 -6
View File
@@ -24,10 +24,9 @@ kniip is een annotatie-editor die naast het Windows Knipprogramma werkt. Maak ee
| Versie | Installer | | Versie | Installer |
| ------ | --------- | | ------ | --------- |
| Nieuwste versie | [Alle releases](https://git.hibbit.net/rogier/kniip/releases) | | 1.1.2 | [Kniip-Setup-1.1.2.exe](https://git.hibbit.net/rogier/kniip/releases/download/1.1.2/Kniip-Setup-1.1.2.exe) |
| 1.1.1 | [Kniip-Setup-1.1.1.exe](https://git.hibbit.net/rogier/kniip/releases/download/1.1.1/Kniip-Setup-1.1.1.exe) |
| 1.1.0 | [Kniip-Setup-1.1.0.exe](https://git.hibbit.net/rogier/kniip/releases/download/1.1.0/Kniip-Setup-1.1.0.exe) | Oudere versies vind je bij [alle releases](https://git.hibbit.net/rogier/kniip/releases).
| 1.0.0 | [Kniip-Setup-1.0.0.exe](https://git.hibbit.net/rogier/kniip/releases/download/1.0/Kniip-Setup-1.0.0.exe) |
## Installeren ## Installeren
@@ -71,7 +70,7 @@ Vereisten:
Bouwen: Bouwen:
```powershell ```powershell
.\build.ps1 # versie 1.1.1 .\build.ps1 # versie 1.1.2
.\build.ps1 -Version 1.2.0 # andere versie .\build.ps1 -Version 1.2.0 # andere versie
``` ```
@@ -86,7 +85,7 @@ Het script levert op:
1. Bouw met `.\build.ps1 -Version <versie>`. 1. Bouw met `.\build.ps1 -Version <versie>`.
2. Maak op [git.hibbit.net](https://git.hibbit.net/rogier/kniip/releases) een release met tag `v<versie>` en voeg `artifacts\Kniip-Setup-<versie>.exe` toe als bijlage. 2. Maak op [git.hibbit.net](https://git.hibbit.net/rogier/kniip/releases) een release met tag `v<versie>` en voeg `artifacts\Kniip-Setup-<versie>.exe` toe als bijlage.
3. Schrijf de wijzigingen in markdown in de beschrijving van de release. kniip toont die als changelog onder **Instellingen > Update**. 3. Schrijf de wijzigingen in markdown in de beschrijving van de release. kniip toont die als changelog onder **Instellingen > Update**.
4. Voeg de nieuwe versie toe aan de tabel onder [Downloaden](#downloaden). 4. Vervang de versie en de link in de tabel onder [Downloaden](#downloaden) door de nieuwe versie.
### Updaten vanuit kniip ### Updaten vanuit kniip
+1 -1
View File
@@ -7,7 +7,7 @@
# .\build.ps1 -Version 1.2.0 # .\build.ps1 -Version 1.2.0
param( param(
[string]$Version = "1.1.1", [string]$Version = "1.1.2",
[string]$Runtime = "win-x64" [string]$Runtime = "win-x64"
) )
+1 -1
View File
@@ -5,7 +5,7 @@
#define AppName "kniip" #define AppName "kniip"
#define AppExe "Kniip.exe" #define AppExe "Kniip.exe"
#ifndef AppVersion #ifndef AppVersion
#define AppVersion "1.1.1" #define AppVersion "1.1.2"
#endif #endif
#ifndef PublishDir #ifndef PublishDir
#define PublishDir "..\artifacts\publish" #define PublishDir "..\artifacts\publish"
+84
View File
@@ -4,9 +4,11 @@ using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using Kniip.Capture; using Kniip.Capture;
using Kniip.Interop;
namespace Kniip.Editor; namespace Kniip.Editor;
@@ -68,13 +70,95 @@ internal static class ClipboardWriter
return TrySet(data); return TrySet(data);
} }
/// <summary>
/// Tekst gaat rechtstreeks via Win32 op het klembord. De OLE-route van WPF moet het klembord
/// daarna nog leegspoelen, en dat mislukt zodra een klembordbeheerder het meteen opent.
/// </summary>
public static bool SetText(string text) public static bool SetText(string text)
{ {
if (TrySetUnicodeText(text))
{
return true;
}
var data = new DataObject(); var data = new DataObject();
data.SetText(text); data.SetText(text);
return TrySet(data); return TrySet(data);
} }
private static HwndSource? _owner;
private static IntPtr OwnerHandle
{
get
{
// Een venster als eigenaar is verplicht: zonder eigenaar weigert SetClipboardData na EmptyClipboard.
_owner ??= new HwndSource(new HwndSourceParameters("KniipClipboardWriter")
{
ParentWindow = NativeMethods.HWND_MESSAGE,
WindowStyle = 0
});
return _owner.Handle;
}
}
private static bool TrySetUnicodeText(string text)
{
IntPtr owner = OwnerHandle;
for (int attempt = 0; attempt < 20; attempt++)
{
if (NativeMethods.OpenClipboard(owner))
{
try
{
return NativeMethods.EmptyClipboard() && PutUnicodeText(text);
}
finally
{
NativeMethods.CloseClipboard();
}
}
Thread.Sleep(50);
}
return false;
}
private static bool PutUnicodeText(string text)
{
IntPtr handle = NativeMethods.GlobalAlloc(NativeMethods.GMEM_MOVEABLE, (UIntPtr)((text.Length + 1) * 2));
if (handle == IntPtr.Zero)
{
return false;
}
IntPtr target = NativeMethods.GlobalLock(handle);
if (target == IntPtr.Zero)
{
NativeMethods.GlobalFree(handle);
return false;
}
try
{
Marshal.Copy(text.ToCharArray(), 0, target, text.Length);
Marshal.WriteInt16(target, text.Length * 2, 0);
}
finally
{
NativeMethods.GlobalUnlock(handle);
}
if (NativeMethods.SetClipboardData(NativeMethods.CF_UNICODETEXT, handle) == IntPtr.Zero)
{
NativeMethods.GlobalFree(handle);
return false;
}
return true;
}
private static bool TrySet(DataObject data) private static bool TrySet(DataObject data)
{ {
for (int attempt = 0; attempt < 5; attempt++) for (int attempt = 0; attempt < 5; attempt++)
+31
View File
@@ -26,6 +26,37 @@ internal static class NativeMethods
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern uint GetClipboardSequenceNumber(); public static extern uint GetClipboardSequenceNumber();
public const uint CF_UNICODETEXT = 13;
public const uint GMEM_MOVEABLE = 0x0002;
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool OpenClipboard(IntPtr hWndNewOwner);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CloseClipboard();
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EmptyClipboard();
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SetClipboardData(uint format, IntPtr hMem);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GlobalAlloc(uint flags, UIntPtr bytes);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GlobalLock(IntPtr hMem);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GlobalUnlock(IntPtr hMem);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GlobalFree(IntPtr hMem);
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId); public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
+1 -1
View File
@@ -18,7 +18,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<Product>kniip</Product> <Product>kniip</Product>
<Description>Annotatie-editor naast het Windows Knipprogramma</Description> <Description>Annotatie-editor naast het Windows Knipprogramma</Description>
<Version>1.1.1</Version> <Version>1.1.2</Version>
<SatelliteResourceLanguages>nl;en</SatelliteResourceLanguages> <SatelliteResourceLanguages>nl;en</SatelliteResourceLanguages>
<!-- WPF regelt DPI via app.manifest; de WinForms-analyzer is hier niet van toepassing. --> <!-- WPF regelt DPI via app.manifest; de WinForms-analyzer is hier niet van toepassing. -->
<NoWarn>$(NoWarn);WFAC010</NoWarn> <NoWarn>$(NoWarn);WFAC010</NoWarn>