Filter out pie spawn button events.
The reason being, with the current system of quick selection, it's possible to spawn an operator after confirmation, especially for cases with modifier buttons.
This commit is contained in:
@@ -2715,10 +2715,6 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const
|
||||
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
/* allow respawning a pie from the last pie event */
|
||||
if (event->type == win->lock_pie_event && event->type != win->last_pie_event)
|
||||
return NULL;
|
||||
|
||||
style = UI_GetStyleDraw();
|
||||
pie = MEM_callocN(sizeof(uiPopupMenu), "pie menu");
|
||||
|
||||
@@ -2805,8 +2801,7 @@ void uiPieMenuInvoke(struct bContext *C, const char *idname, const wmEvent *even
|
||||
if (mt->poll && mt->poll(C, mt) == 0)
|
||||
return;
|
||||
|
||||
if (!(pie = uiPieMenuBegin(C, IFACE_(mt->label), ICON_NONE, event)))
|
||||
return;
|
||||
pie = uiPieMenuBegin(C, IFACE_(mt->label), ICON_NONE, event);
|
||||
layout = uiPieMenuLayout(pie);
|
||||
|
||||
menu.layout = layout;
|
||||
@@ -2827,9 +2822,7 @@ void uiPieOperatorEnumInvoke(struct bContext *C, const char *title, const char *
|
||||
uiPieMenu *pie;
|
||||
uiLayout *layout;
|
||||
|
||||
if (!(pie = uiPieMenuBegin(C, IFACE_(title), ICON_NONE, event)))
|
||||
return;
|
||||
|
||||
pie = uiPieMenuBegin(C, IFACE_(title), ICON_NONE, event);
|
||||
layout = uiPieMenuLayout(pie);
|
||||
|
||||
layout = uiLayoutRadial(layout);
|
||||
@@ -2859,8 +2852,7 @@ void uiPieEnumInvoke(struct bContext *C, const char *title, const char *path,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(pie = uiPieMenuBegin(C, IFACE_(title), ICON_NONE, event)))
|
||||
return;
|
||||
pie = uiPieMenuBegin(C, IFACE_(title), ICON_NONE, event);
|
||||
|
||||
layout = uiPieMenuLayout(pie);
|
||||
|
||||
|
||||
@@ -2188,10 +2188,21 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
|
||||
|
||||
}
|
||||
|
||||
static void wm_event_pie_filter(wmWindow *win, wmEvent *event)
|
||||
/* filter out all events of the pie that spawned the last pie unless it's a release event */
|
||||
static bool wm_event_pie_filter(wmWindow *win, wmEvent *event)
|
||||
{
|
||||
if (win->lock_pie_event == event->type && event->val == KM_RELEASE)
|
||||
win->lock_pie_event = EVENT_NONE;
|
||||
if (win->lock_pie_event && win->lock_pie_event == event->type) {
|
||||
if (event->val == KM_RELEASE) {
|
||||
win->lock_pie_event = EVENT_NONE;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* called in main loop */
|
||||
@@ -2257,9 +2268,21 @@ void wm_event_do_handlers(bContext *C)
|
||||
WM_event_print(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* take care of pie event filter */
|
||||
if (wm_event_pie_filter(win, event)) {
|
||||
#ifndef NDEBUG
|
||||
if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS) && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
|
||||
printf("\n%s: event filtered due to pie button pressed\n", __func__);
|
||||
}
|
||||
#endif
|
||||
BLI_remlink(&win->queue, event);
|
||||
wm_event_free(event);
|
||||
continue;
|
||||
}
|
||||
|
||||
CTX_wm_window_set(C, win);
|
||||
|
||||
|
||||
/* we let modal handlers get active area/region, also wm_paintcursor_test needs it */
|
||||
CTX_wm_area_set(C, area_event_inside(C, &event->x));
|
||||
CTX_wm_region_set(C, region_event_inside(C, &event->x));
|
||||
@@ -2269,8 +2292,6 @@ void wm_event_do_handlers(bContext *C)
|
||||
|
||||
wm_region_mouse_co(C, event);
|
||||
|
||||
/* take care of pie event filter */
|
||||
wm_event_pie_filter(win, event);
|
||||
|
||||
/* first we do priority handlers, modal + some limited keymaps */
|
||||
action |= wm_handlers_do(C, event, &win->modalhandlers);
|
||||
|
||||
Reference in New Issue
Block a user