Scale down MacOS scrolling from event controllers#20710
Open
dtorop wants to merge 1 commit intodarktable-org:masterfrom
Open
Scale down MacOS scrolling from event controllers#20710dtorop wants to merge 1 commit intodarktable-org:masterfrom
dtorop wants to merge 1 commit intodarktable-org:masterfrom
Conversation
MacOS trackpad scroll events appear to be of much greater magnitude than those on other systems. To make them usable, we need to scale down the scroll deltas. For traditional GTK 3 code, dt_gui_get_scroll_unit_deltas() took care of this. Unfortunately, this code depends on the "scroll-event" signal. To make the code GTK 4 ready, we need to handle the "scroll" signal generated by a GtkEventControllerScroll. For discrete scrolls, we can handle this transparently via the dt_gui_connect_scroll_discrete() setup function. This new function is similar to dt_gui_connect_scroll(). There is no need to call it with the GTK_EVENT_CONTROLLER_SCROLL_DISCRETE flag, as it adds this automatically. If darktable is compiled for MacOS, a proxy function will scale down the scroll events. Note that this commit doesn't do anything to help scale down scroll events from a non-discrete GtkEventControllerScroll. Also: In bauhaus _widget_scroll, actually warn if called an a non-scroll event or no event rather than having a useless NOP conditional. Don't free the event in unlikely case we can't retrieve it. Also: Update/remove a couple comments. In GTK4 it seems preferable to target events directly to widgets (as gtk_propagate_event and gtk_event_controller_handle_event are gone) so don't apologize in comments for using gtk_widget_event(). Fixes: darktable-org#20698
Collaborator
|
no decrease of sensitivity on sliders and also scope (color harmony rotation) with this fix |
Contributor
Author
|
@MStraeten: Drat! So it doesn't fix anything? Would you have time to add a bit of diagnostic code in and send the output when scrolling a slider? Something like: modified src/gui/gtk.c
@@ -4699,6 +4699,7 @@ static void _scroll_discrete_proxy(GtkEventControllerScroll* self,
gdouble dy,
_scroll_handler_proxy_t *h)
{
+ dt_print_ext("proxy dx %f dy %f cur_dx %f cur_dy %f", dx, dy, h->cur_dx, h->cur_dy);
// Even though the event controller has already accumulated smooth
// scroll events to discrete dx/dy, MacOS smooth scrolling events
// are too fast so scale them down via another accumulating stage.
@@ -4722,6 +4723,7 @@ static void _scroll_discrete_proxy(GtkEventControllerScroll* self,
h->cur_dy -= steps;
dy = steps;
}
+ dt_print_ext("smooth dx %f dy %f cur_dx %f cur_dy %f", dx, dy, h->cur_dx, h->cur_dy);
}
if(dx != 0.0 || dy != 0.0)
h->scroll_callback_real(self, dx, dy, h->scroll_data_real);I also realize there might be a slightly nicer way to implement this (only accumulate scrolling at the darktable level, not at the GTK level), but not material unless this actually works. |
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.
MacOS trackpad scroll events appear to be of much greater magnitude than those on other systems. To make them usable, we need to scale down the scroll deltas. For traditional GTK 3 code,
dt_gui_get_scroll_unit_deltas()took care of this. Unfortunately, this code depends on thescroll-eventsignal. To make the code GTK 4 ready, we need to handle thescrollsignal generated by aGtkEventControllerScroll.For discrete scrolls, we can handle this transparently via the
dt_gui_connect_scroll_discrete()setup function. This new function is similar todt_gui_connect_scroll(). There is no need to call it with theGTK_EVENT_CONTROLLER_SCROLL_DISCRETEflag, as it adds this automatically. If darktable is compiled for MacOS, a proxy function will scale down the scroll events.Note that this commit doesn't do anything to help scale down scroll events from a non-discrete
GtkEventControllerScroll.Also: In bauhaus
_widget_scroll(), actually warn if called an a non-scroll event or no event rather than having a useless NOP conditional. Don't free the event in unlikely case we can't retrieve it.Also: Update/remove a couple comments. In GTK4 it seems preferable to target events directly to widgets (as
gtk_propagate_eventandgtk_event_controller_handle_eventare gone) so don't apologize in comments for usinggtk_widget_event().Fixes: #20698
See #20701 for discussion