Fix touchscreen taps being dropped on custom Button widgets#10385
Open
tribixbite wants to merge 1 commit intobambulab:masterfrom
Open
Fix touchscreen taps being dropped on custom Button widgets#10385tribixbite wants to merge 1 commit intobambulab:masterfrom
tribixbite wants to merge 1 commit intobambulab:masterfrom
Conversation
Add a 15 px release-slop to the bounds check in mouseReleased on Button / AxisCtrlButton / SideButton / TabButton. Strict wxRect.Contains was silently swallowing every touchscreen tap because finger contact rolls between press and release, taking the up-coord outside the rect. The deliberate desktop drag-off-to-cancel gesture is preserved (any release further than 15 px outside still cancels). For consistency, the patch also wraps ReleaseMouse() in a HasCapture() guard for the two widgets (AxisCtrlButton, TabButton) that called it unconditionally — wxWidgets asserts in debug builds otherwise.
tribixbite
added a commit
to tribixbite/x2d
that referenced
this pull request
Apr 26, 2026
PR opened upstream at bambulab/BambuStudio#10385 with the slop- tolerance refinement from the pre-publish review (15 px Inflate instead of the original strict-bounds-removal). All 10 ledger items now checked. — Opus 4.7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix touchscreen taps being dropped on custom Button widgets
Symptom
On touchscreen / convertible / kiosk deployments, several custom-drawn
Bambu widgets silently drop taps:
Cancel/OK/Skipbuttons in many MsgDialog flowsSideButtonitems (Printer / Filament tabs etc.)AxisCtrlButtonjog directions on the device tabTabButtonpage-selectors inside settings panelsThe user sees the press indicator activate, lifts their finger, and
nothing happens. Native widgets like
wxButtonandwxNotebookaren'taffected in practice — presumably because the underlying GTK / native
hit regions are more lenient than the strict client-rect check used
here.
Root cause
All four custom Button widgets
(
src/slic3r/GUI/Widgets/Button.cpp,src/slic3r/GUI/Widgets/AxisCtrlButton.cpp,src/slic3r/GUI/Widgets/SideButton.cpp,src/slic3r/GUI/TabButton.cpp)fire their
wxEVT_COMMAND_BUTTON_CLICKEDevent inmouseReleasedonlyif the up-coords are still inside
wxRect({0,0}, GetSize()):Touch input doesn't deliver pixel-stable coords. Finger contact rolls
between press and release; the up-coord typically lands a few pixels
outside the rect. The strict bounds check then drops the click.
(Side note:
Button::mouseCaptureLostalready callsmouseReleasedwith a default-constructed
wxMouseEvent, whoseGetPosition()is{0,0}— andwxRect({0,0}, GetSize()).Contains({0,0})is true, sothe click currently fires on capture-loss anyway. The strict cancel-
on-drag-off behaviour was already only partially honoured.)
Fix
Add a small slop (
kReleaseSlop = 15px) to the bounds check onrelease. The deliberate desktop "drag off and release to cancel"
gesture is preserved (any release further than 15 px outside still
cancels), and touch users get the few pixels of grace they need.
For consistency, the patch also wraps
AxisCtrlButtonandTabButton'sReleaseMouse()call in aHasCapture()guard — wxWidgets asserts indebug builds if you call
ReleaseMouse()without holding capture, andthose two widgets were the only ones in this family doing so
unconditionally.
Net diff: +13, -8 across four files.
Discovery context
Found while making BambuStudio runnable on aarch64 Termux + termux-x11,
where touch input has slightly more finger drift than typical desktop
touchscreens. Full toolkit + the rest of the platform-specific patches
at https://github.com/tribixbite/x2d.