Cleanup: use early return to reduce right-shift in ghost_event_proc

This commit is contained in:
Campbell Barton 2023-10-08 19:25:22 +11:00
parent 0df1a0df3d
commit 5c98d53125
1 changed files with 267 additions and 267 deletions

View File

@ -1286,12 +1286,11 @@ static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_pt
bContext *C = static_cast<bContext *>(C_void_ptr);
wmWindowManager *wm = CTX_wm_manager(C);
GHOST_TEventType type = GHOST_GetEventType(evt);
const uint64_t event_time_ms = GHOST_GetEventTime(evt);
GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
if (type == GHOST_kEventQuitRequest) {
/* Find an active window to display quit dialog in. */
GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
wmWindow *win;
if (ghostwin && GHOST_ValidWindow(g_system, ghostwin)) {
win = static_cast<wmWindow *>(GHOST_GetWindowUserData(ghostwin));
@ -1307,10 +1306,11 @@ static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_pt
else {
wm_exit_schedule_delayed(C);
}
return true;
}
else {
GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
GHOST_TEventDataPtr data = GHOST_GetEventData(evt);
const uint64_t event_time_ms = GHOST_GetEventTime(evt);
/* Ghost now can call this function for life resizes,
* but it should return if WM didn't initialize yet.
@ -1328,6 +1328,7 @@ static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_pt
puts("<!> event has invalid window");
return true;
}
wmWindow *win = static_cast<wmWindow *>(GHOST_GetWindowUserData(ghostwin));
switch (type) {
@ -1507,8 +1508,7 @@ static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_pt
break;
}
case GHOST_kEventDraggingDropDone: {
const GHOST_TEventDragnDropData *ddd = static_cast<const GHOST_TEventDragnDropData *>(
data);
const GHOST_TEventDragnDropData *ddd = static_cast<const GHOST_TEventDragnDropData *>(data);
/* Ensure the event state matches modifiers (window was inactive). */
wm_window_update_eventstate_modifiers(wm, win, event_time_ms);
@ -1606,7 +1606,7 @@ static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_pt
break;
}
}
}
return true;
}