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>
30 #include <input/text/text-input-manager.h>
42 * @brief Listens to Wayland input events.
43 * Translates the wayland events into DALi events and forwards them to a WindowEventInterface
45 class InputManager : public InputInterface
59 virtual ~InputManager();
62 * @brief Assign the window event interface
63 * @param[in] eventInterface event interface
65 void AssignWindowEventInterface( WindowEventInterface* eventInterface);
68 * @brief Assign the Wayland connection
69 * @param[in] display Wayland display
71 void AssignDisplay( WlDisplay* display );
74 * @brief Assign the Wayland surface
75 * @param[in] surface wayland surface
77 void AssignSurface( WlSurface* surface);
80 * @brief listen to events on this seat
81 * @param[in] seatInterface output interface
83 void AddSeatListener( Dali::WlSeat* seatInterface );
86 * @brief add text input manager interface
87 * @param[in] textInputManager text input manager
89 void AddTextInputManager( Dali::WlTextInputManager* textInputManager );
92 protected: //InputInterface, pointer events
95 * @copydoc InputInterface::PointerEnter
97 virtual void PointerEnter( Seat* seat, unsigned int serial, WlSurface* surface, float x, float y );
100 * @copydoc InputInterface::PointerLeave
102 virtual void PointerLeave( Seat* seat, unsigned int serial, WlSurface* surface );
105 * @copydoc InputInterface::PointerMotion
107 virtual void PointerMotion( Seat* seat, unsigned int timestamp, float x, float y );
110 * @copydoc InputInterface::PointerButton
112 virtual void PointerButton( Seat* seat, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state );
115 * @copydoc InputInterface::PointerAxis
117 virtual void PointerAxis( Seat* seat, unsigned int timestamp, unsigned int axis, float value );
120 protected: //InputInterface, keyboard events
123 * @copydoc InputInterface::KeyboardKeymap
125 virtual void KeyboardKeymap( Seat* seat, unsigned int format, int fd, unsigned int size );
128 * @copydoc InputInterface::KeyFocusEnter
130 virtual void KeyFocusEnter( Seat* seat, unsigned int serial, WlSurface* surface, WlArray* keys );
133 * @copydoc InputInterface::KeyFocusLeave
135 virtual void KeyFocusLeave( Seat* seat, unsigned int serial, WlSurface* surface );
138 * @copydoc InputInterface::KeyEvent
140 virtual void KeyEvent( Seat* seat, unsigned int serial, unsigned int timestamp, unsigned int keycode, unsigned int state );
143 * @copydoc InputInterface::KeyModifiers
145 virtual void KeyModifiers( Seat* seat,
147 unsigned int depressed,
148 unsigned int latched,
150 unsigned int group );
153 * @copydoc InputInterface::KeyRepeatInfo
155 virtual void KeyRepeatInfo( Seat* seat, int32_t rate, int32_t delay);
157 protected: //InputInterface, touch events
160 * @copydoc InputInterface::TouchDown
162 virtual void TouchDown( Seat* seat, unsigned int serial, unsigned int timestamp, WlSurface* surface, int touchId, float x, float y);
165 * @copydoc InputInterface::TouchUp
167 virtual void TouchUp( Seat* seat, unsigned int serial, unsigned int timestamp, int touchId );
170 * @copydoc InputInterface::TouchMotion
172 virtual void TouchMotion( Seat* seat, unsigned int timestamp, int touchId, float x, float y );
175 * @copydoc InputInterface::TouchFrame
177 virtual void TouchFrame( Seat* seat );
180 * @copydoc InputInterface::TouchCancel
182 virtual void TouchCancel( Seat* seat );
185 protected: //InputInterface Helper functions
188 * @copydoc InputInterface::GetSeat( const WlKeyboard* keyboard )
190 virtual Seat* GetSeat( const WlKeyboard* keyboard );
193 * @copydoc InputInterface::GetSeat( const WlPointer* pointer )
195 virtual Seat* GetSeat( const WlPointer* pointer );
198 * @copydoc InputInterface::GetSeat( const WlTouch* touch )
200 virtual Seat* GetSeat( const WlTouch* touch );
203 * @copydoc InputInterface::GetSeat( const WlSeat* seat )
205 virtual Seat* GetSeat( const WlSeat* seat );
210 * @brief Add a new seat ( collection of input devices)
211 * @param[in] wlRegistry
212 * @param[in] seatName seat name / id
213 * @param[in] version interface version
215 void AddSeat( Seat* seat );
220 Dali::Vector< Seat* > mSeats;
221 TextInputManager mTextInputManger;
223 WindowEventInterface* mWindowEventInterface;
231 #endif //__DALI_WAYLAND_INPUT_H__