window_layouter: improve focus history

If no window has ever been focused, next() always returns an invalid
window id. As a consequence, there is no way to cycle through the focus
history without an explicit focus event (e.g. mouse hover).

Instead, next() should return the first window from the focus history if the
currently focused window is not present.

Fixes genodelabs/genode#4164
This commit is contained in:
Johannes Schlatow 2021-05-19 10:45:00 +02:00 committed by Christian Helmuth
parent f0b9549376
commit 4383579db6

View File

@ -76,7 +76,7 @@ class Window_layouter::Focus_history
Entry * const entry = _lookup(window_id);
if (!entry)
return Window_id();
return first->window_id;
Entry * const next = entry->next();
return next ? next->window_id : first->window_id;