|
@@ -40,7 +40,7 @@ namespace bs
|
|
|
mOnFocusLostConn.disconnect();
|
|
mOnFocusLostConn.disconnect();
|
|
|
mOnFocusGainedConn.disconnect();
|
|
mOnFocusGainedConn.disconnect();
|
|
|
|
|
|
|
|
- Map<String, EditorWidgetBase*> widgetsCopy = mActiveWidgets;
|
|
|
|
|
|
|
+ UnorderedMap<String, EditorWidgetBase*> widgetsCopy = mActiveWidgets;
|
|
|
|
|
|
|
|
for (auto& widget : widgetsCopy)
|
|
for (auto& widget : widgetsCopy)
|
|
|
widget.second->close();
|
|
widget.second->close();
|
|
@@ -134,6 +134,14 @@ namespace bs
|
|
|
if(findIter != mActiveWidgets.end())
|
|
if(findIter != mActiveWidgets.end())
|
|
|
mActiveWidgets.erase(findIter);
|
|
mActiveWidgets.erase(findIter);
|
|
|
|
|
|
|
|
|
|
+ for(auto iter = mSavedFocusedWidgets.begin(); iter != mSavedFocusedWidgets.end();)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (iter->second == widget)
|
|
|
|
|
+ iter = mSavedFocusedWidgets.erase(iter);
|
|
|
|
|
+ else
|
|
|
|
|
+ ++iter;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if(widget->mParent != nullptr)
|
|
if(widget->mParent != nullptr)
|
|
|
widget->mParent->_notifyWidgetDestroyed(widget);
|
|
widget->mParent->_notifyWidgetDestroyed(widget);
|
|
|
|
|
|
|
@@ -295,7 +303,22 @@ namespace bs
|
|
|
|
|
|
|
|
void EditorWidgetManager::onFocusGained(const RenderWindow& window)
|
|
void EditorWidgetManager::onFocusGained(const RenderWindow& window)
|
|
|
{
|
|
{
|
|
|
- // Do nothing, possibly regain focus on last focused widget?
|
|
|
|
|
|
|
+ auto iterFind = mSavedFocusedWidgets.find(&window);
|
|
|
|
|
+ if(iterFind != mSavedFocusedWidgets.end())
|
|
|
|
|
+ {
|
|
|
|
|
+ EditorWidgetBase* widget = iterFind->second;
|
|
|
|
|
+ EditorWidgetContainer* parentContainer = widget->_getParent();
|
|
|
|
|
+ if (parentContainer != nullptr)
|
|
|
|
|
+ {
|
|
|
|
|
+ EditorWindowBase* parentWindow = parentContainer->getParentWindow();
|
|
|
|
|
+ SPtr<RenderWindow> parentRenderWindow = parentWindow->getRenderWindow();
|
|
|
|
|
+
|
|
|
|
|
+ if (parentRenderWindow.get() == &window)
|
|
|
|
|
+ widget->_setHasFocus(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ mSavedFocusedWidgets.erase(iterFind);;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void EditorWidgetManager::onFocusLost(const RenderWindow& window)
|
|
void EditorWidgetManager::onFocusLost(const RenderWindow& window)
|
|
@@ -313,6 +336,9 @@ namespace bs
|
|
|
if (parentRenderWindow.get() != &window)
|
|
if (parentRenderWindow.get() != &window)
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
|
|
|
+ if (widget->hasFocus())
|
|
|
|
|
+ mSavedFocusedWidgets[&window] = widget;
|
|
|
|
|
+
|
|
|
widget->_setHasFocus(false);
|
|
widget->_setHasFocus(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|