diff options
author | Ton Roosendaal <ton@blender.org> | 2012-11-08 20:50:31 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2012-11-08 20:50:31 +0400 |
commit | 360528d66709be21cac6ef3c98916174990accc3 (patch) | |
tree | fc84688ffdab97a9031804e4ce1f589385f0f9a2 /source/blender/editors | |
parent | 863291bc8e44eaed79946706b417944cdf9dfa4f (diff) |
Bugfix #29072 (Color pickers don't close properly when moving the mouse away)
This rewinds the fix for revision 50483.
- the removed code there (as comment said) closes menus on hoovering over another
button in panels. Is unfinished feature to allow quick inspecting menus
by mouse-hold going over menu popup buttons.
- It added yet another check for closing menus - should be done with ->saferct
- The actual bug was simple; the block flag with UI_BLOCK_MOVEMOUSE_QUIT was
accidentally cleared for colorpickers.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 32 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 4 |
2 files changed, 9 insertions, 27 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ecb161714ee..5d4427bcbef 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -6050,38 +6050,22 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) switch (event->type) { case MOUSEMOVE: { - /* if the mouse is over the button, do nothing */ - if (ui_mouse_inside_button(data->region, but, event->x, event->y)) { - break; - } + uiBut *bt; - /* if the mouse is over the menu, also do nothing */ if (data->menu && data->menu->region) { if (ui_mouse_inside_region(data->menu->region, event->x, event->y)) { break; } - else { - /* make a rectangle between the menu and the button that opened it, - * this avoids any space between them exiting the popup. see [#29072] - campbell */ - rctf rct_all = but->rect; - rctf rct_win; - - ui_block_to_window_fl(ar, block, &rct_all.xmin, &rct_all.ymin); - ui_block_to_window_fl(ar, block, &rct_all.xmax, &rct_all.ymax); - - BLI_rctf_rcti_copy(&rct_win, &data->menu->region->winrct); - BLI_rctf_union(&rct_all, &rct_win); - - if (BLI_rctf_isect_pt(&rct_all, event->x, event->y)) { - break; - } - } } - if (but->type != COLOR) { /* exception */ - data->cancel = TRUE; + bt = ui_but_find_mouse_over(ar, event->x, event->y); + + if (bt && bt->active != data) { + if (but->type != COLOR) { /* exception */ + data->cancel = TRUE; + } + button_activate_state(C, but, BUTTON_STATE_EXIT); } - button_activate_state(C, but, BUTTON_STATE_EXIT); break; } } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 28e361ccf5a..9b77072dee1 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2254,13 +2254,11 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_ show_picker = (but->block->flag & UI_BLOCK_POPUP) == 0; } - uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); - copy_v3_v3(handle->retvec, but->editvec); uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop, show_picker); - block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1; + block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1 | UI_BLOCK_MOVEMOUSE_QUIT; uiBoundsBlock(block, 10); block->block_event_func = ui_picker_small_wheel_cb; |