// CLASS HEADER
#include "input-manager.h"
+// EXTERNAL INCLUDES
+#include <dali/integration-api/events/key-event-integ.h>
+
// INTERNAL INCLUDES
#include <input/input-listeners.h>
+#include <input/text/text-input-listeners.h>
+#include <virtual-keyboard.h>
namespace Dali
{
} // unnamed namespace
InputManager::InputManager()
-:mWindowEventInterface( NULL )
+:mDisplay( NULL ),
+ mWindowEventInterface( NULL )
{
}
void InputManager::AssignWindowEventInterface( WindowEventInterface* eventInterface)
{
mWindowEventInterface = eventInterface;
+ mTextInputManger.AssignWindowEventInterface( mWindowEventInterface );
+}
+
+void InputManager::AssignDisplay( WlDisplay* display )
+{
+ mDisplay = display;
+ mTextInputManger.AssignDisplay( mDisplay );
}
+void InputManager::AssignSurface( WlSurface* surface)
+{
+ for( Dali::Vector< Seat* >::Iterator iter = mSeats.Begin(); iter != mSeats.End() ; ++iter )
+ {
+ Seat* seat = (*iter);
+ seat->SetSurfaceInterface( surface );
+ }
+}
+
+
void InputManager::AddSeatListener( Dali::WlSeat* seatInterface )
{
Seat* seat = new Seat( this, seatInterface );
AddSeat( seat );
+ mTextInputManger.AddSeat( seat );
// listen to seat events
wl_seat_add_listener( seatInterface, Wayland::GetSeatListener(), this );
}
+
+void InputManager::AddTextInputManager( Dali::WlTextInputManager* textInputManager )
+{
+
+ for( Dali::Vector< Seat* >::Iterator iter = mSeats.Begin(); iter != mSeats.End() ; ++iter )
+ {
+ Seat* seat = (*iter);
+
+ // Create a text input object for each seat
+ WlTextInput* textInput = wl_text_input_manager_create_text_input( textInputManager );
+ seat->SetTextInputInterface( textInput );
+
+ wl_text_input_add_listener( textInput, Wayland::GetTextInputListener(), &mTextInputManger );
+ }
+
+}
+
void InputManager::PointerEnter( Seat* seat, unsigned int serial, WlSurface* surface, float x, float y )
{
if( mWindowEventInterface )
{
if( mWindowEventInterface )
{
- TouchPoint point ( POINTER_DEVICE_ID, TouchPoint::Motion, x , y);
+ Integration::Point point;
+ point.SetDeviceId( POINTER_DEVICE_ID );
+ point.SetState( PointState::MOTION );
+ point.SetScreenPosition( Vector2( x , y ) );
mWindowEventInterface->TouchEvent( point, timestamp );
}
}
{
const Dali::Vector2& pointer( seat->GetLastPointerPosition() );
- TouchPoint point ( POINTER_DEVICE_ID, TouchPoint::Up, pointer.x, pointer.y );
- if( state == 1)
+ Integration::Point point;
+ point.SetDeviceId( POINTER_DEVICE_ID );
+ point.SetScreenPosition( pointer );
+
+ if( state == 1 )
{
- point.state = TouchPoint::Down;
+ point.SetState( PointState::DOWN );
}
+ else
+ {
+ point.SetState( PointState::UP );
+ }
+
mWindowEventInterface->TouchEvent( point, timestamp );
}
}
void InputManager::KeyEvent( Seat* seat, unsigned int serial, unsigned int timestamp, unsigned int keycode, unsigned int state )
{
- Dali::KeyEvent keyEvent = seat->GetDALiKeyEvent( serial, timestamp, keycode, state );
+ Integration::KeyEvent keyEvent( seat->GetDALiKeyEvent( serial, timestamp, keycode, state ) );
mWindowEventInterface->KeyEvent( keyEvent);
{
const Dali::Vector2& pointer( seat->GetLastPointerPosition() );
- TouchPoint point ( touchId, TouchPoint::Down, pointer.x, pointer.y );
+ Integration::Point point;
+ point.SetDeviceId( touchId );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( pointer );
mWindowEventInterface->TouchEvent( point, timestamp );
}
}
{
const Dali::Vector2& pointer( seat->GetLastPointerPosition() );
- TouchPoint point ( touchId, TouchPoint::Up, pointer.x, pointer.y );
+ Integration::Point point;
+ point.SetDeviceId( touchId );
+ point.SetState( PointState::UP );
+ point.SetScreenPosition( pointer );
mWindowEventInterface->TouchEvent( point, timestamp );
}
}
{
const Dali::Vector2& pointer( seat->GetLastPointerPosition() );
- TouchPoint point ( touchId, TouchPoint::Motion, pointer.x, pointer.y );
+ Integration::Point point;
+ point.SetDeviceId( touchId );
+ point.SetState( PointState::MOTION );
+ point.SetScreenPosition( pointer );
mWindowEventInterface->TouchEvent( point, timestamp );
}
}
// it looks like DALi just checks the first touch point for interruption
// so touchId can be zero
- TouchPoint point ( 0, TouchPoint::Interrupted, pointer.x, pointer.y );
+ Integration::Point point;
+ point.SetState( PointState::INTERRUPTED );
+ point.SetScreenPosition( pointer );
mWindowEventInterface->TouchEvent( point, 0 );
}
}