onFocusLost calls now focusHandler(false) when this handler is set

This commit is contained in:
Bertrand Songis
2020-04-28 10:09:38 +02:00
parent b166674604
commit dd9a87aa5f
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ void Window::setFocus(uint8_t flag)
clearFocus();
focusWindow = this;
if (focusHandler) {
focusHandler();
focusHandler(true);
}
}
+5 -2
View File
@@ -131,7 +131,7 @@ class Window {
closeHandler = std::move(handler);
}
void setFocusHandler(std::function<void()> handler)
void setFocusHandler(std::function<void(bool)> handler)
{
focusHandler = std::move(handler);
}
@@ -360,7 +360,7 @@ class Window {
static std::list<Window *> trash;
std::function<void()> closeHandler;
std::function<void()> focusHandler;
std::function<void(bool)> focusHandler;
void addChild(Window * window, bool front = false)
{
@@ -389,6 +389,9 @@ class Window {
virtual void onFocusLost()
{
TRACE_WINDOWS("%s onFocusLost()", getWindowDebugString().c_str());
if (focusHandler) {
focusHandler(false);
}
invalidate();
}