Fix redundant window activation/deactivation events under Wayland

Any window state change (resizing for e.g.) triggered
activation/deactivation events. Resolve by only sending events on state
change. The activation caused cursor motion events from #107594.
This commit is contained in:
Campbell Barton
2023-10-06 17:10:35 +11:00
parent 35edcf2ed6
commit d59a79ef95
2 changed files with 25 additions and 4 deletions

View File

@@ -801,11 +801,19 @@ static void gwl_window_frame_update_from_pending_no_lock(GWL_Window *win)
system->getMilliSeconds(), GHOST_kEventWindowDPIHintChanged, win->ghost_window));
}
if (win->frame_pending.is_active) {
win->ghost_window->activate();
if (win->frame.is_active != win->frame_pending.is_active) {
if (win->frame_pending.is_active) {
win->ghost_window->activate();
}
else {
win->ghost_window->deactivate();
}
}
else {
win->ghost_window->deactivate();
GHOST_ASSERT(
win->frame.is_active ==
(win->ghost_system->getWindowManager()->getActiveWindow() == win->ghost_window),
"GHOST internal active state does not match WAYLAND!");
}
win->frame_pending.size[0] = win->frame.size[0];

View File

@@ -152,9 +152,22 @@ class GHOST_WindowWayland : public GHOST_Window {
/* WAYLAND window-level functions. */
GHOST_TSuccess close();
/**
* Set the window as active and send an #GHOST_kEventWindowActivate event.
*
* \note The current active state is *not* checked, the caller is responsible for
* not activating windows which are already active.
*/
GHOST_TSuccess activate();
/**
* De-activate the window and send a #GHOST_kEventWindowDeactivate event.
*
* \note The current active state is *not* checked, the caller is responsible for
* not de-activating windows that aren't active.
*/
GHOST_TSuccess deactivate();
GHOST_TSuccess close();
GHOST_TSuccess notify_size();
GHOST_TSuccess notify_decor_redraw();