2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "text-input-listeners.h"
21 #include <input/text/text-input-interface.h>
22 #include <input/seat.h>
37 void Enter( void* data, WlTextInput* textInput, WlSurface* surface )
39 TextInputInterface* input = static_cast< TextInputInterface* >( data );
40 Seat* seat = input->GetSeat( textInput );
42 input->Enter( seat, surface );
45 void Leave( void* data, WlTextInput* textInput )
47 TextInputInterface* input = static_cast< TextInputInterface* >( data );
48 Seat* seat = input->GetSeat( textInput );
53 void ModifiersMap( void* data, WlTextInput* textInput, struct wl_array* map )
55 TextInputInterface* input = static_cast< TextInputInterface* >( data );
56 Seat* seat = input->GetSeat( textInput );
58 input->ModifiersMap( seat, map );
61 void InputPanelState( void* data, WlTextInput* textInput, uint32_t state )
63 TextInputInterface* input = static_cast< TextInputInterface* >( data );
64 Seat* seat = input->GetSeat( textInput );
66 input->InputPanelState( seat, state );
69 void PreeditString( void* data, WlTextInput* textInput, uint32_t serial, const char* text, const char* commit )
71 TextInputInterface* input = static_cast< TextInputInterface* >( data );
72 Seat* seat = input->GetSeat( textInput );
74 input->PreeditString( seat, serial, text, commit );
77 void PreeditStyling( void* data, WlTextInput* textInput, uint32_t index, uint32_t length, uint32_t style)
79 TextInputInterface* input = static_cast< TextInputInterface* >( data );
80 Seat* seat = input->GetSeat( textInput );
82 input->PreeditStyling( seat, index, length, style );
85 void PreeditCursor(void* data,
86 WlTextInput* textInput,
90 TextInputInterface* input = static_cast< TextInputInterface* >( data );
91 Seat* seat = input->GetSeat( textInput );
93 input->PreeditCursor( seat, index );
96 void CommitString(void* data,
97 WlTextInput* textInput,
101 TextInputInterface* input = static_cast< TextInputInterface* >( data );
102 Seat* seat = input->GetSeat( textInput );
104 input->CommitString( seat, serial, text );
107 void CursorPosition(void* data,
108 WlTextInput* textInput,
112 TextInputInterface* input = static_cast< TextInputInterface* >( data );
113 Seat* seat = input->GetSeat( textInput );
115 input->CursorPosition( seat, index, anchor );
118 void DeleteSurroundingText(void* data,
119 WlTextInput* textInput,
123 TextInputInterface* input = static_cast< TextInputInterface* >( data );
124 Seat* seat = input->GetSeat( textInput );
126 input->DeleteSurroundingText( seat, index, length );
129 void Keysym(void* data,
130 WlTextInput* textInput,
137 TextInputInterface* input = static_cast< TextInputInterface* >( data );
138 Seat* seat = input->GetSeat( textInput );
140 input->Keysym( seat, serial, time, sym, state, modifiers );
143 void Language(void* data,
144 WlTextInput* textInput,
146 const char* language)
148 TextInputInterface* input = static_cast< TextInputInterface* >( data );
149 Seat* seat = input->GetSeat( textInput );
151 input->Language( seat, serial, language );
154 void TextDirection(void* data,
155 WlTextInput* textInput,
159 TextInputInterface* input = static_cast< TextInputInterface* >( data );
160 Seat* seat = input->GetSeat( textInput );
162 input->TextDirection( seat, serial, direction );
165 void SelectionRegion(void* data,
166 WlTextInput* textInput,
171 TextInputInterface* input = static_cast< TextInputInterface* >( data );
172 Seat* seat = input->GetSeat( textInput );
174 input->SelectionRegion( seat, serial, start, end );
177 void PrivateCommand(void* data,
178 WlTextInput* textInput,
182 TextInputInterface* input = static_cast< TextInputInterface* >( data );
183 Seat* seat = input->GetSeat( textInput );
185 input->PrivateCommand( seat, serial, command );
188 void InputPanelGeometry(void* data,
189 WlTextInput* textInput,
195 TextInputInterface* input = static_cast< TextInputInterface* >( data );
196 Seat* seat = input->GetSeat( textInput );
198 input->InputPanelGeometry( seat, x, y, width, height );
201 void InputPanelData( void* data,
202 WlTextInput* textInput,
204 const char* input_panel_data,
205 uint32_t input_panel_data_length)
207 TextInputInterface* input = static_cast< TextInputInterface* >( data );
208 Seat* seat = input->GetSeat( textInput );
210 input->InputPanelData( seat, serial, input_panel_data, input_panel_data_length);
215 * If when running DALi on target a message like
216 * listener function for opcode 16 of wl_text_input is NULL,
217 * then it means the interface has been updated, and they've added an extra function
220 const WlTextInputListener TextInputListener =
231 DeleteSurroundingText,
241 } // unnamed namespace
247 const WlTextInputListener* GetTextInputListener()
249 return &TextInputListener;