From b374255447a077c79afaf9d1f51e84efcde10573 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 12 Aug 2014 17:07:15 +0200 Subject: [PATCH] Improve performance of moving spell window (don't recreate widgets unnecessarily) --- apps/openmw/mwgui/spellwindow.cpp | 7 ++++++- apps/openmw/mwgui/spellwindow.hpp | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index aa5fcd88a2..b558025d1c 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -45,6 +45,7 @@ namespace MWGui , NoDrop(drag, mMainWidget) , mHeight(0) , mWidth(0) + , mWindowSize(mMainWidget->getSize()) { mSpellIcons = new SpellIcons(); @@ -308,7 +309,11 @@ namespace MWGui void SpellWindow::onWindowResize(MyGUI::Window* _sender) { - updateSpells(); + if (mMainWidget->getSize() != mWindowSize) + { + mWindowSize = mMainWidget->getSize(); + updateSpells(); + } } void SpellWindow::onEnchantedItemSelected(MyGUI::Widget* _sender) diff --git a/apps/openmw/mwgui/spellwindow.hpp b/apps/openmw/mwgui/spellwindow.hpp index 2aa4d83d21..a74847b907 100644 --- a/apps/openmw/mwgui/spellwindow.hpp +++ b/apps/openmw/mwgui/spellwindow.hpp @@ -29,6 +29,8 @@ namespace MWGui int mHeight; int mWidth; + MyGUI::IntSize mWindowSize; + std::string mSpellToDelete; void addGroup(const std::string& label, const std::string& label2);