diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 17 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 20 |
4 files changed, 49 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index a749fba5026..a653aaec671 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -694,13 +694,16 @@ typedef struct UserDef { /** Seconds to zoom around current frame. */ float view_frame_seconds; - char _pad1[4]; + char _pad1[2]; /** Private, defaults to 20 for 72 DPI setting. */ short widget_unit; short anisotropic_filter; short use_16bit_textures, use_gpu_mipmap; + /** Tablet API to use (Windows only). */ + short tablet_api; + /** Raw tablet pressure that maps to 100%. */ float pressure_threshold_max; /** Curve non-linearity parameter. */ @@ -915,6 +918,13 @@ typedef enum eUserpref_UI_Flag2 { USER_TRACKPAD_NATURAL = (1 << 2), } eUserpref_UI_Flag2; +/* UserDef.tablet_api */ +typedef enum eUserpref_TableAPI { + USER_TABLET_AUTOMATIC = 0, + USER_TABLET_NATIVE = 1, + USER_TABLET_WINTAB = 2, +} eUserpref_TabletAPI; + /* UserDef.app_flag */ typedef enum eUserpref_APP_Flag { USER_APP_LOCK_UI_LAYOUT = (1 << 0), diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 15f20a6aba7..eea2595d2a7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -236,6 +236,11 @@ static void rna_userdef_autokeymode_set(PointerRNA *ptr, int value) } } +static void rna_userdef_tablet_api_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + WM_init_tablet_api(); +} + #ifdef WITH_INPUT_NDOF static void rna_userdef_ndof_deadzone_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { @@ -4608,6 +4613,13 @@ static void rna_def_userdef_input(BlenderRNA *brna) }; #endif /* WITH_INPUT_NDOF */ + static const EnumPropertyItem tablet_api[] = { + {USER_TABLET_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically choose Wintab or Windows Ink depending on the device"}, + {USER_TABLET_NATIVE, "WINDOWS_INK", 0, "Windows Ink", "Use native Windows Ink API, for modern tablet and pen devices. Requires Windows 8 or newer"}, + {USER_TABLET_WINTAB, "WINTAB", 0, "Wintab", "Use Wintab driver for older tablets and Windows versions"}, + {0, NULL, 0, NULL, NULL} + }; + static const EnumPropertyItem view_zoom_styles[] = { {USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down"}, {USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zoom in and out based on vertical mouse movement"}, @@ -4733,6 +4745,11 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Softness", "Adjusts softness of the low pressure response onset using a gamma curve"); + prop = RNA_def_property(srna, "tablet_api", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, tablet_api); + RNA_def_property_ui_text(prop, "Tablet API", "Select the tablet API to use for pressure sensitivity"); + RNA_def_property_update(prop, 0, "rna_userdef_tablet_api_update"); + #ifdef WITH_INPUT_NDOF /* 3D mouse settings */ /* global options */ diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index adf082982b7..9daed32ee33 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -91,6 +91,7 @@ void WM_init_state_fullscreen_set(void); void WM_init_state_normal_set(void); void WM_init_window_focus_set(bool do_it); void WM_init_native_pixels(bool do_it); +void WM_init_tablet_api(void); void WM_init (struct bContext *C, int argc, const char **argv); void WM_exit_ext (struct bContext *C, const bool do_python); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 281a556a62d..8b76b2a5d32 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1690,6 +1690,8 @@ void wm_ghost_init(bContext *C) } GHOST_UseWindowFocus(wm_init_state.window_focus); + + WM_init_tablet_api(); } } @@ -1979,6 +1981,24 @@ void WM_init_native_pixels(bool do_it) wm_init_state.native_pixels = do_it; } +void WM_init_tablet_api(void) +{ + if (g_system) { + switch(U.tablet_api) { + case USER_TABLET_NATIVE: + GHOST_SetTabletAPI(g_system, GHOST_kTabletNative); + break; + case USER_TABLET_WINTAB: + GHOST_SetTabletAPI(g_system, GHOST_kTabletWintab); + break; + case USER_TABLET_AUTOMATIC: + default: + GHOST_SetTabletAPI(g_system, GHOST_kTabletAutomatic); + break; + } + } +} + /* This function requires access to the GHOST_SystemHandle (g_system) */ void WM_cursor_warp(wmWindow *win, int x, int y) { |