lib/WL/input_method.pm untested

filter: Statementstmt 0.0% 0 / 212 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 48 Podpod 0.0% 0 / 19 totaltotal 0.0% 0 / 295 CC 9 SCAR 22.3
CC
9
Cov
0%
callback
56.0
callback
12.0
destroy
2.0
CRAP 9.3
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::input_method - Perl binding for input_method protocol
15  
16 =head1 SYNOPSIS
17  
18 use WL::input_method;
19  
20 =head1 DESCRIPTION
21  
22 B<WL::input_method> 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::input_method;
42  
43 our $VERSION = 0.92;
44  
45 package WL::wl_input_method_context;
46  
47 our @ISA = qw/WL::Base/;
48 our $VERSION = 1;
49 our $INTERFACE = 'wl_input_method_context';
50  
51 # Requests
52 use constant REQUEST_DESTROY => 0;
53 use constant REQUEST_COMMIT_STRING => 1;
54 use constant REQUEST_PREEDIT_STRING => 2;
55 use constant REQUEST_PREEDIT_STYLING => 3;
56 use constant REQUEST_PREEDIT_CURSOR => 4;
57 use constant REQUEST_DELETE_SURROUNDING_TEXT => 5;
58 use constant REQUEST_CURSOR_POSITION => 6;
59 use constant REQUEST_MODIFIERS_MAP => 7;
60 use constant REQUEST_KEYSYM => 8;
61 use constant REQUEST_GRAB_KEYBOARD => 9;
62 use constant REQUEST_KEY => 10;
63 use constant REQUEST_MODIFIERS => 11;
64 use constant REQUEST_LANGUAGE => 12;
65 use constant REQUEST_TEXT_DIRECTION => 13;
66  
67 sub destroy
68 {
69 my $self = shift;
70 my $file;
71 my $retval;
72  
73 $self->call (REQUEST_DESTROY, pack ('',
74 ), $file);
75  
76 return $retval;
77 }
78  
79 sub commit_string
80 {
81 my $self = shift;
82 my $file;
83 my $retval;
84  
85 $self->call (REQUEST_COMMIT_STRING, pack ('L L/ax!4',
86 shift,
87 shift."\x00"), $file);
88  
89 return $retval;
90 }
91  
92 sub preedit_string
93 {
94 my $self = shift;
95 my $file;
96 my $retval;
97  
98 $self->call (REQUEST_PREEDIT_STRING, pack ('L L/ax!4 L/ax!4',
99 shift,
100 shift."\x00",
101 shift."\x00"), $file);
102  
103 return $retval;
104 }
105  
106 sub preedit_styling
107 {
108 my $self = shift;
109 my $file;
110 my $retval;
111  
112 $self->call (REQUEST_PREEDIT_STYLING, pack ('L L L',
113 shift,
114 shift,
115 shift), $file);
116  
117 return $retval;
118 }
119  
120 sub preedit_cursor
121 {
122 my $self = shift;
123 my $file;
124 my $retval;
125  
126 $self->call (REQUEST_PREEDIT_CURSOR, pack ('l',
127 shift), $file);
128  
129 return $retval;
130 }
131  
132 sub delete_surrounding_text
133 {
134 my $self = shift;
135 my $file;
136 my $retval;
137  
138 $self->call (REQUEST_DELETE_SURROUNDING_TEXT, pack ('l L',
139 shift,
140 shift), $file);
141  
142 return $retval;
143 }
144  
145 sub cursor_position
146 {
147 my $self = shift;
148 my $file;
149 my $retval;
150  
151 $self->call (REQUEST_CURSOR_POSITION, pack ('l l',
152 shift,
153 shift), $file);
154  
155 return $retval;
156 }
157  
158 sub modifiers_map
159 {
160 my $self = shift;
161 my $file;
162 my $retval;
163  
164 $self->call (REQUEST_MODIFIERS_MAP, pack ('L/ax!4',
165 shift), $file);
166  
167 return $retval;
168 }
169  
170 sub keysym
171 {
172 my $self = shift;
173 my $file;
174 my $retval;
175  
176 $self->call (REQUEST_KEYSYM, pack ('L L L L L',
177 shift,
178 shift,
179 shift,
180 shift,
181 shift), $file);
182  
183 return $retval;
184 }
185  
186 sub grab_keyboard
187 {
188 my $self = shift;
189 my $file;
190 my $retval;
191  
192 $self->call (REQUEST_GRAB_KEYBOARD, pack ('L',
193 ($retval = new WL::wl_keyboard ($self->{conn}))->{id}), $file);
194  
195 return $retval;
196 }
197  
198 sub key
199 {
200 my $self = shift;
201 my $file;
202 my $retval;
203  
204 $self->call (REQUEST_KEY, pack ('L L L L',
205 shift,
206 shift,
207 shift,
208 shift), $file);
209  
210 return $retval;
211 }
212  
213 sub modifiers
214 {
215 my $self = shift;
216 my $file;
217 my $retval;
218  
219 $self->call (REQUEST_MODIFIERS, pack ('L L L L L',
220 shift,
221 shift,
222 shift,
223 shift,
224 shift), $file);
225  
226 return $retval;
227 }
228  
229 sub language
230 {
231 my $self = shift;
232 my $file;
233 my $retval;
234  
235 $self->call (REQUEST_LANGUAGE, pack ('L L/ax!4',
236 shift,
237 shift."\x00"), $file);
238  
239 return $retval;
240 }
241  
242 sub text_direction
243 {
244 my $self = shift;
245 my $file;
246 my $retval;
247  
248 $self->call (REQUEST_TEXT_DIRECTION, pack ('L L',
249 shift,
250 shift), $file);
251  
252 return $retval;
253 }
254  
255 # Events
256 use constant EVENT_SURROUNDING_TEXT => 0;
257 use constant EVENT_RESET => 1;
258 use constant EVENT_CONTENT_TYPE => 2;
259 use constant EVENT_INVOKE_ACTION => 3;
260 use constant EVENT_COMMIT_STATE => 4;
261 use constant EVENT_PREFERRED_LANGUAGE => 5;
262  
263 sub callback
264 {
265 my $self = shift;
266 my $opcode = shift;
267  
268 if ($opcode == EVENT_SURROUNDING_TEXT) {
269 @_ = unpack ('L/ax!4 L L', shift);
270 return $self->surrounding_text ([shift =~ /(.*)./]->[0],
271 shift,
272 shift);
273 } elsif ($opcode == EVENT_RESET) {
274 return $self->reset ();
275 } elsif ($opcode == EVENT_CONTENT_TYPE) {
276 @_ = unpack ('L L', shift);
277 return $self->content_type (shift,
278 shift);
279 } elsif ($opcode == EVENT_INVOKE_ACTION) {
280 @_ = unpack ('L L', shift);
281 return $self->invoke_action (shift,
282 shift);
283 } elsif ($opcode == EVENT_COMMIT_STATE) {
284 @_ = unpack ('L', shift);
285 return $self->commit_state (shift);
286 } elsif ($opcode == EVENT_PREFERRED_LANGUAGE) {
287 @_ = unpack ('L/ax!4', shift);
288 return $self->preferred_language ([shift =~ /(.*)./]->[0]);
289 } else {
290 die 'Bad opcode';
291 }
292 }
293  
294 package WL::wl_input_method;
295  
296 our @ISA = qw/WL::Base/;
297 our $VERSION = 1;
298 our $INTERFACE = 'wl_input_method';
299  
300 # Events
301 use constant EVENT_ACTIVATE => 0;
302 use constant EVENT_DEACTIVATE => 1;
303  
304 sub callback
305 {
306 my $self = shift;
307 my $opcode = shift;
308  
309 if ($opcode == EVENT_ACTIVATE) {
310 @_ = unpack ('L', shift);
311 return $self->activate (new WL::wl_input_method_context ($self->{conn}));
312 } elsif ($opcode == EVENT_DEACTIVATE) {
313 @_ = unpack ('L', shift);
314 return $self->deactivate (new WL::wl_input_method_context ($self->{conn}, shift));
315 } else {
316 die 'Bad opcode';
317 }
318 }
319  
320 package WL::wl_input_panel;
321  
322 our @ISA = qw/WL::Base/;
323 our $VERSION = 1;
324 our $INTERFACE = 'wl_input_panel';
325  
326 # Requests
327 use constant REQUEST_GET_INPUT_PANEL_SURFACE => 0;
328  
329 sub get_input_panel_surface
330 {
331 my $self = shift;
332 my $file;
333 my $retval;
334  
335 $self->call (REQUEST_GET_INPUT_PANEL_SURFACE, pack ('L L',
336 ($retval = new WL::wl_input_panel_surface ($self->{conn}))->{id},
337 shift->{id}), $file);
338  
339 return $retval;
340 }
341  
342 package WL::wl_input_panel_surface;
343  
344 our @ISA = qw/WL::Base/;
345 our $VERSION = 1;
346 our $INTERFACE = 'wl_input_panel_surface';
347  
348 # Requests
349 use constant REQUEST_SET_TOPLEVEL => 0;
350 use constant REQUEST_SET_OVERLAY_PANEL => 1;
351  
352 sub set_toplevel
353 {
354 my $self = shift;
355 my $file;
356 my $retval;
357  
358 $self->call (REQUEST_SET_TOPLEVEL, pack ('L L',
359 shift->{id},
360 shift), $file);
361  
362 return $retval;
363 }
364  
365 sub set_overlay_panel
366 {
367 my $self = shift;
368 my $file;
369 my $retval;
370  
371 $self->call (REQUEST_SET_OVERLAY_PANEL, pack ('',
372 ), $file);
373  
374 return $retval;
375 }
376  
377 # Enums
378 use constant POSITION_CENTER_BOTTOM => 0;
379  
380  
381 =head1 BUGS
382  
383 The interface documentation for the bindings is lacking.
384  
385 Only client part implemented, not server.
386  
387 =head1 SEE ALSO
388  
389 =over
390  
391 =item *
392  
393 L<http://wayland.freedesktop.org/> -- Wayland project web site
394  
395 =item *
396  
397 L<wl-draw.pl> -- Example Wayland client
398  
399 =item *
400  
401 L<wl-scanner.pl> -- Tool that generated this module
402  
403 =item *
404  
405 L<WL::Base> -- Base class for Wayland objects
406  
407 =item *
408  
409 L<WL::Connection> -- Estabilish a Wayland connection
410  
411 =back
412  
413 =head1 COPYRIGHT
414  
415 Copyright 2013, 2014 Lubomir Rintel
416  
417 This program is free software; you can redistribute it and/or modify it
418 under the same terms as Perl itself.
419  
420 Copyright notice from the protocol definition file:
421  
422 Copyright © 2012, 2013 Intel Corporation
423
424 Permission to use, copy, modify, distribute, and sell this
425 software and its documentation for any purpose is hereby granted
426 without fee, provided that the above copyright notice appear in
427 all copies and that both that copyright notice and this permission
428 notice appear in supporting documentation, and that the name of
429 the copyright holders not be used in advertising or publicity
430 pertaining to distribution of the software without specific,
431 written prior permission. The copyright holders make no
432 representations about the suitability of this software for any
433 purpose. It is provided "as is" without express or implied
434 warranty.
435
436 THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
437 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
438 FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
439 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
440 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
441 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
442 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
443 THIS SOFTWARE.
444  
445 =head1 AUTHORS
446  
447 Lubomir Rintel C<lkundrak@v3.sk>
448  
449 =cut
450