fix: palm rejection, eraser sizes, PDF thumbnails, even polygon strokes (Issues #37-#41)

- #41: snapped triangles, rectangles and polygons keep the full stroke width on every
  side; corners are mitered, sharp ones bevelled (the old corner offset thinned the edges)
- #38: four eraser sizes, cycled by a button below the eraser modes and remembered in
  ui.json
- #37: a selection made with the pen's select button can be moved with the bare pen
- #39: fingers resting on the screen when the pen comes near, or touching it while the pen
  is near (and 0.7 s after), are ignored until lifted; the vendored winit ignores touches
  on the title bar meanwhile
- #40: the page picker shows imported PDF pages, rendered small in the background

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
haraldandClaude Opus 5.5 committed 2026-10-21 15:06:39 +02:00
1 parent 31a57dc7a7
commit 2a06e2604a
11 files changed
+409 -45

No files matched your search

+3
View File
@@ -11,6 +11,9 @@ docs of the original crate were removed.
are now passed to the frame like a left click: close, minimize and maximize work with a
finger, and dragging the title bar moves the window (Issue #36). All changes are marked with
`ink-notes patch`.
- `src/platform/wayland.rs`: `ignore_decoration_touches_until` lets ink-notes ignore touches on
the title bar while the pen is near the screen, so a resting palm does not move the window
(Issue #39).
- `Cargo.toml`: `[lints.rust] warnings = "allow"`, because a path dependency is not built with
capped lints like a crates.io dependency.
+20
View File
@@ -8,6 +8,26 @@ use crate::platform_impl::{ApplicationName, Backend};
pub use crate::window::Theme;
/// ink-notes patch: touches on the client-side decorations that start before this instant
/// are ignored (palm rejection while a pen is near the screen); `None` accepts them.
static IGNORE_DECORATION_TOUCHES_UNTIL: std::sync::Mutex<Option<std::time::Instant>> =
std::sync::Mutex::new(None);
/// ink-notes patch: ignore touches on the client-side decorations until `until`.
pub fn ignore_decoration_touches_until(until: Option<std::time::Instant>) {
*IGNORE_DECORATION_TOUCHES_UNTIL
.lock()
.unwrap_or_else(|e| e.into_inner()) = until;
}
/// ink-notes patch: whether a touch on the decorations is ignored right now.
pub(crate) fn decoration_touches_ignored() -> bool {
IGNORE_DECORATION_TOUCHES_UNTIL
.lock()
.unwrap_or_else(|e| e.into_inner())
.is_some_and(|until| std::time::Instant::now() < until)
}
/// Additional methods on [`EventLoopWindowTarget`] that are specific to Wayland.
pub trait EventLoopWindowTargetExtWayland {
/// True if the [`EventLoopWindowTarget`] uses Wayland.
@@ -35,6 +35,10 @@ impl TouchHandler for WinitState {
.data::<SurfaceData>()
.and_then(|data| data.parent_surface().cloned());
if let Some(parent_surface) = parent_surface.filter(|parent| *parent != surface) {
// A palm resting on the title bar while writing must not move or close the window
if crate::platform::wayland::decoration_touches_ignored() {
return;
}
let window_id = wayland::make_wid(&parent_surface);
let mut window = match self.windows.get_mut().get_mut(&window_id) {
Some(window) => window.lock().unwrap(),