WM: replace ISMOUSE with ISMOUSE_BUTTON

The ISMOUSE macro was used in situations only button events
needed to be checked.

The only functional difference would be MOUSEMOVE events were
previously accepted for these checks.
This commit is contained in:
2022-07-21 15:54:39 +10:00
parent 4ec0a8705b
commit 095b8d8688
5 changed files with 6 additions and 7 deletions

View File

@@ -10096,8 +10096,7 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock
/* Pass, needed to click-exit outside of non-floating menus. */
ui_region_auto_open_clear(but->active->region);
}
else if ((!ELEM(event->type, MOUSEMOVE, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN)) &&
ISMOUSE(event->type)) {
else if (ISMOUSE_BUTTON(event->type)) {
if (!ui_but_contains_point_px(but, but->active->region, event->xy)) {
but = NULL;
}

View File

@@ -2222,7 +2222,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
bool is_finished = false;
if (ISMOUSE(xfd->init_event)) {
if (ISMOUSE_BUTTON(xfd->init_event)) {
if ((event->type == xfd->init_event) && (event->val == KM_RELEASE)) {
is_finished = true;
}

View File

@@ -555,7 +555,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else {
/* Release confirms preference should not affect node editor (T69288, T70504). */
if (ISMOUSE(t->launch_event) &&
if (ISMOUSE_BUTTON(t->launch_event) &&
((U.flag & USER_RELEASECONFIRM) || (t->spacetype == SPACE_NODE))) {
/* Global "release confirm" on mouse bindings */
t->flag |= T_RELEASE_CONFIRM;

View File

@@ -346,8 +346,8 @@ bool WM_cursor_test_motion_and_update(const int mval[2])
int WM_event_drag_threshold(const struct wmEvent *event)
{
int drag_threshold;
if (ISMOUSE(event->prev_press_type)) {
BLI_assert(event->prev_press_type != MOUSEMOVE);
BLI_assert(event->prev_press_type != MOUSEMOVE);
if (ISMOUSE_BUTTON(event->prev_press_type)) {
/* Using the previous type is important is we want to check the last pressed/released button,
* The `event->type` would include #MOUSEMOVE which is always the case when dragging
* and does not help us know which threshold to use. */

View File

@@ -4975,7 +4975,7 @@ static bool wm_event_is_double_click(const wmEvent *event)
{
if ((event->type == event->prev_type) && (event->prev_val == KM_RELEASE) &&
(event->val == KM_PRESS)) {
if (ISMOUSE(event->type) && WM_event_drag_test(event, event->prev_press_xy)) {
if (ISMOUSE_BUTTON(event->type) && WM_event_drag_test(event, event->prev_press_xy)) {
/* Pass. */
}
else {