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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
if (but->type != COLOR) { /* exception */
|
||||
data->cancel = TRUE;
|
||||
}
|
||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user