Input - Added method for releasing default input object

This commit is contained in:
Dennis Andersen 2014-02-25 01:05:37 +01:00 committed by Dander7BD
parent 1f90de4cb4
commit 18d0a6460b
4 changed files with 17 additions and 4 deletions

View File

@ -25,6 +25,11 @@ namespace Input
*/ */
static InputManager* CreateInputManager (); static InputManager* CreateInputManager ();
/**
* @return Destroy default input manager.
*/
static void DestroyInputManager ();
/** /**
* @return Destroys a input manager. * @return Destroys a input manager.
*/ */

View File

@ -57,6 +57,11 @@ InputManager* InputManager::CreateInputManager()
{ {
return CreateManager(); return CreateManager();
} }
void InputManager::DestroyInputManager()
{
delete defaultInstance;
defaultInstance = 0;
}
void InputManager::DestroyInputManager(InputManager* inputSystem) void InputManager::DestroyInputManager(InputManager* inputSystem)
{ {
if(!inputSystem) return; if(!inputSystem) return;
@ -77,3 +82,4 @@ InputManager::~InputManager()

View File

@ -226,6 +226,10 @@ void Keyboard::BindTextTarget( ::std::wstring *field )
{ {
this->writePos = field->size(); this->writePos = field->size();
} }
else
{
this->writePos = 0;
}
} }
void Keyboard::ReleaseTextTarget( ) void Keyboard::ReleaseTextTarget( )
{ {

View File

@ -150,7 +150,7 @@ Win32Input::Win32Input()
{ /*wrong*/ } { /*wrong*/ }
} }
Win32Input::~Win32Input() Win32Input::~Win32Input()
{} { Destroy(); }
InputObject* Win32Input::CreateDevice(const SAIType inputType, Typedefs::WindowHandle targetApplication) InputObject* Win32Input::CreateDevice(const SAIType inputType, Typedefs::WindowHandle targetApplication)
{ {
if(!this->instance->targetHwin) if(!this->instance->targetHwin)
@ -225,9 +225,7 @@ void Win32Input::ToggleInputSystem(bool enable)
void Win32Input::Destroy () void Win32Input::Destroy ()
{ {
ShowCursor(true); ShowCursor(true);
RECT r; ClipCursor(0);
GetWindowRect(GetDesktopWindow(), &r);
ClipCursor(&r);
for (unsigned int i = 0; i < this->keyboard.size(); i++) for (unsigned int i = 0; i < this->keyboard.size(); i++)
{ {