onFocusLost calls now focusHandler(false) when this handler is set
This commit is contained in:
+1
-1
@@ -121,7 +121,7 @@ void Window::setFocus(uint8_t flag)
|
|||||||
clearFocus();
|
clearFocus();
|
||||||
focusWindow = this;
|
focusWindow = this;
|
||||||
if (focusHandler) {
|
if (focusHandler) {
|
||||||
focusHandler();
|
focusHandler(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -131,7 +131,7 @@ class Window {
|
|||||||
closeHandler = std::move(handler);
|
closeHandler = std::move(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFocusHandler(std::function<void()> handler)
|
void setFocusHandler(std::function<void(bool)> handler)
|
||||||
{
|
{
|
||||||
focusHandler = std::move(handler);
|
focusHandler = std::move(handler);
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ class Window {
|
|||||||
static std::list<Window *> trash;
|
static std::list<Window *> trash;
|
||||||
|
|
||||||
std::function<void()> closeHandler;
|
std::function<void()> closeHandler;
|
||||||
std::function<void()> focusHandler;
|
std::function<void(bool)> focusHandler;
|
||||||
|
|
||||||
void addChild(Window * window, bool front = false)
|
void addChild(Window * window, bool front = false)
|
||||||
{
|
{
|
||||||
@@ -389,6 +389,9 @@ class Window {
|
|||||||
virtual void onFocusLost()
|
virtual void onFocusLost()
|
||||||
{
|
{
|
||||||
TRACE_WINDOWS("%s onFocusLost()", getWindowDebugString().c_str());
|
TRACE_WINDOWS("%s onFocusLost()", getWindowDebugString().c_str());
|
||||||
|
if (focusHandler) {
|
||||||
|
focusHandler(false);
|
||||||
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user