[Bf-blender-cvs] [5668901ced3] master: Cleanup: remove redundant NULL window checks handling events
Campbell Barton
noreply at git.blender.org
Fri Mar 5 11:31:35 CET 2021
Commit: 5668901ced38a17477af580c882805975150f16d
Author: Campbell Barton
Date: Fri Mar 5 21:30:16 2021 +1100
Branches: master
https://developer.blender.org/rB5668901ced38a17477af580c882805975150f16d
Cleanup: remove redundant NULL window checks handling events
===================================================================
M source/blender/windowmanager/intern/wm_event_system.c
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index fe503167f8d..18ec8402482 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2951,16 +2951,15 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
{
int action = wm_handlers_do_intern(C, event, handlers);
- /* Fileread case. */
- if (CTX_wm_window(C) == NULL) {
+ /* Will be NULL in the file read case. */
+ wmWindow *win = CTX_wm_window(C);
+ if (win == NULL) {
return action;
}
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
-
/* Test for CLICK_DRAG events. */
if (wm_action_not_handled(action)) {
- wmWindow *win = CTX_wm_window(C);
if (win->event_queue_check_drag) {
if (WM_event_drag_test(event, &event->prevclickx)) {
int x = event->x;
@@ -2991,10 +2990,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
}
}
else {
- wmWindow *win = CTX_wm_window(C);
- if (win) {
- win->event_queue_check_drag = false;
- }
+ win->event_queue_check_drag = false;
}
}
else if (ISMOUSE_BUTTON(event->type) || ISKEYBOARD(event->type)) {
@@ -3002,24 +2998,20 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
/* Test for CLICK events. */
if (wm_action_not_handled(action)) {
- wmWindow *win = CTX_wm_window(C);
-
/* eventstate stores if previous event was a KM_PRESS, in case that
* wasn't handled, the KM_RELEASE will become a KM_CLICK */
- if (win != NULL) {
- if (event->val == KM_PRESS) {
- if (event->prevval != KM_PRESS) {
- win->event_queue_check_click = true;
- win->event_queue_check_drag = true;
- }
- }
- else if (event->val == KM_RELEASE) {
- win->event_queue_check_drag = false;
+ if (event->val == KM_PRESS) {
+ if (event->prevval != KM_PRESS) {
+ win->event_queue_check_click = true;
+ win->event_queue_check_drag = true;
}
}
+ else if (event->val == KM_RELEASE) {
+ win->event_queue_check_drag = false;
+ }
- if (win && event->prevtype == event->type) {
+ if (event->prevtype == event->type) {
if (event->val == KM_RELEASE) {
if (event->prevval == KM_PRESS) {
@@ -3062,11 +3054,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
}
}
else {
- wmWindow *win = CTX_wm_window(C);
- if (win) {
- win->event_queue_check_click = false;
- win->event_queue_check_drag = false;
- }
+ win->event_queue_check_click = false;
+ win->event_queue_check_drag = false;
}
}
else if (ISMOUSE_WHEEL(event->type) || ISMOUSE_GESTURE(event->type)) {
@@ -3076,11 +3065,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
/* pass */
}
else {
- wmWindow *win = CTX_wm_window(C);
- if (win) {
- if (ISKEYMODIFIER(event->prevtype)) {
- win->event_queue_check_click = false;
- }
+ if (ISKEYMODIFIER(event->prevtype)) {
+ win->event_queue_check_click = false;
}
}
}
More information about the Bf-blender-cvs
mailing list