From 9ba7c624b89681f76bb3ae48f1ad55dca2730c9f Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 12 May 2022 10:06:16 +0100 Subject: [PATCH] Wait 5 cycles before giving keyboard focus to UI --- dpf | 2 +- src/CardinalUI.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dpf b/dpf index cd1861a..081d4d7 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit cd1861ae893c21045e9f47245bf41cabca7d5f2f +Subproject commit 081d4d7392ef587f46dc3b216369655828bbda7f diff --git a/src/CardinalUI.cpp b/src/CardinalUI.cpp index ae7918e..dec24af 100644 --- a/src/CardinalUI.cpp +++ b/src/CardinalUI.cpp @@ -244,7 +244,7 @@ class CardinalUI : public CardinalBaseUI, rack::math::Vec lastMousePos; WindowParameters windowParameters; int rateLimitStep = 0; - bool firstIdle = true; + int8_t counterForSelfFocus = 0; struct ScopedContext { CardinalPluginContext* const context; @@ -368,9 +368,9 @@ public: void uiIdle() override { - if (firstIdle) + if (counterForSelfFocus >= 0 && ++counterForSelfFocus == 5) { - firstIdle = false; + counterForSelfFocus = -1; getWindow().focus(); }