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>
25 #include <base/interfaces/window-event-interface.h>
27 #include <input/input-interface.h>
28 #include <input/seat.h>
29 #include <input/text/text-input-manager.h>
41 * @brief Listens to Wayland input events.
42 * Translates the wayland events into DALi events and forwards them to a WindowEventInterface
44 class InputManager : public InputInterface
58 virtual ~InputManager();
61 * @brief Assign the window event interface
62 * @param[in] eventInterface event interface
64 void AssignWindowEventInterface( WindowEventInterface* eventInterface);
67 * @brief Assign the Wayland connection
68 * @param[in] display Wayland display
70 void AssignDisplay( WlDisplay* display );
73 * @brief Assign the Wayland surface
74 * @param[in] surface wayland surface
76 void AssignSurface( WlSurface* surface);
79 * @brief listen to events on this seat
80 * @param[in] seatInterface output interface
82 void AddSeatListener( Dali::WlSeat* seatInterface );
85 * @brief add text input manager interface
86 * @param[in] textInputManager text input manager
88 void AddTextInputManager( Dali::WlTextInputManager* textInputManager );
91 protected: //InputInterface, pointer events
94 * @copydoc InputInterface::PointerEnter
96 virtual void PointerEnter( Seat* seat, unsigned int serial, WlSurface* surface, float x, float y );
99 * @copydoc InputInterface::PointerLeave
101 virtual void PointerLeave( Seat* seat, unsigned int serial, WlSurface* surface );
104 * @copydoc InputInterface::PointerMotion
106 virtual void PointerMotion( Seat* seat, unsigned int timestamp, float x, float y );
109 * @copydoc InputInterface::PointerButton
111 virtual void PointerButton( Seat* seat, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state );
114 * @copydoc InputInterface::PointerAxis
116 virtual void PointerAxis( Seat* seat, unsigned int timestamp, unsigned int axis, float value );
119 protected: //InputInterface, keyboard events
122 * @copydoc InputInterface::KeyboardKeymap
124 virtual void KeyboardKeymap( Seat* seat, unsigned int format, int fd, unsigned int size );
127 * @copydoc InputInterface::KeyFocusEnter
129 virtual void KeyFocusEnter( Seat* seat, unsigned int serial, WlSurface* surface, WlArray* keys );
132 * @copydoc InputInterface::KeyFocusLeave
134 virtual void KeyFocusLeave( Seat* seat, unsigned int serial, WlSurface* surface );
137 * @copydoc InputInterface::KeyEvent
139 virtual void KeyEvent( Seat* seat, unsigned int serial, unsigned int timestamp, unsigned int keycode, unsigned int state );
142 * @copydoc InputInterface::KeyModifiers
144 virtual void KeyModifiers( Seat* seat,
146 unsigned int depressed,
147 unsigned int latched,
149 unsigned int group );
152 * @copydoc InputInterface::KeyRepeatInfo
154 virtual void KeyRepeatInfo( Seat* seat, int32_t rate, int32_t delay);
156 protected: //InputInterface, touch events
159 * @copydoc InputInterface::TouchDown
161 virtual void TouchDown( Seat* seat, unsigned int serial, unsigned int timestamp, WlSurface* surface, int touchId, float x, float y);
164 * @copydoc InputInterface::TouchUp
166 virtual void TouchUp( Seat* seat, unsigned int serial, unsigned int timestamp, int touchId );
169 * @copydoc InputInterface::TouchMotion
171 virtual void TouchMotion( Seat* seat, unsigned int timestamp, int touchId, float x, float y );
174 * @copydoc InputInterface::TouchFrame
176 virtual void TouchFrame( Seat* seat );
179 * @copydoc InputInterface::TouchCancel
181 virtual void TouchCancel( Seat* seat );
184 protected: //InputInterface Helper functions
187 * @copydoc InputInterface::GetSeat( const WlKeyboard* keyboard )
189 virtual Seat* GetSeat( const WlKeyboard* keyboard );
192 * @copydoc InputInterface::GetSeat( const WlPointer* pointer )
194 virtual Seat* GetSeat( const WlPointer* pointer );
197 * @copydoc InputInterface::GetSeat( const WlTouch* touch )
199 virtual Seat* GetSeat( const WlTouch* touch );
202 * @copydoc InputInterface::GetSeat( const WlSeat* seat )
204 virtual Seat* GetSeat( const WlSeat* seat );
209 * @brief Add a new seat ( collection of input devices)
210 * @param[in] wlRegistry
211 * @param[in] seatName seat name / id
212 * @param[in] version interface version
214 void AddSeat( Seat* seat );
219 Dali::Vector< Seat* > mSeats;
220 TextInputManager mTextInputManger;
222 WindowEventInterface* mWindowEventInterface;
230 #endif //__DALI_WAYLAND_INPUT_H__