WM: gestures now activate immediately on mouse press
Some gestures were activating immediately on tweak events, extend this to mouse-press and click-drag. Without this change, box-select for example wouldn't be automatically activated on mouse-press.
This commit is contained in:
parent
b659d1a560
commit
88692baace
|
@ -906,6 +906,7 @@ int WM_event_modifier_flag(const struct wmEvent *event);
|
|||
bool WM_event_is_modal_tweak_exit(const struct wmEvent *event, int tweak_event);
|
||||
bool WM_event_is_last_mousemove(const struct wmEvent *event);
|
||||
bool WM_event_is_mouse_drag(const struct wmEvent *event);
|
||||
bool WM_event_is_mouse_drag_or_press(const wmEvent *event);
|
||||
|
||||
int WM_event_drag_threshold(const struct wmEvent *event);
|
||||
bool WM_event_drag_test(const struct wmEvent *event, const int prev_xy[2]);
|
||||
|
|
|
@ -270,6 +270,12 @@ bool WM_event_is_mouse_drag(const wmEvent *event)
|
|||
return ISTWEAK(event->type) || (ISMOUSE_BUTTON(event->type) && (event->val == KM_CLICK_DRAG));
|
||||
}
|
||||
|
||||
bool WM_event_is_mouse_drag_or_press(const wmEvent *event)
|
||||
{
|
||||
return WM_event_is_mouse_drag(event) ||
|
||||
(ISMOUSE_BUTTON(event->type) && (event->val == KM_PRESS));
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -179,7 +179,8 @@ int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
const bool wait_for_input = !ISTWEAK(event->type) && RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
const bool wait_for_input = !WM_event_is_mouse_drag_or_press(event) &&
|
||||
RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
||||
if (wait_for_input) {
|
||||
op->customdata = WM_gesture_new(win, region, event, WM_GESTURE_CROSS_RECT);
|
||||
|
@ -300,7 +301,8 @@ static void gesture_circle_apply(bContext *C, wmOperator *op);
|
|||
int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
const bool wait_for_input = !ISTWEAK(event->type) && RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
const bool wait_for_input = !WM_event_is_mouse_drag_or_press(event) &&
|
||||
RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
||||
op->customdata = WM_gesture_new(win, CTX_wm_region(C), event, WM_GESTURE_CIRCLE);
|
||||
wmGesture *gesture = op->customdata;
|
||||
|
@ -871,7 +873,7 @@ int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *e
|
|||
|
||||
op->customdata = WM_gesture_new(win, CTX_wm_region(C), event, WM_GESTURE_STRAIGHTLINE);
|
||||
|
||||
if (ISTWEAK(event->type)) {
|
||||
if (WM_event_is_mouse_drag_or_press(event)) {
|
||||
wmGesture *gesture = op->customdata;
|
||||
gesture->is_active = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue