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
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-10-09 20:37:54 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-10-09 20:38:10 +0400
commit0609aee4db0da33dcdb404d8285b093b21325deb (patch)
tree94cfc29ac2e93c8f9b3cec2f1b789c598effbb13
parent9f18e4f0eb81b7e4ab62f361e1d0c668a8b5eb35 (diff)
Fix T41639, hierarchical pie menu - popup interaction is buggy.
Basically, this commit changes pie menu click interaction so that confirmation is done on left click release instead of press. This allows dragging on the pie menu to select different items, but most importantly, there should be no left over click events passed on to subsequent menus/pies. This means that pie menus should now be able to spawn popups safely. Also, left clicking to spawn a second pie menu now sets that menu to click style by default allowing for better interaction between hierarhies of pie menus.
-rw-r--r--source/blender/editors/interface/interface_handlers.c11
-rw-r--r--source/blender/editors/interface/interface_regions.c5
2 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 2af034cde4d..2f9734f790f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8687,7 +8687,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
mul_v2_fl(vec, pie_radius);
add_v2_v2(vec, center);
- mul_v2_fl(vec, fac);
+ mul_v2_fl(vec, fac);
add_v2_v2(vec, block->pie_data.pie_center_spawned);
BLI_rctf_recenter(&but->rect, vec[0], vec[1]);
@@ -8718,7 +8718,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
return WM_UI_HANDLER_BREAK;
}
- if (event->type == block->pie_data.event) {
+ if (event->type == block->pie_data.event && !is_click_style) {
if (event->val != KM_RELEASE) {
ui_handle_menu_button(C, event, menu);
@@ -8734,7 +8734,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
if (!(block->pie_data.flags & UI_PIE_DRAG_STYLE)) {
block->pie_data.flags |= UI_PIE_CLICK_STYLE;
}
- else if (!is_click_style) {
+ else {
uiBut *but = ui_but_find_activated(menu->region);
retval = ui_but_pie_menu_apply(C, menu, but, true, is_click_style);
@@ -8747,7 +8747,8 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
switch (event->type) {
case MOUSEMOVE:
- if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ) {
+ if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ &&
+ !is_click_style) {
block->pie_data.flags |= UI_PIE_DRAG_STYLE;
}
ui_handle_menu_button(C, event, menu);
@@ -8757,7 +8758,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
break;
case LEFTMOUSE:
- if (event->val == KM_PRESS) {
+ if (event->val == KM_RELEASE) {
uiBut *but = ui_but_find_activated(menu->region);
retval = ui_but_pie_menu_apply(C, menu, but, false, is_click_style);
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 9b450b8fdf4..5739ebebe64 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2720,6 +2720,11 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const
pie->block_radial->flag |= UI_BLOCK_RADIAL;
pie->block_radial->pie_data.event = event->type;
+ /* if pie is spawned by a left click, it is always assumed to be click style */
+ if (event->type == LEFTMOUSE) {
+ pie->block_radial->flag |= UI_PIE_CLICK_STYLE;
+ }
+
pie->layout = uiBlockLayout(pie->block_radial, UI_LAYOUT_VERTICAL, UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style);
pie->mx = event->x;
pie->my = event->y;