lib/WL/xdg_shell.pm untested

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