Fix notifiers from window events using the wrong window

The active window in the context may not match the window where GHOST
events are generated. Notifiers for new windows would always be ignored
with the context's window set to null for example.

Noticed while investigating #119871.
This commit is contained in:
Campbell Barton 2024-03-27 15:02:53 +11:00
parent 2a55aabbd8
commit e078112a53
1 changed files with 6 additions and 6 deletions

View File

@ -1487,7 +1487,7 @@ static bool ghost_event_proc(GHOST_EventHandle ghost_event, GHOST_TUserDataPtr C
}
wm_window_make_drawable(wm, win);
WM_event_add_notifier(C, NC_WINDOW, nullptr);
WM_event_add_notifier_ex(wm, win, NC_WINDOW, nullptr);
break;
}
@ -1502,7 +1502,7 @@ static bool ghost_event_proc(GHOST_EventHandle ghost_event, GHOST_TUserDataPtr C
* however this causes window flickering on resize with LIBDECOR under WAYLAND. */
wm_window_swap_buffers(win);
#else
WM_event_add_notifier(C, NC_WINDOW, nullptr);
WM_event_add_notifier_ex(wm, win, NC_WINDOW, nullptr);
#endif
break;
@ -1561,8 +1561,8 @@ static bool ghost_event_proc(GHOST_EventHandle ghost_event, GHOST_TUserDataPtr C
wm_window_make_drawable(wm, win);
BKE_icon_changed(screen->id.icon_id);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, nullptr);
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, nullptr);
WM_event_add_notifier_ex(wm, win, NC_SCREEN | NA_EDITED, nullptr);
WM_event_add_notifier_ex(wm, win, NC_WINDOW | NA_EDITED, nullptr);
#if defined(__APPLE__) || defined(WIN32)
/* MACOS and WIN32 don't return to the main-loop while resize. */
@ -1690,8 +1690,8 @@ static bool ghost_event_proc(GHOST_EventHandle ghost_event, GHOST_TUserDataPtr C
wm_window_make_drawable(wm, win);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, nullptr);
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, nullptr);
WM_event_add_notifier_ex(wm, win, NC_SCREEN | NA_EDITED, nullptr);
WM_event_add_notifier_ex(wm, win, NC_WINDOW | NA_EDITED, nullptr);
}
break;