Move video wrapper to the WindowsManager

pull/578/head
Andrei Kortunov 5 years ago
parent 13b7c5b519
commit f990150c49

@ -96,7 +96,7 @@ bool OMW::Engine::frame(float frametime)
// When the window is minimized, pause the game. Currently this *has* to be here to work around a MyGUI bug. // When the window is minimized, pause the game. Currently this *has* to be here to work around a MyGUI bug.
// If we are not currently rendering, then RenderItems will not be reused resulting in a memory leak upon changing widget textures (fixed in MyGUI 3.3.2), // If we are not currently rendering, then RenderItems will not be reused resulting in a memory leak upon changing widget textures (fixed in MyGUI 3.3.2),
// and destroyed widgets will not be deleted (not fixed yet, https://github.com/MyGUI/mygui/issues/21) // and destroyed widgets will not be deleted (not fixed yet, https://github.com/MyGUI/mygui/issues/21)
if (!mEnvironment.getInputManager()->isWindowVisible()) if (!mEnvironment.getWindowManager()->isWindowVisible())
{ {
mEnvironment.getSoundManager()->pausePlayback(); mEnvironment.getSoundManager()->pausePlayback();
return false; return false;
@ -532,20 +532,20 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
else else
gameControllerdb = ""; //if it doesn't exist, pass in an empty string gameControllerdb = ""; //if it doesn't exist, pass in an empty string
MWInput::InputManager* input = new MWInput::InputManager (mWindow, mViewer, mScreenCaptureHandler, mScreenCaptureOperation, keybinderUser, keybinderUserExists, userGameControllerdb, gameControllerdb, mGrab);
mEnvironment.setInputManager (input);
std::string myguiResources = (mResDir / "mygui").string(); std::string myguiResources = (mResDir / "mygui").string();
osg::ref_ptr<osg::Group> guiRoot = new osg::Group; osg::ref_ptr<osg::Group> guiRoot = new osg::Group;
guiRoot->setName("GUI Root"); guiRoot->setName("GUI Root");
guiRoot->setNodeMask(MWRender::Mask_GUI); guiRoot->setNodeMask(MWRender::Mask_GUI);
rootNode->addChild(guiRoot); rootNode->addChild(guiRoot);
MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem.get(), mWorkQueue.get(), MWGui::WindowManager* window = new MWGui::WindowManager(mWindow, mViewer, guiRoot, mResourceSystem.get(), mWorkQueue.get(),
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources, mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts, mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts,
Version::getOpenmwVersionDescription(mResDir.string()), mCfgMgr.getUserConfigPath().string()); Version::getOpenmwVersionDescription(mResDir.string()), mCfgMgr.getUserConfigPath().string());
mEnvironment.setWindowManager (window); mEnvironment.setWindowManager (window);
MWInput::InputManager* input = new MWInput::InputManager (mWindow, mViewer, mScreenCaptureHandler, mScreenCaptureOperation, keybinderUser, keybinderUserExists, userGameControllerdb, gameControllerdb, mGrab);
mEnvironment.setInputManager (input);
// Create sound system // Create sound system
mEnvironment.setSoundManager (new MWSound::SoundManager(mVFS.get(), mUseSound)); mEnvironment.setSoundManager (new MWSound::SoundManager(mVFS.get(), mUseSound));

@ -38,8 +38,6 @@ namespace MWBase
virtual ~InputManager() {} virtual ~InputManager() {}
virtual bool isWindowVisible() = 0;
virtual void update(float dt, bool disableControls, bool disableEvents=false) = 0; virtual void update(float dt, bool disableControls, bool disableEvents=false) = 0;
virtual void changeInputMode(bool guiMode) = 0; virtual void changeInputMode(bool guiMode) = 0;

@ -11,6 +11,8 @@
#include "../mwgui/mode.hpp" #include "../mwgui/mode.hpp"
#include <components/sdlutil/events.hpp>
namespace Loading namespace Loading
{ {
class Listener; class Listener;
@ -86,7 +88,7 @@ namespace SFO
namespace MWBase namespace MWBase
{ {
/// \brief Interface for widnow manager (implemented in MWGui) /// \brief Interface for widnow manager (implemented in MWGui)
class WindowManager class WindowManager : public SDLUtil::WindowListener
{ {
WindowManager (const WindowManager&); WindowManager (const WindowManager&);
///< not implemented ///< not implemented
@ -268,8 +270,6 @@ namespace MWBase
virtual void processChangedSettings(const std::set< std::pair<std::string, std::string> >& changed) = 0; virtual void processChangedSettings(const std::set< std::pair<std::string, std::string> >& changed) = 0;
virtual void windowResized(int x, int y) = 0;
virtual void executeInConsole (const std::string& path) = 0; virtual void executeInConsole (const std::string& path) = 0;
virtual void enableRest() = 0; virtual void enableRest() = 0;
@ -360,6 +360,11 @@ namespace MWBase
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat) = 0; virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text, bool repeat) = 0;
virtual bool injectKeyRelease(MyGUI::KeyCode key) = 0; virtual bool injectKeyRelease(MyGUI::KeyCode key) = 0;
virtual void windowVisibilityChange(bool visible) = 0;
virtual void windowResized(int x, int y) = 0;
virtual void windowClosed() = 0;
virtual bool isWindowVisible() = 0;
}; };
} }

@ -21,6 +21,7 @@
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/sdlutil/sdlcursormanager.hpp> #include <components/sdlutil/sdlcursormanager.hpp>
#include <components/sdlutil/sdlvideowrapper.hpp>
#include <components/esm/esmreader.hpp> #include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp> #include <components/esm/esmwriter.hpp>
@ -127,7 +128,7 @@ namespace MWGui
{ {
WindowManager::WindowManager( WindowManager::WindowManager(
osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue, SDL_Window* window, osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue,
const std::string& logpath, const std::string& resourcePath, bool consoleOnlyScripts, Translation::Storage& translationDataStorage, const std::string& logpath, const std::string& resourcePath, bool consoleOnlyScripts, Translation::Storage& translationDataStorage,
ToUTF8::FromType encoding, bool exportFonts, const std::string& versionDescription, const std::string& userDataPath) ToUTF8::FromType encoding, bool exportFonts, const std::string& versionDescription, const std::string& userDataPath)
: mOldUpdateMask(0) : mOldUpdateMask(0)
@ -196,6 +197,7 @@ namespace MWGui
, mEncoding(encoding) , mEncoding(encoding)
, mFontHeight(16) , mFontHeight(16)
, mVersionDescription(versionDescription) , mVersionDescription(versionDescription)
, mWindowVisible(true)
{ {
float uiScale = Settings::Manager::getFloat("scaling factor", "GUI"); float uiScale = Settings::Manager::getFloat("scaling factor", "GUI");
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(), uiScale); mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(), uiScale);
@ -288,6 +290,10 @@ namespace MWGui
MyGUI::ClipboardManager::getInstance().eventClipboardRequested += MyGUI::newDelegate(this, &WindowManager::onClipboardRequested); MyGUI::ClipboardManager::getInstance().eventClipboardRequested += MyGUI::newDelegate(this, &WindowManager::onClipboardRequested);
mShowOwned = Settings::Manager::getInt("show owned", "Game"); mShowOwned = Settings::Manager::getInt("show owned", "Game");
mVideoWrapper = new SDLUtil::VideoWrapper(window, viewer);
mVideoWrapper->setGammaContrast(Settings::Manager::getFloat("gamma", "Video"),
Settings::Manager::getFloat("contrast", "Video"));
} }
void WindowManager::loadFontDelegate(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version) void WindowManager::loadFontDelegate(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version)
@ -653,6 +659,7 @@ namespace MWGui
mGuiPlatform->shutdown(); mGuiPlatform->shutdown();
delete mGuiPlatform; delete mGuiPlatform;
delete mVideoWrapper;
} }
catch(const MyGUI::Exception& e) catch(const MyGUI::Exception& e)
{ {
@ -916,7 +923,7 @@ namespace MWGui
mMessageBoxManager->onFrame(dt); mMessageBoxManager->onFrame(dt);
MWBase::Environment::get().getInputManager()->update(dt, true, false); MWBase::Environment::get().getInputManager()->update(dt, true, false);
if (!MWBase::Environment::get().getInputManager()->isWindowVisible()) if (!mWindowVisible)
OpenThreads::Thread::microSleep(5000); OpenThreads::Thread::microSleep(5000);
else else
{ {
@ -1241,6 +1248,7 @@ namespace MWGui
{ {
mToolTips->setDelay(Settings::Manager::getFloat("tooltip delay", "GUI")); mToolTips->setDelay(Settings::Manager::getFloat("tooltip delay", "GUI"));
bool changeRes = false;
for (const auto& setting : changed) for (const auto& setting : changed)
{ {
if (setting.first == "HUD" && setting.second == "crosshair") if (setting.first == "HUD" && setting.second == "crosshair")
@ -1249,11 +1257,38 @@ namespace MWGui
mSubtitlesEnabled = Settings::Manager::getBool ("subtitles", "GUI"); mSubtitlesEnabled = Settings::Manager::getBool ("subtitles", "GUI");
else if (setting.first == "GUI" && setting.second == "menu transparency") else if (setting.first == "GUI" && setting.second == "menu transparency")
setMenuTransparency(Settings::Manager::getFloat("menu transparency", "GUI")); setMenuTransparency(Settings::Manager::getFloat("menu transparency", "GUI"));
else if (setting.first == "Video" && (
setting.second == "resolution x"
|| setting.second == "resolution y"
|| setting.second == "fullscreen"
|| setting.second == "window border"))
changeRes = true;
else if (setting.first == "Video" && setting.second == "vsync")
mVideoWrapper->setSyncToVBlank(Settings::Manager::getBool("vsync", "Video"));
else if (setting.first == "Video" && (setting.second == "gamma" || setting.second == "contrast"))
mVideoWrapper->setGammaContrast(Settings::Manager::getFloat("gamma", "Video"),
Settings::Manager::getFloat("contrast", "Video"));
}
if (changeRes)
{
mVideoWrapper->setVideoMode(Settings::Manager::getInt("resolution x", "Video"),
Settings::Manager::getInt("resolution y", "Video"),
Settings::Manager::getBool("fullscreen", "Video"),
Settings::Manager::getBool("window border", "Video"));
} }
} }
void WindowManager::windowResized(int x, int y) void WindowManager::windowResized(int x, int y)
{ {
// Note: this is a side effect of resolution change or window resize.
// There is no need to track these changes.
Settings::Manager::setInt("resolution x", "Video", x);
Settings::Manager::setInt("resolution y", "Video", y);
Settings::Manager::resetPendingChange("resolution x", "Video");
Settings::Manager::resetPendingChange("resolution y", "Video");
mGuiPlatform->getRenderManagerPtr()->setViewSize(x, y); mGuiPlatform->getRenderManagerPtr()->setViewSize(x, y);
// scaled size // scaled size
@ -1283,9 +1318,27 @@ namespace MWGui
for (WindowBase* window : mWindows) for (WindowBase* window : mWindows)
window->onResChange(x, y); window->onResChange(x, y);
// We should reload TrueType fonts to fit new resolution
loadUserFonts();
// TODO: check if any windows are now off-screen and move them back if so // TODO: check if any windows are now off-screen and move them back if so
} }
bool WindowManager::isWindowVisible()
{
return mWindowVisible;
}
void WindowManager::windowVisibilityChange(bool visible)
{
mWindowVisible = visible;
}
void WindowManager::windowClosed()
{
MWBase::Environment::get().getStateManager()->requestQuit();
}
void WindowManager::onCursorChange(const std::string &name) void WindowManager::onCursorChange(const std::string &name)
{ {
mCursorManager->cursorChanged(name); mCursorManager->cursorChanged(name);
@ -1925,7 +1978,7 @@ namespace MWGui
MWBase::Environment::get().getInputManager()->update(dt, true, false); MWBase::Environment::get().getInputManager()->update(dt, true, false);
if (!MWBase::Environment::get().getInputManager()->isWindowVisible()) if (!mWindowVisible)
{ {
mVideoWidget->pause(); mVideoWidget->pause();
OpenThreads::Thread::microSleep(5000); OpenThreads::Thread::microSleep(5000);

@ -15,6 +15,7 @@
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include <components/sdlutil/events.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <components/to_utf8/to_utf8.hpp> #include <components/to_utf8/to_utf8.hpp>
@ -70,6 +71,7 @@ namespace SceneUtil
namespace SDLUtil namespace SDLUtil
{ {
class SDLCursorManager; class SDLCursorManager;
class VideoWrapper;
} }
namespace osgMyGUI namespace osgMyGUI
@ -124,13 +126,14 @@ namespace MWGui
class JailScreen; class JailScreen;
class KeyboardNavigation; class KeyboardNavigation;
class WindowManager : public MWBase::WindowManager class WindowManager :
public MWBase::WindowManager
{ {
public: public:
typedef std::pair<std::string, int> Faction; typedef std::pair<std::string, int> Faction;
typedef std::vector<Faction> FactionList; typedef std::vector<Faction> FactionList;
WindowManager(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue, WindowManager(SDL_Window* window, osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue,
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts, Translation::Storage& translationDataStorage, const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts, Translation::Storage& translationDataStorage,
ToUTF8::FromType encoding, bool exportFonts, const std::string& versionDescription, const std::string& localPath); ToUTF8::FromType encoding, bool exportFonts, const std::string& versionDescription, const std::string& localPath);
virtual ~WindowManager(); virtual ~WindowManager();
@ -296,7 +299,10 @@ namespace MWGui
virtual void processChangedSettings(const Settings::CategorySettingVector& changed); virtual void processChangedSettings(const Settings::CategorySettingVector& changed);
virtual void windowVisibilityChange(bool visible);
virtual void windowResized(int x, int y); virtual void windowResized(int x, int y);
virtual void windowClosed();
virtual bool isWindowVisible();
virtual void executeInConsole (const std::string& path); virtual void executeInConsole (const std::string& path);
@ -529,10 +535,14 @@ namespace MWGui
std::string mVersionDescription; std::string mVersionDescription;
bool mWindowVisible;
MWGui::TextColours mTextColours; MWGui::TextColours mTextColours;
std::unique_ptr<KeyboardNavigation> mKeyboardNavigation; std::unique_ptr<KeyboardNavigation> mKeyboardNavigation;
SDLUtil::VideoWrapper* mVideoWrapper;
/** /**
* Called when MyGUI tries to retrieve a tag's value. Tags must be denoted in #{tag} notation and will be replaced upon setting a user visible text/property. * Called when MyGUI tries to retrieve a tag's value. Tags must be denoted in #{tag} notation and will be replaced upon setting a user visible text/property.
* Supported syntax: * Supported syntax:

@ -11,7 +11,6 @@
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/sdlutil/sdlinputwrapper.hpp> #include <components/sdlutil/sdlinputwrapper.hpp>
#include <components/sdlutil/sdlvideowrapper.hpp>
#include <components/esm/esmwriter.hpp> #include <components/esm/esmwriter.hpp>
#include <components/esm/esmreader.hpp> #include <components/esm/esmreader.hpp>
#include <components/esm/controlsstate.hpp> #include <components/esm/controlsstate.hpp>
@ -46,8 +45,7 @@ namespace MWInput
osgViewer::ScreenCaptureHandler::CaptureOperation *screenCaptureOperation, osgViewer::ScreenCaptureHandler::CaptureOperation *screenCaptureOperation,
const std::string& userFile, bool userFileExists, const std::string& userControllerBindingsFile, const std::string& userFile, bool userFileExists, const std::string& userControllerBindingsFile,
const std::string& controllerBindingsFile, bool grab) const std::string& controllerBindingsFile, bool grab)
: mWindowVisible(true) : mUserFile(userFile)
, mUserFile(userFile)
, mDragDrop(false) , mDragDrop(false)
, mGrabCursor(Settings::Manager::getBool("grab cursor", "Input")) , mGrabCursor(Settings::Manager::getBool("grab cursor", "Input"))
, mGuiCursorEnabled(true) , mGuiCursorEnabled(true)
@ -55,11 +53,7 @@ namespace MWInput
, mFakeDeviceID(1) , mFakeDeviceID(1)
{ {
mInputWrapper = new SDLUtil::InputWrapper(window, viewer, grab); mInputWrapper = new SDLUtil::InputWrapper(window, viewer, grab);
mInputWrapper->setWindowEventCallback(this); mInputWrapper->setWindowEventCallback(MWBase::Environment::get().getWindowManager());
mVideoWrapper = new SDLUtil::VideoWrapper(window, viewer);
mVideoWrapper->setGammaContrast(Settings::Manager::getFloat("gamma", "Video"),
Settings::Manager::getFloat("contrast", "Video"));
std::string file = userFileExists ? userFile : ""; std::string file = userFileExists ? userFile : "";
mInputBinder = new ICS::InputControlSystem(file, true, this, nullptr, A_Last); mInputBinder = new ICS::InputControlSystem(file, true, this, nullptr, A_Last);
@ -109,23 +103,16 @@ namespace MWInput
InputManager::~InputManager() InputManager::~InputManager()
{ {
mInputBinder->save (mUserFile);
delete mActionManager; delete mActionManager;
delete mControllerManager; delete mControllerManager;
delete mKeyboardManager; delete mKeyboardManager;
delete mMouseManager; delete mMouseManager;
delete mSensorManager; delete mSensorManager;
mInputBinder->save(mUserFile);
delete mInputBinder; delete mInputBinder;
delete mInputWrapper; delete mInputWrapper;
delete mVideoWrapper;
}
bool InputManager::isWindowVisible()
{
return mWindowVisible;
} }
void InputManager::setPlayerControlsEnabled(bool enabled) void InputManager::setPlayerControlsEnabled(bool enabled)
@ -278,35 +265,11 @@ namespace MWInput
void InputManager::processChangedSettings(const Settings::CategorySettingVector& changed) void InputManager::processChangedSettings(const Settings::CategorySettingVector& changed)
{ {
bool changeRes = false;
for (Settings::CategorySettingVector::const_iterator it = changed.begin(); for (Settings::CategorySettingVector::const_iterator it = changed.begin();
it != changed.end(); ++it) it != changed.end(); ++it)
{ {
if (it->first == "Input" && it->second == "grab cursor") if (it->first == "Input" && it->second == "grab cursor")
mGrabCursor = Settings::Manager::getBool("grab cursor", "Input"); mGrabCursor = Settings::Manager::getBool("grab cursor", "Input");
if (it->first == "Video" && (
it->second == "resolution x"
|| it->second == "resolution y"
|| it->second == "fullscreen"
|| it->second == "window border"))
changeRes = true;
if (it->first == "Video" && it->second == "vsync")
mVideoWrapper->setSyncToVBlank(Settings::Manager::getBool("vsync", "Video"));
if (it->first == "Video" && (it->second == "gamma" || it->second == "contrast"))
mVideoWrapper->setGammaContrast(Settings::Manager::getFloat("gamma", "Video"),
Settings::Manager::getFloat("contrast", "Video"));
}
if (changeRes)
{
mVideoWrapper->setVideoMode(Settings::Manager::getInt("resolution x", "Video"),
Settings::Manager::getInt("resolution y", "Video"),
Settings::Manager::getBool("fullscreen", "Video"),
Settings::Manager::getBool("window border", "Video"));
} }
mMouseManager->processChangedSettings(changed); mMouseManager->processChangedSettings(changed);
@ -346,35 +309,6 @@ namespace MWInput
mControlSwitch[sw] = value; mControlSwitch[sw] = value;
} }
void InputManager::windowFocusChange(bool have_focus)
{
}
void InputManager::windowVisibilityChange(bool visible)
{
mWindowVisible = visible;
}
void InputManager::windowResized(int x, int y)
{
// Note: this is a side effect of resolution change or window resize.
// There is no need to track these changes.
Settings::Manager::setInt("resolution x", "Video", x);
Settings::Manager::setInt("resolution y", "Video", y);
Settings::Manager::resetPendingChange("resolution x", "Video");
Settings::Manager::resetPendingChange("resolution y", "Video");
MWBase::Environment::get().getWindowManager()->windowResized(x, y);
// We should reload TrueType fonts to fit new resolution
MWBase::Environment::get().getWindowManager()->loadUserFonts();
}
void InputManager::windowClosed()
{
MWBase::Environment::get().getStateManager()->requestQuit();
}
void InputManager::resetIdleTime() void InputManager::resetIdleTime()
{ {
mActionManager->resetIdleTime(); mActionManager->resetIdleTime();

@ -51,7 +51,6 @@ namespace Files
namespace SDLUtil namespace SDLUtil
{ {
class InputWrapper; class InputWrapper;
class VideoWrapper;
} }
struct SDL_Window; struct SDL_Window;
@ -63,7 +62,6 @@ namespace MWInput
*/ */
class InputManager : class InputManager :
public MWBase::InputManager, public MWBase::InputManager,
public SDLUtil::WindowListener,
public ICS::ChannelListener, public ICS::ChannelListener,
public ICS::DetectingBindingListener public ICS::DetectingBindingListener
{ {
@ -79,8 +77,6 @@ namespace MWInput
virtual ~InputManager(); virtual ~InputManager();
virtual bool isWindowVisible();
/// Clear all savegame-specific data /// Clear all savegame-specific data
virtual void clear(); virtual void clear();
@ -109,11 +105,6 @@ namespace MWInput
virtual void setJoystickLastUsed(bool enabled); virtual void setJoystickLastUsed(bool enabled);
virtual bool joystickLastUsed(); virtual bool joystickLastUsed();
virtual void windowVisibilityChange( bool visible );
virtual void windowFocusChange( bool have_focus );
virtual void windowResized (int x, int y);
virtual void windowClosed ();
virtual void channelChanged(ICS::Channel* channel, float currentValue, float previousValue); virtual void channelChanged(ICS::Channel* channel, float currentValue, float previousValue);
virtual void keyBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control virtual void keyBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
@ -146,12 +137,9 @@ namespace MWInput
virtual void resetIdleTime(); virtual void resetIdleTime();
private: private:
bool mWindowVisible;
ICS::InputControlSystem* mInputBinder; ICS::InputControlSystem* mInputBinder;
SDLUtil::InputWrapper* mInputWrapper; SDLUtil::InputWrapper* mInputWrapper;
SDLUtil::VideoWrapper* mVideoWrapper;
std::string mUserFile; std::string mUserFile;

@ -79,9 +79,6 @@ public:
/** @remarks The window's visibility changed */ /** @remarks The window's visibility changed */
virtual void windowVisibilityChange( bool visible ) {} virtual void windowVisibilityChange( bool visible ) {}
/** @remarks The window got / lost input focus */
virtual void windowFocusChange( bool have_focus ) {}
virtual void windowClosed () {} virtual void windowClosed () {}
virtual void windowResized (int x, int y) {} virtual void windowResized (int x, int y) {}

@ -231,15 +231,10 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
case SDL_WINDOWEVENT_FOCUS_GAINED: case SDL_WINDOWEVENT_FOCUS_GAINED:
mWindowHasFocus = true; mWindowHasFocus = true;
updateMouseSettings(); updateMouseSettings();
if (mWindowListener)
mWindowListener->windowFocusChange(true);
break; break;
case SDL_WINDOWEVENT_FOCUS_LOST: case SDL_WINDOWEVENT_FOCUS_LOST:
mWindowHasFocus = false; mWindowHasFocus = false;
updateMouseSettings(); updateMouseSettings();
if (mWindowListener)
mWindowListener->windowFocusChange(false);
break; break;
case SDL_WINDOWEVENT_CLOSE: case SDL_WINDOWEVENT_CLOSE:
break; break;

Loading…
Cancel
Save