lib/WL.pm untested

filter: Statementstmt 0.0% 0 / 1132 Branchbran 0.0% 0 / 86 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 282 Podpod 0.0% 0 / 72 totaltotal 0.0% 0 / 1572 CC 44 SCAR 19.1
CC
44
Cov
0%
callback
56.0
callback
42.0
callback
42.0
CRAP 6.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 - Perl binding for wayland protocol
15  
16 =head1 SYNOPSIS
17  
18 use WL;
19  
20 =head1 DESCRIPTION
21  
22 B<WL> 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;
42  
43 our $VERSION = 0.92;
44  
45 package WL::wl_display;
46  
47 our @ISA = qw/WL::Base/;
48 our $VERSION = 1;
49 our $INTERFACE = 'wl_display';
50  
51 # Requests
52 use constant REQUEST_SYNC => 0;
53 use constant REQUEST_GET_REGISTRY => 1;
54  
55 sub sync
56 {
57 my $self = shift;
58 my $file;
59 my $retval;
60  
61 $self->call (REQUEST_SYNC, pack ('L',
62 ($retval = new WL::wl_callback ($self->{conn}))->{id}), $file);
63  
64 return $retval;
65 }
66  
67 sub get_registry
68 {
69 my $self = shift;
70 my $file;
71 my $retval;
72  
73 $self->call (REQUEST_GET_REGISTRY, pack ('L',
74 ($retval = new WL::wl_registry ($self->{conn}))->{id}), $file);
75  
76 return $retval;
77 }
78  
79 # Events
80 use constant EVENT_ERROR => 0;
81 use constant EVENT_DELETE_ID => 1;
82  
83 sub callback
84 {
85 my $self = shift;
86 my $opcode = shift;
87  
88 if ($opcode == EVENT_ERROR) {
89 @_ = unpack ('L L L/ax!4', shift);
90 return $self->error (new WL::Base ($self->{conn}, shift),
91 shift,
92 [shift =~ /(.*)./]->[0]);
93 } elsif ($opcode == EVENT_DELETE_ID) {
94 @_ = unpack ('L', shift);
95 return $self->delete_id (shift);
96 } else {
97 die 'Bad opcode';
98 }
99 }
100  
101 # Enums
102 use constant ERROR_INVALID_OBJECT => 0;
103 use constant ERROR_INVALID_METHOD => 1;
104 use constant ERROR_NO_MEMORY => 2;
105  
106 package WL::wl_registry;
107  
108 our @ISA = qw/WL::Base/;
109 our $VERSION = 1;
110 our $INTERFACE = 'wl_registry';
111  
112 # Requests
113 use constant REQUEST_BIND => 0;
114  
115 sub bind
116 {
117 my $self = shift;
118 my $file;
119 my $retval;
120  
121 $self->call (REQUEST_BIND, pack ('L L/ax!4 L L',
122 shift,
123 $_[0]."\x00", delete $_[1], ($retval = ("WL::".shift)->new ($self->{conn}))->{id}), $file);
124  
125 return $retval;
126 }
127  
128 # Events
129 use constant EVENT_GLOBAL => 0;
130 use constant EVENT_GLOBAL_REMOVE => 1;
131  
132 sub callback
133 {
134 my $self = shift;
135 my $opcode = shift;
136  
137 if ($opcode == EVENT_GLOBAL) {
138 @_ = unpack ('L L/ax!4 L', shift);
139 return $self->global (shift,
140 [shift =~ /(.*)./]->[0],
141 shift);
142 } elsif ($opcode == EVENT_GLOBAL_REMOVE) {
143 @_ = unpack ('L', shift);
144 return $self->global_remove (shift);
145 } else {
146 die 'Bad opcode';
147 }
148 }
149  
150 package WL::wl_callback;
151  
152 our @ISA = qw/WL::Base/;
153 our $VERSION = 1;
154 our $INTERFACE = 'wl_callback';
155  
156 # Events
157 use constant EVENT_DONE => 0;
158  
159 sub callback
160 {
161 my $self = shift;
162 my $opcode = shift;
163  
164 if ($opcode == EVENT_DONE) {
165 @_ = unpack ('L', shift);
166 return $self->done (shift);
167 } else {
168 die 'Bad opcode';
169 }
170 }
171  
172 package WL::wl_compositor;
173  
174 our @ISA = qw/WL::Base/;
175 our $VERSION = 3;
176 our $INTERFACE = 'wl_compositor';
177  
178 # Requests
179 use constant REQUEST_CREATE_SURFACE => 0;
180 use constant REQUEST_CREATE_REGION => 1;
181  
182 sub create_surface
183 {
184 my $self = shift;
185 my $file;
186 my $retval;
187  
188 $self->call (REQUEST_CREATE_SURFACE, pack ('L',
189 ($retval = new WL::wl_surface ($self->{conn}))->{id}), $file);
190  
191 return $retval;
192 }
193  
194 sub create_region
195 {
196 my $self = shift;
197 my $file;
198 my $retval;
199  
200 $self->call (REQUEST_CREATE_REGION, pack ('L',
201 ($retval = new WL::wl_region ($self->{conn}))->{id}), $file);
202  
203 return $retval;
204 }
205  
206 package WL::wl_shm_pool;
207  
208 our @ISA = qw/WL::Base/;
209 our $VERSION = 1;
210 our $INTERFACE = 'wl_shm_pool';
211  
212 # Requests
213 use constant REQUEST_CREATE_BUFFER => 0;
214 use constant REQUEST_DESTROY => 1;
215 use constant REQUEST_RESIZE => 2;
216  
217 sub create_buffer
218 {
219 my $self = shift;
220 my $file;
221 my $retval;
222  
223 $self->call (REQUEST_CREATE_BUFFER, pack ('L l l l l L',
224 ($retval = new WL::wl_buffer ($self->{conn}))->{id},
225 shift,
226 shift,
227 shift,
228 shift,
229 shift), $file);
230  
231 return $retval;
232 }
233  
234 sub destroy
235 {
236 my $self = shift;
237 my $file;
238 my $retval;
239  
240 $self->call (REQUEST_DESTROY, pack ('',
241 ), $file);
242  
243 return $retval;
244 }
245  
246 sub resize
247 {
248 my $self = shift;
249 my $file;
250 my $retval;
251  
252 $self->call (REQUEST_RESIZE, pack ('l',
253 shift), $file);
254  
255 return $retval;
256 }
257  
258 package WL::wl_shm;
259  
260 our @ISA = qw/WL::Base/;
261 our $VERSION = 1;
262 our $INTERFACE = 'wl_shm';
263  
264 # Requests
265 use constant REQUEST_CREATE_POOL => 0;
266  
267 sub create_pool
268 {
269 my $self = shift;
270 my $file;
271 my $retval;
272  
273 $self->call (REQUEST_CREATE_POOL, pack ('L l',
274 ($retval = new WL::wl_shm_pool ($self->{conn}))->{id},
275 ($file = shift, ()),
276 shift), $file);
277  
278 return $retval;
279 }
280  
281 # Events
282 use constant EVENT_FORMAT => 0;
283  
284 sub callback
285 {
286 my $self = shift;
287 my $opcode = shift;
288  
289 if ($opcode == EVENT_FORMAT) {
290 @_ = unpack ('L', shift);
291 return $self->format (shift);
292 } else {
293 die 'Bad opcode';
294 }
295 }
296  
297 # Enums
298 use constant ERROR_INVALID_FORMAT => 0;
299 use constant ERROR_INVALID_STRIDE => 1;
300 use constant ERROR_INVALID_FD => 2;
301 use constant FORMAT_ARGB8888 => 0;
302 use constant FORMAT_XRGB8888 => 1;
303 use constant FORMAT_C8 => 0x20203843;
304 use constant FORMAT_RGB332 => 0x38424752;
305 use constant FORMAT_BGR233 => 0x38524742;
306 use constant FORMAT_XRGB4444 => 0x32315258;
307 use constant FORMAT_XBGR4444 => 0x32314258;
308 use constant FORMAT_RGBX4444 => 0x32315852;
309 use constant FORMAT_BGRX4444 => 0x32315842;
310 use constant FORMAT_ARGB4444 => 0x32315241;
311 use constant FORMAT_ABGR4444 => 0x32314241;
312 use constant FORMAT_RGBA4444 => 0x32314152;
313 use constant FORMAT_BGRA4444 => 0x32314142;
314 use constant FORMAT_XRGB1555 => 0x35315258;
315 use constant FORMAT_XBGR1555 => 0x35314258;
316 use constant FORMAT_RGBX5551 => 0x35315852;
317 use constant FORMAT_BGRX5551 => 0x35315842;
318 use constant FORMAT_ARGB1555 => 0x35315241;
319 use constant FORMAT_ABGR1555 => 0x35314241;
320 use constant FORMAT_RGBA5551 => 0x35314152;
321 use constant FORMAT_BGRA5551 => 0x35314142;
322 use constant FORMAT_RGB565 => 0x36314752;
323 use constant FORMAT_BGR565 => 0x36314742;
324 use constant FORMAT_RGB888 => 0x34324752;
325 use constant FORMAT_BGR888 => 0x34324742;
326 use constant FORMAT_XBGR8888 => 0x34324258;
327 use constant FORMAT_RGBX8888 => 0x34325852;
328 use constant FORMAT_BGRX8888 => 0x34325842;
329 use constant FORMAT_ABGR8888 => 0x34324241;
330 use constant FORMAT_RGBA8888 => 0x34324152;
331 use constant FORMAT_BGRA8888 => 0x34324142;
332 use constant FORMAT_XRGB2101010 => 0x30335258;
333 use constant FORMAT_XBGR2101010 => 0x30334258;
334 use constant FORMAT_RGBX1010102 => 0x30335852;
335 use constant FORMAT_BGRX1010102 => 0x30335842;
336 use constant FORMAT_ARGB2101010 => 0x30335241;
337 use constant FORMAT_ABGR2101010 => 0x30334241;
338 use constant FORMAT_RGBA1010102 => 0x30334152;
339 use constant FORMAT_BGRA1010102 => 0x30334142;
340 use constant FORMAT_YUYV => 0x56595559;
341 use constant FORMAT_YVYU => 0x55595659;
342 use constant FORMAT_UYVY => 0x59565955;
343 use constant FORMAT_VYUY => 0x59555956;
344 use constant FORMAT_AYUV => 0x56555941;
345 use constant FORMAT_NV12 => 0x3231564e;
346 use constant FORMAT_NV21 => 0x3132564e;
347 use constant FORMAT_NV16 => 0x3631564e;
348 use constant FORMAT_NV61 => 0x3136564e;
349 use constant FORMAT_YUV410 => 0x39565559;
350 use constant FORMAT_YVU410 => 0x39555659;
351 use constant FORMAT_YUV411 => 0x31315559;
352 use constant FORMAT_YVU411 => 0x31315659;
353 use constant FORMAT_YUV420 => 0x32315559;
354 use constant FORMAT_YVU420 => 0x32315659;
355 use constant FORMAT_YUV422 => 0x36315559;
356 use constant FORMAT_YVU422 => 0x36315659;
357 use constant FORMAT_YUV444 => 0x34325559;
358 use constant FORMAT_YVU444 => 0x34325659;
359  
360 package WL::wl_buffer;
361  
362 our @ISA = qw/WL::Base/;
363 our $VERSION = 1;
364 our $INTERFACE = 'wl_buffer';
365  
366 # Requests
367 use constant REQUEST_DESTROY => 0;
368  
369 sub destroy
370 {
371 my $self = shift;
372 my $file;
373 my $retval;
374  
375 $self->call (REQUEST_DESTROY, pack ('',
376 ), $file);
377  
378 return $retval;
379 }
380  
381 # Events
382 use constant EVENT_RELEASE => 0;
383  
384 sub callback
385 {
386 my $self = shift;
387 my $opcode = shift;
388  
389 if ($opcode == EVENT_RELEASE) {
390 return $self->release ();
391 } else {
392 die 'Bad opcode';
393 }
394 }
395  
396 package WL::wl_data_offer;
397  
398 our @ISA = qw/WL::Base/;
399 our $VERSION = 1;
400 our $INTERFACE = 'wl_data_offer';
401  
402 # Requests
403 use constant REQUEST_ACCEPT => 0;
404 use constant REQUEST_RECEIVE => 1;
405 use constant REQUEST_DESTROY => 2;
406  
407 sub accept
408 {
409 my $self = shift;
410 my $file;
411 my $retval;
412  
413 $self->call (REQUEST_ACCEPT, pack ('L L/ax!4',
414 shift,
415 shift."\x00"), $file);
416  
417 return $retval;
418 }
419  
420 sub receive
421 {
422 my $self = shift;
423 my $file;
424 my $retval;
425  
426 $self->call (REQUEST_RECEIVE, pack ('L/ax!4',
427 shift."\x00",
428 ($file = shift, ())), $file);
429  
430 return $retval;
431 }
432  
433 sub destroy
434 {
435 my $self = shift;
436 my $file;
437 my $retval;
438  
439 $self->call (REQUEST_DESTROY, pack ('',
440 ), $file);
441  
442 return $retval;
443 }
444  
445 # Events
446 use constant EVENT_OFFER => 0;
447  
448 sub callback
449 {
450 my $self = shift;
451 my $opcode = shift;
452  
453 if ($opcode == EVENT_OFFER) {
454 @_ = unpack ('L/ax!4', shift);
455 return $self->offer ([shift =~ /(.*)./]->[0]);
456 } else {
457 die 'Bad opcode';
458 }
459 }
460  
461 package WL::wl_data_source;
462  
463 our @ISA = qw/WL::Base/;
464 our $VERSION = 1;
465 our $INTERFACE = 'wl_data_source';
466  
467 # Requests
468 use constant REQUEST_OFFER => 0;
469 use constant REQUEST_DESTROY => 1;
470  
471 sub offer
472 {
473 my $self = shift;
474 my $file;
475 my $retval;
476  
477 $self->call (REQUEST_OFFER, pack ('L/ax!4',
478 shift."\x00"), $file);
479  
480 return $retval;
481 }
482  
483 sub destroy
484 {
485 my $self = shift;
486 my $file;
487 my $retval;
488  
489 $self->call (REQUEST_DESTROY, pack ('',
490 ), $file);
491  
492 return $retval;
493 }
494  
495 # Events
496 use constant EVENT_TARGET => 0;
497 use constant EVENT_SEND => 1;
498 use constant EVENT_CANCELLED => 2;
499  
500 sub callback
501 {
502 my $self = shift;
503 my $opcode = shift;
504  
505 if ($opcode == EVENT_TARGET) {
506 @_ = unpack ('L/ax!4', shift);
507 return $self->target ([shift =~ /(.*)./]->[0]);
508 } elsif ($opcode == EVENT_SEND) {
509 @_ = unpack ('L/ax!4', shift);
510 return $self->send ([shift =~ /(.*)./]->[0],
511 shift);
512 } elsif ($opcode == EVENT_CANCELLED) {
513 return $self->cancelled ();
514 } else {
515 die 'Bad opcode';
516 }
517 }
518  
519 package WL::wl_data_device;
520  
521 our @ISA = qw/WL::Base/;
522 our $VERSION = 1;
523 our $INTERFACE = 'wl_data_device';
524  
525 # Requests
526 use constant REQUEST_START_DRAG => 0;
527 use constant REQUEST_SET_SELECTION => 1;
528  
529 sub start_drag
530 {
531 my $self = shift;
532 my $file;
533 my $retval;
534  
535 $self->call (REQUEST_START_DRAG, pack ('L L L L',
536 shift->{id},
537 shift->{id},
538 shift->{id},
539 shift), $file);
540  
541 return $retval;
542 }
543  
544 sub set_selection
545 {
546 my $self = shift;
547 my $file;
548 my $retval;
549  
550 $self->call (REQUEST_SET_SELECTION, pack ('L L',
551 shift->{id},
552 shift), $file);
553  
554 return $retval;
555 }
556  
557 # Events
558 use constant EVENT_DATA_OFFER => 0;
559 use constant EVENT_ENTER => 1;
560 use constant EVENT_LEAVE => 2;
561 use constant EVENT_MOTION => 3;
562 use constant EVENT_DROP => 4;
563 use constant EVENT_SELECTION => 5;
564  
565 sub callback
566 {
567 my $self = shift;
568 my $opcode = shift;
569  
570 if ($opcode == EVENT_DATA_OFFER) {
571 @_ = unpack ('L', shift);
572 return $self->data_offer (new WL::wl_data_offer ($self->{conn}));
573 } elsif ($opcode == EVENT_ENTER) {
574 @_ = unpack ('L L L L L', shift);
575 return $self->enter (shift,
576 new WL::wl_surface ($self->{conn}, shift),
577 $self->fixed2nv (shift),
578 $self->fixed2nv (shift),
579 new WL::wl_data_offer ($self->{conn}, shift));
580 } elsif ($opcode == EVENT_LEAVE) {
581 return $self->leave ();
582 } elsif ($opcode == EVENT_MOTION) {
583 @_ = unpack ('L L L', shift);
584 return $self->motion (shift,
585 $self->fixed2nv (shift),
586 $self->fixed2nv (shift));
587 } elsif ($opcode == EVENT_DROP) {
588 return $self->drop ();
589 } elsif ($opcode == EVENT_SELECTION) {
590 @_ = unpack ('L', shift);
591 return $self->selection (new WL::wl_data_offer ($self->{conn}, shift));
592 } else {
593 die 'Bad opcode';
594 }
595 }
596  
597 package WL::wl_data_device_manager;
598  
599 our @ISA = qw/WL::Base/;
600 our $VERSION = 1;
601 our $INTERFACE = 'wl_data_device_manager';
602  
603 # Requests
604 use constant REQUEST_CREATE_DATA_SOURCE => 0;
605 use constant REQUEST_GET_DATA_DEVICE => 1;
606  
607 sub create_data_source
608 {
609 my $self = shift;
610 my $file;
611 my $retval;
612  
613 $self->call (REQUEST_CREATE_DATA_SOURCE, pack ('L',
614 ($retval = new WL::wl_data_source ($self->{conn}))->{id}), $file);
615  
616 return $retval;
617 }
618  
619 sub get_data_device
620 {
621 my $self = shift;
622 my $file;
623 my $retval;
624  
625 $self->call (REQUEST_GET_DATA_DEVICE, pack ('L L',
626 ($retval = new WL::wl_data_device ($self->{conn}))->{id},
627 shift->{id}), $file);
628  
629 return $retval;
630 }
631  
632 package WL::wl_shell;
633  
634 our @ISA = qw/WL::Base/;
635 our $VERSION = 1;
636 our $INTERFACE = 'wl_shell';
637  
638 # Requests
639 use constant REQUEST_GET_SHELL_SURFACE => 0;
640  
641 sub get_shell_surface
642 {
643 my $self = shift;
644 my $file;
645 my $retval;
646  
647 $self->call (REQUEST_GET_SHELL_SURFACE, pack ('L L',
648 ($retval = new WL::wl_shell_surface ($self->{conn}))->{id},
649 shift->{id}), $file);
650  
651 return $retval;
652 }
653  
654 package WL::wl_shell_surface;
655  
656 our @ISA = qw/WL::Base/;
657 our $VERSION = 1;
658 our $INTERFACE = 'wl_shell_surface';
659  
660 # Requests
661 use constant REQUEST_PONG => 0;
662 use constant REQUEST_MOVE => 1;
663 use constant REQUEST_RESIZE => 2;
664 use constant REQUEST_SET_TOPLEVEL => 3;
665 use constant REQUEST_SET_TRANSIENT => 4;
666 use constant REQUEST_SET_FULLSCREEN => 5;
667 use constant REQUEST_SET_POPUP => 6;
668 use constant REQUEST_SET_MAXIMIZED => 7;
669 use constant REQUEST_SET_TITLE => 8;
670 use constant REQUEST_SET_CLASS => 9;
671  
672 sub pong
673 {
674 my $self = shift;
675 my $file;
676 my $retval;
677  
678 $self->call (REQUEST_PONG, pack ('L',
679 shift), $file);
680  
681 return $retval;
682 }
683  
684 sub move
685 {
686 my $self = shift;
687 my $file;
688 my $retval;
689  
690 $self->call (REQUEST_MOVE, pack ('L L',
691 shift->{id},
692 shift), $file);
693  
694 return $retval;
695 }
696  
697 sub resize
698 {
699 my $self = shift;
700 my $file;
701 my $retval;
702  
703 $self->call (REQUEST_RESIZE, pack ('L L L',
704 shift->{id},
705 shift,
706 shift), $file);
707  
708 return $retval;
709 }
710  
711 sub set_toplevel
712 {
713 my $self = shift;
714 my $file;
715 my $retval;
716  
717 $self->call (REQUEST_SET_TOPLEVEL, pack ('',
718 ), $file);
719  
720 return $retval;
721 }
722  
723 sub set_transient
724 {
725 my $self = shift;
726 my $file;
727 my $retval;
728  
729 $self->call (REQUEST_SET_TRANSIENT, pack ('L l l L',
730 shift->{id},
731 shift,
732 shift,
733 shift), $file);
734  
735 return $retval;
736 }
737  
738 sub set_fullscreen
739 {
740 my $self = shift;
741 my $file;
742 my $retval;
743  
744 $self->call (REQUEST_SET_FULLSCREEN, pack ('L L L',
745 shift,
746 shift,
747 shift->{id}), $file);
748  
749 return $retval;
750 }
751  
752 sub set_popup
753 {
754 my $self = shift;
755 my $file;
756 my $retval;
757  
758 $self->call (REQUEST_SET_POPUP, pack ('L L L l l L',
759 shift->{id},
760 shift,
761 shift->{id},
762 shift,
763 shift,
764 shift), $file);
765  
766 return $retval;
767 }
768  
769 sub set_maximized
770 {
771 my $self = shift;
772 my $file;
773 my $retval;
774  
775 $self->call (REQUEST_SET_MAXIMIZED, pack ('L',
776 shift->{id}), $file);
777  
778 return $retval;
779 }
780  
781 sub set_title
782 {
783 my $self = shift;
784 my $file;
785 my $retval;
786  
787 $self->call (REQUEST_SET_TITLE, pack ('L/ax!4',
788 shift."\x00"), $file);
789  
790 return $retval;
791 }
792  
793 sub set_class
794 {
795 my $self = shift;
796 my $file;
797 my $retval;
798  
799 $self->call (REQUEST_SET_CLASS, pack ('L/ax!4',
800 shift."\x00"), $file);
801  
802 return $retval;
803 }
804  
805 # Events
806 use constant EVENT_PING => 0;
807 use constant EVENT_CONFIGURE => 1;
808 use constant EVENT_POPUP_DONE => 2;
809  
810 sub callback
811 {
812 my $self = shift;
813 my $opcode = shift;
814  
815 if ($opcode == EVENT_PING) {
816 @_ = unpack ('L', shift);
817 return $self->ping (shift);
818 } elsif ($opcode == EVENT_CONFIGURE) {
819 @_ = unpack ('L l l', shift);
820 return $self->configure (shift,
821 shift,
822 shift);
823 } elsif ($opcode == EVENT_POPUP_DONE) {
824 return $self->popup_done ();
825 } else {
826 die 'Bad opcode';
827 }
828 }
829  
830 # Enums
831 use constant RESIZE_NONE => 0;
832 use constant RESIZE_TOP => 1;
833 use constant RESIZE_BOTTOM => 2;
834 use constant RESIZE_LEFT => 4;
835 use constant RESIZE_TOP_LEFT => 5;
836 use constant RESIZE_BOTTOM_LEFT => 6;
837 use constant RESIZE_RIGHT => 8;
838 use constant RESIZE_TOP_RIGHT => 9;
839 use constant RESIZE_BOTTOM_RIGHT => 10;
840 use constant TRANSIENT_INACTIVE => 0x1;
841 use constant FULLSCREEN_METHOD_DEFAULT => 0;
842 use constant FULLSCREEN_METHOD_SCALE => 1;
843 use constant FULLSCREEN_METHOD_DRIVER => 2;
844 use constant FULLSCREEN_METHOD_FILL => 3;
845  
846 package WL::wl_surface;
847  
848 our @ISA = qw/WL::Base/;
849 our $VERSION = 3;
850 our $INTERFACE = 'wl_surface';
851  
852 # Requests
853 use constant REQUEST_DESTROY => 0;
854 use constant REQUEST_ATTACH => 1;
855 use constant REQUEST_DAMAGE => 2;
856 use constant REQUEST_FRAME => 3;
857 use constant REQUEST_SET_OPAQUE_REGION => 4;
858 use constant REQUEST_SET_INPUT_REGION => 5;
859 use constant REQUEST_COMMIT => 6;
860 use constant REQUEST_SET_BUFFER_TRANSFORM => 7;
861 use constant REQUEST_SET_BUFFER_SCALE => 8;
862  
863 sub destroy
864 {
865 my $self = shift;
866 my $file;
867 my $retval;
868  
869 $self->call (REQUEST_DESTROY, pack ('',
870 ), $file);
871  
872 return $retval;
873 }
874  
875 sub attach
876 {
877 my $self = shift;
878 my $file;
879 my $retval;
880  
881 $self->call (REQUEST_ATTACH, pack ('L l l',
882 shift->{id},
883 shift,
884 shift), $file);
885  
886 return $retval;
887 }
888  
889 sub damage
890 {
891 my $self = shift;
892 my $file;
893 my $retval;
894  
895 $self->call (REQUEST_DAMAGE, pack ('l l l l',
896 shift,
897 shift,
898 shift,
899 shift), $file);
900  
901 return $retval;
902 }
903  
904 sub frame
905 {
906 my $self = shift;
907 my $file;
908 my $retval;
909  
910 $self->call (REQUEST_FRAME, pack ('L',
911 ($retval = new WL::wl_callback ($self->{conn}))->{id}), $file);
912  
913 return $retval;
914 }
915  
916 sub set_opaque_region
917 {
918 my $self = shift;
919 my $file;
920 my $retval;
921  
922 $self->call (REQUEST_SET_OPAQUE_REGION, pack ('L',
923 shift->{id}), $file);
924  
925 return $retval;
926 }
927  
928 sub set_input_region
929 {
930 my $self = shift;
931 my $file;
932 my $retval;
933  
934 $self->call (REQUEST_SET_INPUT_REGION, pack ('L',
935 shift->{id}), $file);
936  
937 return $retval;
938 }
939  
940 sub commit
941 {
942 my $self = shift;
943 my $file;
944 my $retval;
945  
946 $self->call (REQUEST_COMMIT, pack ('',
947 ), $file);
948  
949 return $retval;
950 }
951  
952 sub set_buffer_transform
953 {
954 my $self = shift;
955 my $file;
956 my $retval;
957  
958 $self->call (REQUEST_SET_BUFFER_TRANSFORM, pack ('l',
959 shift), $file);
960  
961 return $retval;
962 }
963  
964 sub set_buffer_scale
965 {
966 my $self = shift;
967 my $file;
968 my $retval;
969  
970 $self->call (REQUEST_SET_BUFFER_SCALE, pack ('l',
971 shift), $file);
972  
973 return $retval;
974 }
975  
976 # Events
977 use constant EVENT_ENTER => 0;
978 use constant EVENT_LEAVE => 1;
979  
980 sub callback
981 {
982 my $self = shift;
983 my $opcode = shift;
984  
985 if ($opcode == EVENT_ENTER) {
986 @_ = unpack ('L', shift);
987 return $self->enter (new WL::wl_output ($self->{conn}, shift));
988 } elsif ($opcode == EVENT_LEAVE) {
989 @_ = unpack ('L', shift);
990 return $self->leave (new WL::wl_output ($self->{conn}, shift));
991 } else {
992 die 'Bad opcode';
993 }
994 }
995  
996 package WL::wl_seat;
997  
998 our @ISA = qw/WL::Base/;
999 our $VERSION = 3;
1000 our $INTERFACE = 'wl_seat';
1001  
1002 # Requests
1003 use constant REQUEST_GET_POINTER => 0;
1004 use constant REQUEST_GET_KEYBOARD => 1;
1005 use constant REQUEST_GET_TOUCH => 2;
1006  
1007 sub get_pointer
1008 {
1009 my $self = shift;
1010 my $file;
1011 my $retval;
1012  
1013 $self->call (REQUEST_GET_POINTER, pack ('L',
1014 ($retval = new WL::wl_pointer ($self->{conn}))->{id}), $file);
1015  
1016 return $retval;
1017 }
1018  
1019 sub get_keyboard
1020 {
1021 my $self = shift;
1022 my $file;
1023 my $retval;
1024  
1025 $self->call (REQUEST_GET_KEYBOARD, pack ('L',
1026 ($retval = new WL::wl_keyboard ($self->{conn}))->{id}), $file);
1027  
1028 return $retval;
1029 }
1030  
1031 sub get_touch
1032 {
1033 my $self = shift;
1034 my $file;
1035 my $retval;
1036  
1037 $self->call (REQUEST_GET_TOUCH, pack ('L',
1038 ($retval = new WL::wl_touch ($self->{conn}))->{id}), $file);
1039  
1040 return $retval;
1041 }
1042  
1043 # Events
1044 use constant EVENT_CAPABILITIES => 0;
1045 use constant EVENT_NAME => 1;
1046  
1047 sub callback
1048 {
1049 my $self = shift;
1050 my $opcode = shift;
1051  
1052 if ($opcode == EVENT_CAPABILITIES) {
1053 @_ = unpack ('L', shift);
1054 return $self->capabilities (shift);
1055 } elsif ($opcode == EVENT_NAME) {
1056 @_ = unpack ('L/ax!4', shift);
1057 return $self->name ([shift =~ /(.*)./]->[0]);
1058 } else {
1059 die 'Bad opcode';
1060 }
1061 }
1062  
1063 # Enums
1064 use constant CAPABILITY_POINTER => 1;
1065 use constant CAPABILITY_KEYBOARD => 2;
1066 use constant CAPABILITY_TOUCH => 4;
1067  
1068 package WL::wl_pointer;
1069  
1070 our @ISA = qw/WL::Base/;
1071 our $VERSION = 3;
1072 our $INTERFACE = 'wl_pointer';
1073  
1074 # Requests
1075 use constant REQUEST_SET_CURSOR => 0;
1076 use constant REQUEST_RELEASE => 1;
1077  
1078 sub set_cursor
1079 {
1080 my $self = shift;
1081 my $file;
1082 my $retval;
1083  
1084 $self->call (REQUEST_SET_CURSOR, pack ('L L l l',
1085 shift,
1086 shift->{id},
1087 shift,
1088 shift), $file);
1089  
1090 return $retval;
1091 }
1092  
1093 sub release
1094 {
1095 my $self = shift;
1096 my $file;
1097 my $retval;
1098  
1099 $self->call (REQUEST_RELEASE, pack ('',
1100 ), $file);
1101  
1102 return $retval;
1103 }
1104  
1105 # Events
1106 use constant EVENT_ENTER => 0;
1107 use constant EVENT_LEAVE => 1;
1108 use constant EVENT_MOTION => 2;
1109 use constant EVENT_BUTTON => 3;
1110 use constant EVENT_AXIS => 4;
1111  
1112 sub callback
1113 {
1114 my $self = shift;
1115 my $opcode = shift;
1116  
1117 if ($opcode == EVENT_ENTER) {
1118 @_ = unpack ('L L L L', shift);
1119 return $self->enter (shift,
1120 new WL::wl_surface ($self->{conn}, shift),
1121 $self->fixed2nv (shift),
1122 $self->fixed2nv (shift));
1123 } elsif ($opcode == EVENT_LEAVE) {
1124 @_ = unpack ('L L', shift);
1125 return $self->leave (shift,
1126 new WL::wl_surface ($self->{conn}, shift));
1127 } elsif ($opcode == EVENT_MOTION) {
1128 @_ = unpack ('L L L', shift);
1129 return $self->motion (shift,
1130 $self->fixed2nv (shift),
1131 $self->fixed2nv (shift));
1132 } elsif ($opcode == EVENT_BUTTON) {
1133 @_ = unpack ('L L L L', shift);
1134 return $self->button (shift,
1135 shift,
1136 shift,
1137 shift);
1138 } elsif ($opcode == EVENT_AXIS) {
1139 @_ = unpack ('L L L', shift);
1140 return $self->axis (shift,
1141 shift,
1142 $self->fixed2nv (shift));
1143 } else {
1144 die 'Bad opcode';
1145 }
1146 }
1147  
1148 # Enums
1149 use constant BUTTON_STATE_RELEASED => 0;
1150 use constant BUTTON_STATE_PRESSED => 1;
1151 use constant AXIS_VERTICAL_SCROLL => 0;
1152 use constant AXIS_HORIZONTAL_SCROLL => 1;
1153  
1154 package WL::wl_keyboard;
1155  
1156 our @ISA = qw/WL::Base/;
1157 our $VERSION = 3;
1158 our $INTERFACE = 'wl_keyboard';
1159  
1160 # Requests
1161 use constant REQUEST_RELEASE => 0;
1162  
1163 sub release
1164 {
1165 my $self = shift;
1166 my $file;
1167 my $retval;
1168  
1169 $self->call (REQUEST_RELEASE, pack ('',
1170 ), $file);
1171  
1172 return $retval;
1173 }
1174  
1175 # Events
1176 use constant EVENT_KEYMAP => 0;
1177 use constant EVENT_ENTER => 1;
1178 use constant EVENT_LEAVE => 2;
1179 use constant EVENT_KEY => 3;
1180 use constant EVENT_MODIFIERS => 4;
1181  
1182 sub callback
1183 {
1184 my $self = shift;
1185 my $opcode = shift;
1186  
1187 if ($opcode == EVENT_KEYMAP) {
1188 @_ = unpack ('L L', shift);
1189 return $self->keymap (shift,
1190 shift,
1191 shift);
1192 } elsif ($opcode == EVENT_ENTER) {
1193 @_ = unpack ('L L L/ax!4', shift);
1194 return $self->enter (shift,
1195 new WL::wl_surface ($self->{conn}, shift),
1196 shift);
1197 } elsif ($opcode == EVENT_LEAVE) {
1198 @_ = unpack ('L L', shift);
1199 return $self->leave (shift,
1200 new WL::wl_surface ($self->{conn}, shift));
1201 } elsif ($opcode == EVENT_KEY) {
1202 @_ = unpack ('L L L L', shift);
1203 return $self->key (shift,
1204 shift,
1205 shift,
1206 shift);
1207 } elsif ($opcode == EVENT_MODIFIERS) {
1208 @_ = unpack ('L L L L L', shift);
1209 return $self->modifiers (shift,
1210 shift,
1211 shift,
1212 shift,
1213 shift);
1214 } else {
1215 die 'Bad opcode';
1216 }
1217 }
1218  
1219 # Enums
1220 use constant KEYMAP_FORMAT_NO_KEYMAP => 0;
1221 use constant KEYMAP_FORMAT_XKB_V1 => 1;
1222 use constant KEY_STATE_RELEASED => 0;
1223 use constant KEY_STATE_PRESSED => 1;
1224  
1225 package WL::wl_touch;
1226  
1227 our @ISA = qw/WL::Base/;
1228 our $VERSION = 3;
1229 our $INTERFACE = 'wl_touch';
1230  
1231 # Requests
1232 use constant REQUEST_RELEASE => 0;
1233  
1234 sub release
1235 {
1236 my $self = shift;
1237 my $file;
1238 my $retval;
1239  
1240 $self->call (REQUEST_RELEASE, pack ('',
1241 ), $file);
1242  
1243 return $retval;
1244 }
1245  
1246 # Events
1247 use constant EVENT_DOWN => 0;
1248 use constant EVENT_UP => 1;
1249 use constant EVENT_MOTION => 2;
1250 use constant EVENT_FRAME => 3;
1251 use constant EVENT_CANCEL => 4;
1252  
1253 sub callback
1254 {
1255 my $self = shift;
1256 my $opcode = shift;
1257  
1258 if ($opcode == EVENT_DOWN) {
1259 @_ = unpack ('L L L l L L', shift);
1260 return $self->down (shift,
1261 shift,
1262 new WL::wl_surface ($self->{conn}, shift),
1263 shift,
1264 $self->fixed2nv (shift),
1265 $self->fixed2nv (shift));
1266 } elsif ($opcode == EVENT_UP) {
1267 @_ = unpack ('L L l', shift);
1268 return $self->up (shift,
1269 shift,
1270 shift);
1271 } elsif ($opcode == EVENT_MOTION) {
1272 @_ = unpack ('L l L L', shift);
1273 return $self->motion (shift,
1274 shift,
1275 $self->fixed2nv (shift),
1276 $self->fixed2nv (shift));
1277 } elsif ($opcode == EVENT_FRAME) {
1278 return $self->frame ();
1279 } elsif ($opcode == EVENT_CANCEL) {
1280 return $self->cancel ();
1281 } else {
1282 die 'Bad opcode';
1283 }
1284 }
1285  
1286 package WL::wl_output;
1287  
1288 our @ISA = qw/WL::Base/;
1289 our $VERSION = 2;
1290 our $INTERFACE = 'wl_output';
1291  
1292 # Events
1293 use constant EVENT_GEOMETRY => 0;
1294 use constant EVENT_MODE => 1;
1295 use constant EVENT_DONE => 2;
1296 use constant EVENT_SCALE => 3;
1297  
1298 sub callback
1299 {
1300 my $self = shift;
1301 my $opcode = shift;
1302  
1303 if ($opcode == EVENT_GEOMETRY) {
1304 @_ = unpack ('l l l l l L/ax!4 L/ax!4 l', shift);
1305 return $self->geometry (shift,
1306 shift,
1307 shift,
1308 shift,
1309 shift,
1310 [shift =~ /(.*)./]->[0],
1311 [shift =~ /(.*)./]->[0],
1312 shift);
1313 } elsif ($opcode == EVENT_MODE) {
1314 @_ = unpack ('L l l l', shift);
1315 return $self->mode (shift,
1316 shift,
1317 shift,
1318 shift);
1319 } elsif ($opcode == EVENT_DONE) {
1320 return $self->done ();
1321 } elsif ($opcode == EVENT_SCALE) {
1322 @_ = unpack ('l', shift);
1323 return $self->scale (shift);
1324 } else {
1325 die 'Bad opcode';
1326 }
1327 }
1328  
1329 # Enums
1330 use constant SUBPIXEL_UNKNOWN => 0;
1331 use constant SUBPIXEL_NONE => 1;
1332 use constant SUBPIXEL_HORIZONTAL_RGB => 2;
1333 use constant SUBPIXEL_HORIZONTAL_BGR => 3;
1334 use constant SUBPIXEL_VERTICAL_RGB => 4;
1335 use constant SUBPIXEL_VERTICAL_BGR => 5;
1336 use constant TRANSFORM_NORMAL => 0;
1337 use constant TRANSFORM_90 => 1;
1338 use constant TRANSFORM_180 => 2;
1339 use constant TRANSFORM_270 => 3;
1340 use constant TRANSFORM_FLIPPED => 4;
1341 use constant TRANSFORM_FLIPPED_90 => 5;
1342 use constant TRANSFORM_FLIPPED_180 => 6;
1343 use constant TRANSFORM_FLIPPED_270 => 7;
1344 use constant MODE_CURRENT => 0x1;
1345 use constant MODE_PREFERRED => 0x2;
1346  
1347 package WL::wl_region;
1348  
1349 our @ISA = qw/WL::Base/;
1350 our $VERSION = 1;
1351 our $INTERFACE = 'wl_region';
1352  
1353 # Requests
1354 use constant REQUEST_DESTROY => 0;
1355 use constant REQUEST_ADD => 1;
1356 use constant REQUEST_SUBTRACT => 2;
1357  
1358 sub destroy
1359 {
1360 my $self = shift;
1361 my $file;
1362 my $retval;
1363  
1364 $self->call (REQUEST_DESTROY, pack ('',
1365 ), $file);
1366  
1367 return $retval;
1368 }
1369  
1370 sub add
1371 {
1372 my $self = shift;
1373 my $file;
1374 my $retval;
1375  
1376 $self->call (REQUEST_ADD, pack ('l l l l',
1377 shift,
1378 shift,
1379 shift,
1380 shift), $file);
1381  
1382 return $retval;
1383 }
1384  
1385 sub subtract
1386 {
1387 my $self = shift;
1388 my $file;
1389 my $retval;
1390  
1391 $self->call (REQUEST_SUBTRACT, pack ('l l l l',
1392 shift,
1393 shift,
1394 shift,
1395 shift), $file);
1396  
1397 return $retval;
1398 }
1399  
1400 package WL::wl_subcompositor;
1401  
1402 our @ISA = qw/WL::Base/;
1403 our $VERSION = 1;
1404 our $INTERFACE = 'wl_subcompositor';
1405  
1406 # Requests
1407 use constant REQUEST_DESTROY => 0;
1408 use constant REQUEST_GET_SUBSURFACE => 1;
1409  
1410 sub destroy
1411 {
1412 my $self = shift;
1413 my $file;
1414 my $retval;
1415  
1416 $self->call (REQUEST_DESTROY, pack ('',
1417 ), $file);
1418  
1419 return $retval;
1420 }
1421  
1422 sub get_subsurface
1423 {
1424 my $self = shift;
1425 my $file;
1426 my $retval;
1427  
1428 $self->call (REQUEST_GET_SUBSURFACE, pack ('L L L',
1429 ($retval = new WL::wl_subsurface ($self->{conn}))->{id},
1430 shift->{id},
1431 shift->{id}), $file);
1432  
1433 return $retval;
1434 }
1435  
1436 # Enums
1437 use constant ERROR_BAD_SURFACE => 0;
1438  
1439 package WL::wl_subsurface;
1440  
1441 our @ISA = qw/WL::Base/;
1442 our $VERSION = 1;
1443 our $INTERFACE = 'wl_subsurface';
1444  
1445 # Requests
1446 use constant REQUEST_DESTROY => 0;
1447 use constant REQUEST_SET_POSITION => 1;
1448 use constant REQUEST_PLACE_ABOVE => 2;
1449 use constant REQUEST_PLACE_BELOW => 3;
1450 use constant REQUEST_SET_SYNC => 4;
1451 use constant REQUEST_SET_DESYNC => 5;
1452  
1453 sub destroy
1454 {
1455 my $self = shift;
1456 my $file;
1457 my $retval;
1458  
1459 $self->call (REQUEST_DESTROY, pack ('',
1460 ), $file);
1461  
1462 return $retval;
1463 }
1464  
1465 sub set_position
1466 {
1467 my $self = shift;
1468 my $file;
1469 my $retval;
1470  
1471 $self->call (REQUEST_SET_POSITION, pack ('l l',
1472 shift,
1473 shift), $file);
1474  
1475 return $retval;
1476 }
1477  
1478 sub place_above
1479 {
1480 my $self = shift;
1481 my $file;
1482 my $retval;
1483  
1484 $self->call (REQUEST_PLACE_ABOVE, pack ('L',
1485 shift->{id}), $file);
1486  
1487 return $retval;
1488 }
1489  
1490 sub place_below
1491 {
1492 my $self = shift;
1493 my $file;
1494 my $retval;
1495  
1496 $self->call (REQUEST_PLACE_BELOW, pack ('L',
1497 shift->{id}), $file);
1498  
1499 return $retval;
1500 }
1501  
1502 sub set_sync
1503 {
1504 my $self = shift;
1505 my $file;
1506 my $retval;
1507  
1508 $self->call (REQUEST_SET_SYNC, pack ('',
1509 ), $file);
1510  
1511 return $retval;
1512 }
1513  
1514 sub set_desync
1515 {
1516 my $self = shift;
1517 my $file;
1518 my $retval;
1519  
1520 $self->call (REQUEST_SET_DESYNC, pack ('',
1521 ), $file);
1522  
1523 return $retval;
1524 }
1525  
1526 # Enums
1527 use constant ERROR_BAD_SURFACE => 0;
1528  
1529  
1530 =head1 BUGS
1531  
1532 The interface documentation for the bindings is lacking.
1533  
1534 Only client part implemented, not server.
1535  
1536 =head1 SEE ALSO
1537  
1538 =over
1539  
1540 =item *
1541  
1542 L<http://wayland.freedesktop.org/> -- Wayland project web site
1543  
1544 =item *
1545  
1546 L<wl-draw.pl> -- Example Wayland client
1547  
1548 =item *
1549  
1550 L<wl-scanner.pl> -- Tool that generated this module
1551  
1552 =item *
1553  
1554 L<WL::Base> -- Base class for Wayland objects
1555  
1556 =item *
1557  
1558 L<WL::Connection> -- Estabilish a Wayland connection
1559  
1560 =back
1561  
1562 =head1 COPYRIGHT
1563  
1564 Copyright 2013, 2014 Lubomir Rintel
1565  
1566 This program is free software; you can redistribute it and/or modify it
1567 under the same terms as Perl itself.
1568  
1569 Copyright notice from the protocol definition file:
1570  
1571 Copyright © 2008-2011 Kristian Høgsberg
1572 Copyright © 2010-2011 Intel Corporation
1573 Copyright © 2012-2013 Collabora, Ltd.
1574
1575 Permission to use, copy, modify, distribute, and sell this
1576 software and its documentation for any purpose is hereby granted
1577 without fee, provided that the above copyright notice appear in
1578 all copies and that both that copyright notice and this permission
1579 notice appear in supporting documentation, and that the name of
1580 the copyright holders not be used in advertising or publicity
1581 pertaining to distribution of the software without specific,
1582 written prior permission. The copyright holders make no
1583 representations about the suitability of this software for any
1584 purpose. It is provided "as is" without express or implied
1585 warranty.
1586
1587 THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
1588 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
1589 FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
1590 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1591 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
1592 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1593 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
1594 THIS SOFTWARE.
1595  
1596 =head1 AUTHORS
1597  
1598 Lubomir Rintel C<lkundrak@v3.sk>
1599  
1600 =cut
1601