diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index f8ca2c651a..e474df02b4 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -981,6 +982,10 @@ namespace MWGui MWBase::Environment::get().getInputManager()->setGamepadGuiCursorEnabled( mGuiModeStates[mode].mWindows[activeIndex]->isGamepadCursorAllowed()); + WindowBase* activeWindow = mGuiModeStates[mode].mWindows[activeIndex]; + if (activeWindow->isVisible()) + MyGUI::LayerManager::getInstance().upLayerItem(activeWindow->mMainWidget); + updateControllerButtonsOverlay(); setCursorActive(false); @@ -1435,11 +1440,17 @@ namespace MWGui if (Settings::gui().mControllerMenus) { if (mode == GM_Container) - mActiveControllerWindows[mode] = 0; // Ensure controller focus is on container - // Activate first visible window. This needs to be called after updateVisible. - if (mActiveControllerWindows[mode] != 0) - mActiveControllerWindows[mode] = mActiveControllerWindows[mode] - 1; - cycleActiveControllerWindow(true); + { + // Ensure controller focus is on container when entering container mode. + setActiveControllerWindow(mode, 0); + } + else + { + // Activate first visible window. This needs to be called after updateVisible. + if (mActiveControllerWindows[mode] != 0) + mActiveControllerWindows[mode] = mActiveControllerWindows[mode] - 1; + cycleActiveControllerWindow(true); + } } }