Skip to content

lighttable: don't let a cancelled gesture re-select the hovered image - #21825

Closed
Arecsu wants to merge 1 commit into
darktable-org:masterfrom
Arecsu:fix/21813-gesture-cancel-release
Closed

lighttable: don't let a cancelled gesture re-select the hovered image#21825
Arecsu wants to merge 1 commit into
darktable-org:masterfrom
Arecsu:fix/21813-gesture-cancel-release

Conversation

@Arecsu

@Arecsu Arecsu commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #21813 — hovering over the thumbtable after returning from the darkroom changed the selected image. Move the mouse over an unselected thumbnail and the selection jumped to it, even with "prioritize hovered image over the selected images" disabled.

This was a regression from the event-signal → event-controller conversion (#21659), which changed how a click is delivered to the lighttable and culling views:

  • Hovering could fake a click. The old button-release-event handler only ever ran on a real mouse-button release. The gesture machinery relays a cancelled press to the release handler so widgets can let go of their pressed state — the bauhaus sliders rely on that relay. But a press whose release never arrives (e.g. the second press of a double-click, which jumps to the darkroom on press) leaves a stale press behind, and the next pointer crossing into a thumbnail cancels it. The relayed release then ran the thumbtable's click logic and re-selected whatever image happened to be under the cursor.
  • The culling view had the same problem and gets the same fix: a relayed release could silently toggle the culling selection while the pointer was just moving.

The release handlers now require a real GDK_BUTTON_RELEASE — the same guarantee the old signal-based handlers had — while the cancel→release relay stays for the pressed-state cleanup it was added for.

No behavior changes for actual clicks: single-click selection, double-click into the darkroom, and zoomable dragging all work as before.

Related: #21813 #21659

…lling

The event-controller migration converted the thumbtable's
button-release-event signal to a GtkGestureMultiPress and inherited the
cancel->release bridge: on every gesture cancel the bridge fakes a
released(1,0,0), and the release handler interpreted that as a click.

A cancel is not a click: GTK3 cancels gestures on grab-notify/controller
resets, and a press whose release never arrived (e.g. the second press of
a double-click that switched to darkroom on press) keeps a stale point in
the gesture that a later hover crossing can cancel.  Moving the mouse
over the lighttable thumbtable then silently ran select_single() on the
hovered image (issue darktable-org#21813).

Restore the pre-gesture semantics: the release handler only acts on a
real GDK button release -- exactly what the old button-release-event
handler received -- while the cancel->release relay stays for the
pressed-state cleanup the bauhaus handlers rely on.
@TurboGit TurboGit added this to the 5.8 milestone Aug 14, 2026
@TurboGit TurboGit added bugfix pull request fixing a bug gtk4 labels Aug 14, 2026
Comment thread src/dtgtk/culling.c
Comment thread src/dtgtk/thumbtable.c
@TurboGit

Copy link
Copy Markdown
Member

@Arecsu : Given the amount of work you're doing I'll be happy to do the change I proposed above. Just let me know.

@Arecsu

Arecsu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@Arecsu : Given the amount of work you're doing I'll be happy to do the change I proposed above. Just let me know.

Please feel always free to do it, in all seriousness, I'm trying my best keeping up with life, bugfixes and gtk4 improvements that I'm out of hands. So please, don't even ask for permission!

@TurboGit

Copy link
Copy Markdown
Member

Manually merged with minor code simplification.

@TurboGit TurboGit closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug gtk4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lighttable selected image regression on return from darkroom

2 participants