Skip to content

Conversation

@dterrahe
Copy link
Member

This is a first step "backport" from #19448, partly to test if the conversion to gestures, needed for gtk4, could be executed already under gtk3. New helper functions are introduced to connect handlers to click and motion event controllers:

  • dt_gui_connect_click (for mouse button press and release)
  • dt_gui_connect_motion (for mouse move, widget enter and leave)

These macros do function signature validation, so at least for these it will no longer be possible to connect functions with the wrong number/type of parameters or return value to a signal.

The mouse scroll event controller is not used; it was backported to gtk3 as well, but different from gtk4 it does not use a gboolean return to indicate if the scroll has been handled. So would have to be changed (back) again on final porting. Not much point.

Since we pass through mouse drags from the histogram module to bauhaus widgets (expose and black level), that widget has been transitioned as well.

This exercise ran into some interesting consequences of mixing event controllers and handling events directly, the old gtk3 way. The way events are propagated and stopped from doing so has changed. So for example to avoid the notebook header from also processing a double-click, after a bauhaus received it, we have to test if it was directly delivered to the notebook or propagated. Otherwise double-clicking on a slider in colorbalance rgb will reset the whole page. These workarounds partially won't be needed in gtk4 and anyway would not work in the same way. So a full conversion in gtk3 now seems tedious and worthless.

This opportunity was used to thoroughly clean up bauhaus and its header:

  • widget data was made private, only accessible via function calls. Modules that directly changed internals were fixed.
  • the calculation of the size of the slider area (for drawing and manipulating) was simplified and made more readable.
  • this made it trivial to show the hovered value in the tooltip. So the user can know before clicking exactly what value will be set, without having to type a value in the popup, and what the range is without clicking on both extremes.

The click gesture sends a "stopped" signal once it is clear that we are not dealing with a double-click. This was used to slightly delay updating on first click just in case a user wanted to double-click and reset. In the past this used to trigger two recalculations; now only one (or none, if we are already at the default value). It may also avoid double calcs for pen or touchscreen users, but I can't verify. Of course at the cost of a slight delay in response to a click. Scrolls and drags are not affected and are as responsive as before. Feedback welcome.

@dterrahe dterrahe added priority: medium core features are degraded in a way that is still mostly usable, software stutters scope: UI user interface and interactions scope: codebase making darktable source code easier to manage gtk4 labels Oct 16, 2025
For shorter field references.
Make label dynamically allocated rather than fixed length.
@TurboGit TurboGit added this to the 5.4 milestone Oct 19, 2025
Copy link
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, tested as much as I could. Works fine on my side.

@TurboGit TurboGit merged commit b39d03b into darktable-org:master Oct 19, 2025
5 checks passed
@dterrahe dterrahe mentioned this pull request Oct 26, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gtk4 priority: medium core features are degraded in a way that is still mostly usable, software stutters scope: codebase making darktable source code easier to manage scope: UI user interface and interactions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants