lib/WL/desktop.pm untested

filter: Statementstmt 0.0% 0 / 126 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 33 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 173 CC 4 SCAR 13.9
CC
4
Cov
0%
callback
20.0
set_background
2.0
set_panel
2.0
CRAP 4.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::desktop - Perl binding for desktop protocol
15  
16 =head1 SYNOPSIS
17  
18 use WL::desktop;
19  
20 =head1 DESCRIPTION
21  
22 B<WL::desktop> 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::desktop;
42  
43 our $VERSION = 0.92;
44  
45 package WL::desktop_shell;
46  
47 our @ISA = qw/WL::Base/;
48 our $VERSION = 2;
49 our $INTERFACE = 'desktop_shell';
50  
51 # Requests
52 use constant REQUEST_SET_BACKGROUND => 0;
53 use constant REQUEST_SET_PANEL => 1;
54 use constant REQUEST_SET_LOCK_SURFACE => 2;
55 use constant REQUEST_UNLOCK => 3;
56 use constant REQUEST_SET_GRAB_SURFACE => 4;
57 use constant REQUEST_DESKTOP_READY => 5;
58  
59 sub set_background
60 {
61 my $self = shift;
62 my $file;
63 my $retval;
64  
65 $self->call (REQUEST_SET_BACKGROUND, pack ('L L',
66 shift->{id},
67 shift->{id}), $file);
68  
69 return $retval;
70 }
71  
72 sub set_panel
73 {
74 my $self = shift;
75 my $file;
76 my $retval;
77  
78 $self->call (REQUEST_SET_PANEL, pack ('L L',
79 shift->{id},
80 shift->{id}), $file);
81  
82 return $retval;
83 }
84  
85 sub set_lock_surface
86 {
87 my $self = shift;
88 my $file;
89 my $retval;
90  
91 $self->call (REQUEST_SET_LOCK_SURFACE, pack ('L',
92 shift->{id}), $file);
93  
94 return $retval;
95 }
96  
97 sub unlock
98 {
99 my $self = shift;
100 my $file;
101 my $retval;
102  
103 $self->call (REQUEST_UNLOCK, pack ('',
104 ), $file);
105  
106 return $retval;
107 }
108  
109 sub set_grab_surface
110 {
111 my $self = shift;
112 my $file;
113 my $retval;
114  
115 $self->call (REQUEST_SET_GRAB_SURFACE, pack ('L',
116 shift->{id}), $file);
117  
118 return $retval;
119 }
120  
121 sub desktop_ready
122 {
123 my $self = shift;
124 my $file;
125 my $retval;
126  
127 $self->call (REQUEST_DESKTOP_READY, pack ('',
128 ), $file);
129  
130 return $retval;
131 }
132  
133 # Events
134 use constant EVENT_CONFIGURE => 0;
135 use constant EVENT_PREPARE_LOCK_SURFACE => 1;
136 use constant EVENT_GRAB_CURSOR => 2;
137  
138 sub callback
139 {
140 my $self = shift;
141 my $opcode = shift;
142  
143 if ($opcode == EVENT_CONFIGURE) {
144 @_ = unpack ('L L l l', shift);
145 return $self->configure (shift,
146 new WL::wl_surface ($self->{conn}, shift),
147 shift,
148 shift);
149 } elsif ($opcode == EVENT_PREPARE_LOCK_SURFACE) {
150 return $self->prepare_lock_surface ();
151 } elsif ($opcode == EVENT_GRAB_CURSOR) {
152 @_ = unpack ('L', shift);
153 return $self->grab_cursor (shift);
154 } else {
155 die 'Bad opcode';
156 }
157 }
158  
159 # Enums
160 use constant CURSOR_NONE => 0;
161 use constant CURSOR_RESIZE_TOP => 1;
162 use constant CURSOR_RESIZE_BOTTOM => 2;
163 use constant CURSOR_ARROW => 3;
164 use constant CURSOR_RESIZE_LEFT => 4;
165 use constant CURSOR_RESIZE_TOP_LEFT => 5;
166 use constant CURSOR_RESIZE_BOTTOM_LEFT => 6;
167 use constant CURSOR_MOVE => 7;
168 use constant CURSOR_RESIZE_RIGHT => 8;
169 use constant CURSOR_RESIZE_TOP_RIGHT => 9;
170 use constant CURSOR_RESIZE_BOTTOM_RIGHT => 10;
171 use constant CURSOR_BUSY => 11;
172  
173 package WL::screensaver;
174  
175 our @ISA = qw/WL::Base/;
176 our $VERSION = 1;
177 our $INTERFACE = 'screensaver';
178  
179 # Requests
180 use constant REQUEST_SET_SURFACE => 0;
181  
182 sub set_surface
183 {
184 my $self = shift;
185 my $file;
186 my $retval;
187  
188 $self->call (REQUEST_SET_SURFACE, pack ('L L',
189 shift->{id},
190 shift->{id}), $file);
191  
192 return $retval;
193 }
194  
195  
196 =head1 BUGS
197  
198 The interface documentation for the bindings is lacking.
199  
200 Only client part implemented, not server.
201  
202 =head1 SEE ALSO
203  
204 =over
205  
206 =item *
207  
208 L<http://wayland.freedesktop.org/> -- Wayland project web site
209  
210 =item *
211  
212 L<wl-draw.pl> -- Example Wayland client
213  
214 =item *
215  
216 L<wl-scanner.pl> -- Tool that generated this module
217  
218 =item *
219  
220 L<WL::Base> -- Base class for Wayland objects
221  
222 =item *
223  
224 L<WL::Connection> -- Estabilish a Wayland connection
225  
226 =back
227  
228 =head1 COPYRIGHT
229  
230 Copyright 2013, 2014 Lubomir Rintel
231  
232 This program is free software; you can redistribute it and/or modify it
233 under the same terms as Perl itself.
234  
235 =head1 AUTHORS
236  
237 Lubomir Rintel C<lkundrak@v3.sk>
238  
239 =cut
240