Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Tablet mouse mode: ignore a system cursor that stays put while the pen moves (#72, 0.10.7 regression on Windows)

islandmed406c5397eb9b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f29c9447..0ce6b68f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,11 @@ All notable changes to SculptForge are listed here. The format follows
## [Unreleased]
+### Fixed
+- Tablet Mouse mode (Preferences > Tablet): on some Windows tablets the brush stopped following the pen in 0.10.7,
+ because the system cursor reading stayed put while the pen moved. A reading that doesn't move with the pen is now
+ ignored and the pen moves the brush relatively, from where it was, with no jump (#72).
+
## [0.10.7] - 2026-11-01
### Changed
diff --git a/docs/guide/whats-new.md b/docs/guide/whats-new.md
index 83a50cb8..d8920df6 100644
--- a/docs/guide/whats-new.md
+++ b/docs/guide/whats-new.md
@@ -5,6 +5,12 @@ chapter opens by itself the first time you start a new version; you can always f
**Help > What's New**. Every detail is in the
[changelog](https://github.com/islandmed/SculptForge/blob/main/CHANGELOG.md).
+## Version 0.10.8
+
+- **Tablets in mouse mode work again**: on some Windows tablets with **Mouse mode** on (Preferences > Tablet) the
+ brush stopped following the pen in 0.10.7. When the system can't say where its cursor is, the pen now moves the
+ brush by how far it moves, from where it was (#72).
+
## Version 0.10.7
- **A clearer membership card**: the three memberships side by side with what each one gets you, in your look's
diff --git a/src/core/Tablet.cpp b/src/core/Tablet.cpp
index 3a10b8f7..46ecc2ec 100644
--- a/src/core/Tablet.cpp
+++ b/src/core/Tablet.cpp
@@ -121,8 +121,22 @@ void PenCursor::systemCursor(float x, float y) {
void PenCursor::map(float& x, float& y, uint64_t nowNs) {
if (!std::isfinite(x) || !std::isfinite(y)) return;
- const bool system = haveSystem_;
+ bool system = haveSystem_;
haveSystem_ = false; // (one reading per position)
+ if (mouseMode && system && !systemStale_) {
+ if (haveLast_) {
+ const bool penMoved = std::fabs(x - lastPenX_) + std::fabs(y - lastPenY_) > 2.0f;
+ const bool systemStill = std::fabs(systemX_ - lastSysX_) + std::fabs(systemY_ - lastSysY_) < 0.5f;
+ staleCount_ = penMoved && systemStill ? staleCount_ + 1 : (penMoved ? 0 : staleCount_);
+ if (staleCount_ >= 3) systemStale_ = true;
+ }
+ lastPenX_ = x;
+ lastPenY_ = y;
+ lastSysX_ = systemX_;
+ lastSysY_ = systemY_;
+ haveLast_ = true;
+ }
+ if (systemStale_) system = false;
if (mouseMode && system) {
// The system cursor is the one cursor; the pen only adds pressure and tilt. Should the system stop
// saying where it is, the pen carries on from here.
diff --git a/src/core/Tablet.h b/src/core/Tablet.h
index 667f9c5f..29b655e9 100644
--- a/src/core/Tablet.h
+++ b/src/core/Tablet.h
@@ -101,7 +101,11 @@ public:
bool mouseMode = false;
// The pen came into range or left it: in mouse mode its next position moves the cursor from where it is.
- void proximity() { anchored_ = false; }
+ void proximity() {
+ anchored_ = false;
+ systemStale_ = false;
+ staleCount_ = 0;
+ }
// Something else (the mouse) moved the cursor to x, y.
void cursorAt(float x, float y);
// Where the system cursor is (window pixels), read just before the next map(). In mouse mode the driver moves
@@ -118,6 +122,11 @@ private:
float cursorX_ = 0.0f, cursorY_ = 0.0f;
float systemX_ = 0.0f, systemY_ = 0.0f;
bool haveCursor_ = false, anchored_ = false, haveSystem_ = false;
+ // A system cursor that stays put while the pen moves (seen on Windows tablets in 0.10.7: the brush froze) is
+ // not the cursor: the pen moves the cursor relatively until it comes back into range.
+ float lastPenX_ = 0.0f, lastPenY_ = 0.0f, lastSysX_ = 0.0f, lastSysY_ = 0.0f;
+ bool haveLast_ = false, systemStale_ = false;
+ int staleCount_ = 0;
uint64_t lastNs_ = 0;
};
diff --git a/tests/test_tablet.cpp b/tests/test_tablet.cpp
index 8b3c0bae..0fe72722 100644
--- a/tests/test_tablet.cpp
+++ b/tests/test_tablet.cpp
@@ -202,6 +202,37 @@ TEST(pen_cursor_mouse_mode_follows_the_system_cursor) {
CHECK(near(x, 50.0f) && near(y, 60.0f));
}
+TEST(pen_cursor_mouse_mode_ignores_a_frozen_system_cursor) {
+ // 0.10.7 on Windows (#72 follow-up): the system cursor reading stayed put while the pen moved, so the brush
+ // froze. After a few such positions the pen moves the cursor relatively, on from where it was, with no jump.
+ sf::PenCursor c;
+ c.mouseMode = true;
+ float x = 100.0f, y = 100.0f;
+ c.systemCursor(400.0f, 300.0f);
+ c.map(x, y, 1000);
+ CHECK(near(x, 400.0f) && near(y, 300.0f));
+ float px = 100.0f;
+ for (int i = 1; i <= 6; ++i) {
+ px += 10.0f;
+ x = px;
+ y = 100.0f;
+ c.systemCursor(400.0f, 300.0f); // frozen
+ c.map(x, y, 1000 + uint64_t(i) * 1000000);
+ }
+ CHECK(x > 420.0f); // moving again, by the pen's motion
+ CHECK(near(y, 300.0f));
+ // A moving system cursor is still followed (the usual case).
+ sf::PenCursor d;
+ d.mouseMode = true;
+ for (int i = 0; i < 6; ++i) {
+ x = 100.0f + 10.0f * float(i);
+ y = 100.0f;
+ d.systemCursor(400.0f + 7.0f * float(i), 300.0f);
+ d.map(x, y, uint64_t(i + 1) * 1000000);
+ CHECK(near(x, 400.0f + 7.0f * float(i)));
+ }
+}
+
TEST(tablet_settings_mouse_mode_round_trip) {
TabletSettings t;
CHECK(!t.mouseMode);
diff --git a/tests/ui/whats_new.sfui b/tests/ui/whats_new.sfui
index 6b70eb9d..00f448de 100644
--- a/tests/ui/whats_new.sfui
+++ b/tests/ui/whats_new.sfui
@@ -5,6 +5,8 @@ click "Help##palette.help"
click "What's New##help.whats_new"
expect_value guide_open == 1
expect_guide whats-new.md
+expect_text "Version 0.10.8"
+expect_text "Tablets in mouse mode work again"
expect_text "Version 0.10.7"
expect_text "A new look"
expect_text "Version 0.10.6"