From c6232b7691b94fefd71cf82f91aefddb643a5f04 Mon Sep 17 00:00:00 2001 From: MrLetsplay Date: Sun, 15 Oct 2023 21:35:56 +0200 Subject: [PATCH] Fix UI focus --- src/kekengine/cpp/common/defaults.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kekengine/cpp/common/defaults.cpp b/src/kekengine/cpp/common/defaults.cpp index 346bfa6..aa3340e 100644 --- a/src/kekengine/cpp/common/defaults.cpp +++ b/src/kekengine/cpp/common/defaults.cpp @@ -69,7 +69,9 @@ static void doUIMouseClick(double x, double y, GLFWMouseButton button) { clickedElement->clickAll(clickedAt, UIPoint((int) x, (int) y), button); if(button == GLFWMouseButton::LEFT) { - clickedElement->focusEnterAll(clickedAt, UIPoint((int) x, (int) y)); + if(!clickedElement->focusEnterAll(clickedAt, UIPoint((int) x, (int) y))) { + UI::unfocusElement(kekData.ui->focusedElement); + } } } else { UI::unfocusElement(kekData.ui->focusedElement);