diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-09-05 20:28:24 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2015-09-05 20:42:05 +0300 |
commit | b529b828306b2179baa95d5b4988f6eeaf46ded8 (patch) | |
tree | 03f50c0027a3614a0b4e0f9d3f8b8a3f5285f4d5 /source/blender/editors/interface/interface_regions.c | |
parent | 1478ac35c743430d0b333ae9829689782baf70c2 (diff) |
Fix T45944: Ctrl+Wheel to cycle values failes in toolshelf
Now, ctrl+wheel for cycling tabs is passed to hovered button if it supports cycling values (RNA menus, color/row/number/slider buttons, list boxes)
This might feel a bit glitchy if ctrl+wheel is used to cycle tabs and in newly opened tab, a button with cycling support is under the mouse, which will get mouse input from this point on instead of region. Think this is still better than old behavior.
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index c9b15f05519..356e85e9d63 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -107,15 +107,22 @@ static int rna_property_enum_step(const bContext *C, PointerRNA *ptr, PropertyRN return value; } -int ui_but_menu_step(uiBut *but, int direction) +bool ui_but_menu_step_poll(const uiBut *but) { + BLI_assert(but->type == UI_BTYPE_MENU); + /* currenly only RNA buttons */ - if ((but->rnaprop == NULL) || (RNA_property_type(but->rnaprop) != PROP_ENUM)) { - printf("%s: cannot cycle button '%s'\n", __func__, but->str); - return 0; + return (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM); +} + +int ui_but_menu_step(uiBut *but, int direction) +{ + if (ui_but_menu_step_poll(but)) { + return rna_property_enum_step(but->block->evil_C, &but->rnapoin, but->rnaprop, direction); } - return rna_property_enum_step(but->block->evil_C, &but->rnapoin, but->rnaprop, direction); + printf("%s: cannot cycle button '%s'\n", __func__, but->str); + return 0; } /******************** Creating Temporary regions ******************/ |