New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix smooth scrolling on macOS #7904
Conversation
Can you tell where the formula comes from or how it was created? |
I was just trying to fit input to the expectation that scrolling happens when 1 is returned. I have no spesific information on what values from event->delta_x represent. It is a general mapping between ranges. https://stackoverflow.com/questions/5731863/mapping-a-numeric-range-onto-another |
I'm asking, because Beep6581/RawTherapee#5599 issue you linked in #6068 got resolved differently: Beep6581/RawTherapee#5607 |
I didn't underestand the RawTherapee solution completely but I think they use event->delta_x somehow differently. The way I underestand dt_gui_get_scroll_unit_deltas() is designed to work is that it sets *delta_x to 1 or -1 when multiple smaller values from event->delta_x accumulate to 1 or -1. Thumbtable is then moved by one row. On macOS event->delta_x is a lot larger than 1. So scrolling is too fast. |
this fix doesn't improve the scroll behaviour in lighttable filemanager on a magic mouse or trackpad. It's very hard to scroll just one row - one little movement and you've jumped over 20 rows ... |
after adding some debug messages in the code indicates the get_scroll functions are never used for the scrollbars of the filemanager/thumbtable in lighttable |
dt_gui_get_scroll_unit_delta() is called in src/dtgtk/thumbtable.c on line 893. Am I underestanding the functionality of _event_scroll() incorrectly? |
gtk.c line 695:
The debug message isn't printed when having scrollbars for central view in lighttable and darkroom activated in preferences and scrolling while having them in focus. |
src/gui/gtk.c
Outdated
@@ -654,8 +654,13 @@ gboolean dt_gui_get_scroll_unit_deltas(const GdkEventScroll *event, int *delta_x | |||
// accumulate trackpad/touch scrolls until they make a unit | |||
// scroll, and only then tell caller that there is a scroll to | |||
// handle | |||
#ifdef GDK_WINDOWING_QUARTZ // on macOS deltas need to be scaled | |||
acc_x += (2.0 / 300.0) * (event->delta_x + 150) - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a drawback to simplifying this to
acc_x += event->delta_x / 150.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The range should be symmetrical around 0 so simplifying works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after using this a couple of days if find the divisor 150 makes the ui very laggy - i found a value of 50 being more responsive but not too fast (at least for my old magic mouse)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. It is better to use the smaller value. It is still possible to scroll by one row.
In this case it seems that scroll distance comes directly from GtkScrollbar widget in scrollbar_changed() (gtk.c line 871). Scroll events are not handled directly so same fix is not possible. |
to get this stuff done: |
I would still like to know how well rawtherapee solution (copied from GTK) works. Which is it seems just replacing |
@parafin I'm not sure I understand your question, so maybe my answer is not what you're looking for: There are no scrolling issues in RawTherapee on MacOS. |
It quite easy to see the effect when scrolling the thumbtable in lighttable mode with magic mouse or trackpad since the slider widgets aren’t affected. |
Yes, there are no issues, because they fixed them, see my previous comment: #7904 (comment) So my questions is why not use an already tested solution? |
I haven't spend a lot of time trying to underestend the RawTherapee solution. Simply changing |
OK, so let's re-iterate - current PR improves the situation by fixing some scrolling behaviour in darktable, but not all of them (specifically lighttable scrollbar)? |
yes, because the handlers for scroll events in gtk.c aren't triggered if the thumbtable scrollbar widget is used. |
(cherry picked from commit c672080)
Merged to master and 3.4 branch |
Fixing issue on macOS with smooth scrolling events. Fixes #6068 scrolling issue by scaling the input from event->delta_x and event->delta_y.
The scaling amount feels ok on my system. It could be changed to get faster scrolling. Besides lighttable this also affects some modules. I tested module resize, retouch, histogram, zone system and bauhaus comboboxes. They seem to work correctly.
There might be better ways to handle trackpads. #6068 (comment)