1 #ifndef __DALI_WAYLAND_INPUT_H__
2 #define __DALI_WAYLAND_INPUT_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/dali-vector.h>
23 #include <dali/public-api/events/key-event.h>
26 #include <base/interfaces/window-event-interface.h>
28 #include <input/input-interface.h>
29 #include <input/seat.h>
40 * @brief Listens to Wayland input events.
41 * Translates the wayland events into DALi events and forwards them to a WindowEventInterface
43 class InputManager : public InputInterface
57 virtual ~InputManager();
60 * @brief Assign the window event interface
61 * @param[in] eventInterface event interface
63 void AssignWindowEventInterface( WindowEventInterface* eventInterface);
66 * @brief listen to events on this seat
67 * @param seatInterface[in] output interface
69 void AddSeatListener( Dali::WlSeat* seatInterface );
72 protected: //InputInterface, pointer events
75 * @copydoc InputInterface::PointerEnter
77 virtual void PointerEnter( Seat* seat, unsigned int serial, WlSurface* surface, float x, float y );
80 * @copydoc InputInterface::PointerLeave
82 virtual void PointerLeave( Seat* seat, unsigned int serial, WlSurface* surface );
85 * @copydoc InputInterface::PointerMotion
87 virtual void PointerMotion( Seat* seat, unsigned int timestamp, float x, float y );
90 * @copydoc InputInterface::PointerButton
92 virtual void PointerButton( Seat* seat, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state );
95 * @copydoc InputInterface::PointerAxis
97 virtual void PointerAxis( Seat* seat, unsigned int timestamp, unsigned int axis, float value );
100 protected: //InputInterface, keyboard events
103 * @copydoc InputInterface::KeyboardKeymap
105 virtual void KeyboardKeymap( Seat* seat, unsigned int format, int fd, unsigned int size );
108 * @copydoc InputInterface::KeyFocusEnter
110 virtual void KeyFocusEnter( Seat* seat, unsigned int serial, WlSurface* surface, WlArray* keys );
113 * @copydoc InputInterface::KeyFocusLeave
115 virtual void KeyFocusLeave( Seat* seat, unsigned int serial, WlSurface* surface );
118 * @copydoc InputInterface::KeyEvent
120 virtual void KeyEvent( Seat* seat, unsigned int serial, unsigned int timestamp, unsigned int keycode, unsigned int state );
123 * @copydoc InputInterface::KeyModifiers
125 virtual void KeyModifiers( Seat* seat,
127 unsigned int depressed,
128 unsigned int latched,
130 unsigned int group );
133 * @copydoc InputInterface::KeyRepeatInfo
135 virtual void KeyRepeatInfo( Seat* seat, int32_t rate, int32_t delay);
137 protected: //InputInterface, touch events
140 * @copydoc InputInterface::TouchDown
142 virtual void TouchDown( Seat* seat, unsigned int serial, unsigned int timestamp, WlSurface* surface, int touchId, float x, float y);
145 * @copydoc InputInterface::TouchUp
147 virtual void TouchUp( Seat* seat, unsigned int serial, unsigned int timestamp, int touchId );
150 * @copydoc InputInterface::TouchMotion
152 virtual void TouchMotion( Seat* seat, unsigned int timestamp, int touchId, float x, float y );
155 * @copydoc InputInterface::TouchFrame
157 virtual void TouchFrame( Seat* seat );
160 * @copydoc InputInterface::TouchCancel
162 virtual void TouchCancel( Seat* seat );
165 protected: //InputInterface Helper functions
168 * @copydoc InputInterface::GetSeat( const WlKeyboard* keyboard )
170 virtual Seat* GetSeat( const WlKeyboard* keyboard );
173 * @copydoc InputInterface::GetSeat( const WlPointer* pointer )
175 virtual Seat* GetSeat( const WlPointer* pointer );
178 * @copydoc InputInterface::GetSeat( const WlTouch* touch )
180 virtual Seat* GetSeat( const WlTouch* touch );
183 * @copydoc InputInterface::GetSeat( const WlSeat* seat )
185 virtual Seat* GetSeat( const WlSeat* seat );
190 * @brief Add a new seat ( collection of input devices)
191 * @param[in] wlRegistry
192 * @param[in] seatName seat name / id
193 * @param[in] version interface version
195 void AddSeat( Seat* seat );
200 Dali::Vector< Seat* > mSeats;
201 WindowEventInterface* mWindowEventInterface;
209 #endif //__DALI_WAYLAND_INPUT_H__