Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorYevgeny Makarov <jenkm>2021-02-03 19:01:14 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-02-03 19:13:27 +0300
commite54f88f092865cb1239c3fb65a13cb2f9c50fcba (patch)
tree324ffa9ac94d525c760c1a6a3237f01ca4884355 /source
parent85fe12071ad7f7f866b2f2e213ee291dc607b38d (diff)
macOS: trackpad scroll direction reversed in list views
The 'ui_pan_to_scroll' uses 'WM_event_absolute_delta_y'. For scrolling the List View we need to invert the direction to respect "natural scroll direction" system preferences. Differential Revision: https://developer.blender.org/D10291
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_handlers.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index b5aeee3d3bc..97d9b225d3c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -9005,6 +9005,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *regi
{
int retval = WM_UI_HANDLER_CONTINUE;
int type = event->type, val = event->val;
+ int scroll_dir = 1;
bool redraw = false;
uiList *ui_list = listbox->custom_data;
@@ -9021,6 +9022,11 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *regi
if (type == MOUSEPAN) {
ui_pan_to_scroll(event, &type, &val);
+ /* 'ui_pan_to_scroll' gives the absolute direction. */
+ if (event->is_direction_inverted) {
+ scroll_dir = -1;
+ }
+
/* If type still is mouse-pan, we call it handled, since delta-y accumulate. */
/* also see wm_event_system.c do_wheel_ui hack */
if (type == MOUSEPAN) {
@@ -9115,7 +9121,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *regi
else if (ELEM(type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
if (dyn_data->height > dyn_data->visual_height) {
/* list template will clamp */
- ui_list->list_scroll += (type == WHEELUPMOUSE) ? -1 : 1;
+ ui_list->list_scroll += scroll_dir * ((type == WHEELUPMOUSE) ? -1 : 1);
redraw = true;
retval = WM_UI_HANDLER_BREAK;