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:
authorTon Roosendaal <ton@blender.org>2013-02-08 16:12:57 +0400
committerTon Roosendaal <ton@blender.org>2013-02-08 16:12:57 +0400
commit1dfb6404b78396988fedf5ad2bd111c6af13cf12 (patch)
tree5ea0a8cdc2aaf8cbb25c27b5082db3ac9415657d /source
parent08326778c5c24bf9d0592264dabfea094057b471 (diff)
Release todo: added userpref for Mac users having "Natural Scroll" set.
As per discussion and analysis of all trackpad usage, we now follow this convention: - Blender follows system setting for trackpad direction preference. - If you set your system to "natural" scroll, we need to invert a couple of cases in Blender we do "natural" already. Like: - view rotate (the inversed option just never feels ok) - scroll active items in list or pulldown menu (up/down is absolute) - ALT+scroll values in buttons (up/down is absolute) The new User Preference setting "Trackpad Natural" handles this. For 2.66 we only have trackpad handling for OS X... so this isn't affecting trackpad usage in Windows and Linux, which stick to be mapped to Scroll Wheel still. (Note: viewrotate now is "natural" always, changing how it worked in the past weeks).
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_handlers.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c8
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c6
4 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 648857170ed..edd5b901ca1 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -237,8 +237,14 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
lastdy += dy;
if (ABS(lastdy) > (int)UI_UNIT_Y) {
+ int dy = event->prevy - event->y;
+
+ if (U.uiflag2 & USER_TRACKPAD_NATURAL)
+ dy = -dy;
+
*val = KM_PRESS;
- if (event->prevy - event->y > 0)
+
+ if (dy > 0)
*type = WHEELUPMOUSE;
else
*type = WHEELDOWNMOUSE;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 562d1ec4b64..5c2e75776e4 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -921,8 +921,12 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
if (event->type == MOUSEPAN) {
- /* invert it, trackpad scroll then follows how you mapped it globally */
- viewrotate_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy);
+ /* Rotate direction we keep always same */
+ if (U.uiflag2 & USER_TRACKPAD_NATURAL)
+ viewrotate_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy);
+ else
+ viewrotate_apply(vod, event->prevx, event->prevy);
+
ED_view3d_depth_tag_update(rv3d);
viewops_data_free(C, op);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 861d44b214e..2d8d808198d 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -568,7 +568,8 @@ typedef enum eUserpref_UI_Flag {
/* uiflag2 */
typedef enum eUserpref_UI_Flag2 {
USER_KEEP_SESSION = (1 << 0),
- USER_REGION_OVERLAP = (1 << 1)
+ USER_REGION_OVERLAP = (1 << 1),
+ USER_TRACKPAD_NATURAL = (1 << 2)
} eUserpref_UI_Flag2;
/* Auto-Keying mode */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 0def5988315..2b2f1a2469b 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3549,7 +3549,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
"Draw tool/property regions over the main region, when using Triple Buffer");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
#ifdef WITH_CYCLES
prop = RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
@@ -3755,6 +3754,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_range(prop, 0, 32);
RNA_def_property_ui_text(prop, "Wheel Scroll Lines", "Number of lines scrolled at a time with the mouse wheel");
+ prop = RNA_def_property(srna, "use_trackpad_natural", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_TRACKPAD_NATURAL);
+ RNA_def_property_ui_text(prop, "Trackpad Natural",
+ "If your system uses 'natural' scrolling, this option keeps consistent trackpad usage throughout the UI");
+
prop = RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "keyconfigstr");
RNA_def_property_ui_text(prop, "Key Config", "The name of the active key configuration");