mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-18 10:35:59 +01:00
Shortcut(): clearer early out in SetShortcutRouting() -> CalcRoutingScore() path.
This commit is contained in:
parent
d72e1563d4
commit
58ca5f6424
@ -8294,13 +8294,16 @@ static int CalcRoutingScore(ImGuiWindow* location, ImGuiID owner_id, ImGuiInputF
|
|||||||
if (owner_id != 0 && g.ActiveId == owner_id)
|
if (owner_id != 0 && g.ActiveId == owner_id)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
// Early out when not in focus stack
|
||||||
|
if (focused == NULL || focused->RootWindow != location->RootWindow)
|
||||||
|
return 255;
|
||||||
|
|
||||||
// Score based on distance to focused window (lower is better)
|
// Score based on distance to focused window (lower is better)
|
||||||
// Assuming both windows are submitting a routing request,
|
// Assuming both windows are submitting a routing request,
|
||||||
// - When Window....... is focused -> Window scores 3 (best), Window/ChildB scores 255 (no match)
|
// - When Window....... is focused -> Window scores 3 (best), Window/ChildB scores 255 (no match)
|
||||||
// - When Window/ChildB is focused -> Window scores 4, Window/ChildB scores 3 (best)
|
// - When Window/ChildB is focused -> Window scores 4, Window/ChildB scores 3 (best)
|
||||||
// Assuming only WindowA is submitting a routing request,
|
// Assuming only WindowA is submitting a routing request,
|
||||||
// - When Window/ChildB is focused -> Window scores 4 (best), Window/ChildB doesn't have a score.
|
// - When Window/ChildB is focused -> Window scores 4 (best), Window/ChildB doesn't have a score.
|
||||||
if (focused != NULL && focused->RootWindow == location->RootWindow)
|
|
||||||
for (int next_score = 3; focused != NULL; next_score++)
|
for (int next_score = 3; focused != NULL; next_score++)
|
||||||
{
|
{
|
||||||
if (focused == location)
|
if (focused == location)
|
||||||
|
Loading…
Reference in New Issue
Block a user