lib/WL/text.pm untested

filter: Statementstmt 0.0% 0 / 295 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 78 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 412 CC 14 SCAR 35.3
CC
14
Cov
0%
callback
210.0
activate
2.0
deactivate
2.0
CRAP 34.0
1 # DO NOT EDIT, PRETTY PLEASE!
2 # This file is automatically generated by wl-scanner.pl
3 #
4  
5 use strict;
6 use warnings;
7 use utf8;
8  
9 =encoding utf8
10 =cut
11  
12 =head1 NAME
13  
14 WL::text - Perl binding for text protocol
15  
16 =head1 SYNOPSIS
17  
18 use WL::text;
19  
20 =head1 DESCRIPTION
21  
22 B<WL::text> is a package generated from Wayland protocol definition
23 using L<wl-scanner.pl>. It implements L<WL::Base> subclasses with wrappers
24 for requests, event processing and constants for enums.
25  
26 It is not indended to be used directly. Instead, see L<WL::Connection> to see
27 how to obtain the object instances.
28  
29 To see how to attach event callbacks and issue requests, please refer to
30 L<WL::Base> base class.
31  
32 Until proper documentation is finished, please refer to documentation of C
33 bindings of the generated code (it is intended to be readable) to see what
34 arguments to give to requests and expect from events.
35  
36 Please consider this an alpha quality code, whose API can change at any time,
37 until we reach version 1.0.
38  
39 =cut
40  
41 package WL::text;
42  
43 our $VERSION = 0.92;
44  
45 package WL::wl_text_input;
46  
47 our @ISA = qw/WL::Base/;
48 our $VERSION = 1;
49 our $INTERFACE = 'wl_text_input';
50  
51 # Requests
52 use constant REQUEST_ACTIVATE => 0;
53 use constant REQUEST_DEACTIVATE => 1;
54 use constant REQUEST_SHOW_INPUT_PANEL => 2;
55 use constant REQUEST_HIDE_INPUT_PANEL => 3;
56 use constant REQUEST_RESET => 4;
57 use constant REQUEST_SET_SURROUNDING_TEXT => 5;
58 use constant REQUEST_SET_CONTENT_TYPE => 6;
59 use constant REQUEST_SET_CURSOR_RECTANGLE => 7;
60 use constant REQUEST_SET_PREFERRED_LANGUAGE => 8;
61 use constant REQUEST_COMMIT_STATE => 9;
62 use constant REQUEST_INVOKE_ACTION => 10;
63  
64 sub activate
65 {
66 my $self = shift;
67 my $file;
68 my $retval;
69  
70 $self->call (REQUEST_ACTIVATE, pack ('L L',
71 shift->{id},
72 shift->{id}), $file);
73  
74 return $retval;
75 }
76  
77 sub deactivate
78 {
79 my $self = shift;
80 my $file;
81 my $retval;
82  
83 $self->call (REQUEST_DEACTIVATE, pack ('L',
84 shift->{id}), $file);
85  
86 return $retval;
87 }
88  
89 sub show_input_panel
90 {
91 my $self = shift;
92 my $file;
93 my $retval;
94  
95 $self->call (REQUEST_SHOW_INPUT_PANEL, pack ('',
96 ), $file);
97  
98 return $retval;
99 }
100  
101 sub hide_input_panel
102 {
103 my $self = shift;
104 my $file;
105 my $retval;
106  
107 $self->call (REQUEST_HIDE_INPUT_PANEL, pack ('',
108 ), $file);
109  
110 return $retval;
111 }
112  
113 sub reset
114 {
115 my $self = shift;
116 my $file;
117 my $retval;
118  
119 $self->call (REQUEST_RESET, pack ('',
120 ), $file);
121  
122 return $retval;
123 }
124  
125 sub set_surrounding_text
126 {
127 my $self = shift;
128 my $file;
129 my $retval;
130  
131 $self->call (REQUEST_SET_SURROUNDING_TEXT, pack ('L/ax!4 L L',
132 shift."\x00",
133 shift,
134 shift), $file);
135  
136 return $retval;
137 }
138  
139 sub set_content_type
140 {
141 my $self = shift;
142 my $file;
143 my $retval;
144  
145 $self->call (REQUEST_SET_CONTENT_TYPE, pack ('L L',
146 shift,
147 shift), $file);
148  
149 return $retval;
150 }
151  
152 sub set_cursor_rectangle
153 {
154 my $self = shift;
155 my $file;
156 my $retval;
157  
158 $self->call (REQUEST_SET_CURSOR_RECTANGLE, pack ('l l l l',
159 shift,
160 shift,
161 shift,
162 shift), $file);
163  
164 return $retval;
165 }
166  
167 sub set_preferred_language
168 {
169 my $self = shift;
170 my $file;
171 my $retval;
172  
173 $self->call (REQUEST_SET_PREFERRED_LANGUAGE, pack ('L/ax!4',
174 shift."\x00"), $file);
175  
176 return $retval;
177 }
178  
179 sub commit_state
180 {
181 my $self = shift;
182 my $file;
183 my $retval;
184  
185 $self->call (REQUEST_COMMIT_STATE, pack ('L',
186 shift), $file);
187  
188 return $retval;
189 }
190  
191 sub invoke_action
192 {
193 my $self = shift;
194 my $file;
195 my $retval;
196  
197 $self->call (REQUEST_INVOKE_ACTION, pack ('L L',
198 shift,
199 shift), $file);
200  
201 return $retval;
202 }
203  
204 # Events
205 use constant EVENT_ENTER => 0;
206 use constant EVENT_LEAVE => 1;
207 use constant EVENT_MODIFIERS_MAP => 2;
208 use constant EVENT_INPUT_PANEL_STATE => 3;
209 use constant EVENT_PREEDIT_STRING => 4;
210 use constant EVENT_PREEDIT_STYLING => 5;
211 use constant EVENT_PREEDIT_CURSOR => 6;
212 use constant EVENT_COMMIT_STRING => 7;
213 use constant EVENT_CURSOR_POSITION => 8;
214 use constant EVENT_DELETE_SURROUNDING_TEXT => 9;
215 use constant EVENT_KEYSYM => 10;
216 use constant EVENT_LANGUAGE => 11;
217 use constant EVENT_TEXT_DIRECTION => 12;
218  
219 sub callback
220 {
221 my $self = shift;
222 my $opcode = shift;
223  
224 if ($opcode == EVENT_ENTER) {
225 @_ = unpack ('L', shift);
226 return $self->enter (new WL::wl_surface ($self->{conn}, shift));
227 } elsif ($opcode == EVENT_LEAVE) {
228 return $self->leave ();
229 } elsif ($opcode == EVENT_MODIFIERS_MAP) {
230 @_ = unpack ('L/ax!4', shift);
231 return $self->modifiers_map (shift);
232 } elsif ($opcode == EVENT_INPUT_PANEL_STATE) {
233 @_ = unpack ('L', shift);
234 return $self->input_panel_state (shift);
235 } elsif ($opcode == EVENT_PREEDIT_STRING) {
236 @_ = unpack ('L L/ax!4 L/ax!4', shift);
237 return $self->preedit_string (shift,
238 [shift =~ /(.*)./]->[0],
239 [shift =~ /(.*)./]->[0]);
240 } elsif ($opcode == EVENT_PREEDIT_STYLING) {
241 @_ = unpack ('L L L', shift);
242 return $self->preedit_styling (shift,
243 shift,
244 shift);
245 } elsif ($opcode == EVENT_PREEDIT_CURSOR) {
246 @_ = unpack ('l', shift);
247 return $self->preedit_cursor (shift);
248 } elsif ($opcode == EVENT_COMMIT_STRING) {
249 @_ = unpack ('L L/ax!4', shift);
250 return $self->commit_string (shift,
251 [shift =~ /(.*)./]->[0]);
252 } elsif ($opcode == EVENT_CURSOR_POSITION) {
253 @_ = unpack ('l l', shift);
254 return $self->cursor_position (shift,
255 shift);
256 } elsif ($opcode == EVENT_DELETE_SURROUNDING_TEXT) {
257 @_ = unpack ('l L', shift);
258 return $self->delete_surrounding_text (shift,
259 shift);
260 } elsif ($opcode == EVENT_KEYSYM) {
261 @_ = unpack ('L L L L L', shift);
262 return $self->keysym (shift,
263 shift,
264 shift,
265 shift,
266 shift);
267 } elsif ($opcode == EVENT_LANGUAGE) {
268 @_ = unpack ('L L/ax!4', shift);
269 return $self->language (shift,
270 [shift =~ /(.*)./]->[0]);
271 } elsif ($opcode == EVENT_TEXT_DIRECTION) {
272 @_ = unpack ('L L', shift);
273 return $self->text_direction (shift,
274 shift);
275 } else {
276 die 'Bad opcode';
277 }
278 }
279  
280 # Enums
281 use constant CONTENT_HINT_NONE => 0x0;
282 use constant CONTENT_HINT_DEFAULT => 0x7;
283 use constant CONTENT_HINT_PASSWORD => 0xc0;
284 use constant CONTENT_HINT_AUTO_COMPLETION => 0x1;
285 use constant CONTENT_HINT_AUTO_CORRECTION => 0x2;
286 use constant CONTENT_HINT_AUTO_CAPITALIZATION => 0x4;
287 use constant CONTENT_HINT_LOWERCASE => 0x8;
288 use constant CONTENT_HINT_UPPERCASE => 0x10;
289 use constant CONTENT_HINT_TITLECASE => 0x20;
290 use constant CONTENT_HINT_HIDDEN_TEXT => 0x40;
291 use constant CONTENT_HINT_SENSITIVE_DATA => 0x80;
292 use constant CONTENT_HINT_LATIN => 0x100;
293 use constant CONTENT_HINT_MULTILINE => 0x200;
294 use constant CONTENT_PURPOSE_NORMAL => 0;
295 use constant CONTENT_PURPOSE_ALPHA => 1;
296 use constant CONTENT_PURPOSE_DIGITS => 2;
297 use constant CONTENT_PURPOSE_NUMBER => 3;
298 use constant CONTENT_PURPOSE_PHONE => 4;
299 use constant CONTENT_PURPOSE_URL => 5;
300 use constant CONTENT_PURPOSE_EMAIL => 6;
301 use constant CONTENT_PURPOSE_NAME => 7;
302 use constant CONTENT_PURPOSE_PASSWORD => 8;
303 use constant CONTENT_PURPOSE_DATE => 9;
304 use constant CONTENT_PURPOSE_TIME => 10;
305 use constant CONTENT_PURPOSE_DATETIME => 11;
306 use constant CONTENT_PURPOSE_TERMINAL => 12;
307 use constant PREEDIT_STYLE_DEFAULT => 0;
308 use constant PREEDIT_STYLE_NONE => 1;
309 use constant PREEDIT_STYLE_ACTIVE => 2;
310 use constant PREEDIT_STYLE_INACTIVE => 3;
311 use constant PREEDIT_STYLE_HIGHLIGHT => 4;
312 use constant PREEDIT_STYLE_UNDERLINE => 5;
313 use constant PREEDIT_STYLE_SELECTION => 6;
314 use constant PREEDIT_STYLE_INCORRECT => 7;
315 use constant TEXT_DIRECTION_AUTO => 0;
316 use constant TEXT_DIRECTION_LTR => 1;
317 use constant TEXT_DIRECTION_RTL => 2;
318  
319 package WL::wl_text_input_manager;
320  
321 our @ISA = qw/WL::Base/;
322 our $VERSION = 1;
323 our $INTERFACE = 'wl_text_input_manager';
324  
325 # Requests
326 use constant REQUEST_CREATE_TEXT_INPUT => 0;
327  
328 sub create_text_input
329 {
330 my $self = shift;
331 my $file;
332 my $retval;
333  
334 $self->call (REQUEST_CREATE_TEXT_INPUT, pack ('L',
335 ($retval = new WL::wl_text_input ($self->{conn}))->{id}), $file);
336  
337 return $retval;
338 }
339  
340  
341 =head1 BUGS
342  
343 The interface documentation for the bindings is lacking.
344  
345 Only client part implemented, not server.
346  
347 =head1 SEE ALSO
348  
349 =over
350  
351 =item *
352  
353 L<http://wayland.freedesktop.org/> -- Wayland project web site
354  
355 =item *
356  
357 L<wl-draw.pl> -- Example Wayland client
358  
359 =item *
360  
361 L<wl-scanner.pl> -- Tool that generated this module
362  
363 =item *
364  
365 L<WL::Base> -- Base class for Wayland objects
366  
367 =item *
368  
369 L<WL::Connection> -- Estabilish a Wayland connection
370  
371 =back
372  
373 =head1 COPYRIGHT
374  
375 Copyright 2013, 2014 Lubomir Rintel
376  
377 This program is free software; you can redistribute it and/or modify it
378 under the same terms as Perl itself.
379  
380 Copyright notice from the protocol definition file:
381  
382 Copyright © 2012, 2013 Intel Corporation
383
384 Permission to use, copy, modify, distribute, and sell this
385 software and its documentation for any purpose is hereby granted
386 without fee, provided that the above copyright notice appear in
387 all copies and that both that copyright notice and this permission
388 notice appear in supporting documentation, and that the name of
389 the copyright holders not be used in advertising or publicity
390 pertaining to distribution of the software without specific,
391 written prior permission. The copyright holders make no
392 representations about the suitability of this software for any
393 purpose. It is provided "as is" without express or implied
394 warranty.
395
396 THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
397 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
398 FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
399 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
400 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
401 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
402 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
403 THIS SOFTWARE.
404  
405 =head1 AUTHORS
406  
407 Lubomir Rintel C<lkundrak@v3.sk>
408  
409 =cut
410