line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2011, 2012, 2013 Kevin Ryde |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This file is part of X11-Protocol-Other. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# X11-Protocol-Other is free software; you can redistribute it and/or |
6
|
|
|
|
|
|
|
# modify it under the terms of the GNU General Public License as published |
7
|
|
|
|
|
|
|
# by the Free Software Foundation; either version 3, or (at your option) any |
8
|
|
|
|
|
|
|
# later version. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# X11-Protocol-Other is distributed in the hope that it will be useful, |
11
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
13
|
|
|
|
|
|
|
# Public License for more details. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License along |
16
|
|
|
|
|
|
|
# with X11-Protocol-Other. If not, see . |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# /usr/share/doc/x11proto-composite-dev/compositeproto.txt.gz |
20
|
|
|
|
|
|
|
# http://cgit.freedesktop.org/xorg/proto/compositeproto/plain/compositeproto.txt |
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
# /usr/include/X11/extensions/Xcomposite.h Xlib |
23
|
|
|
|
|
|
|
# /usr/include/X11/extensions/composite.h constants |
24
|
|
|
|
|
|
|
# /usr/include/X11/extensions/compositeproto.h structs |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# http://ktown.kde.org/~fredrik/composite_howto.html |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
# server side source: |
29
|
|
|
|
|
|
|
# http://cgit.freedesktop.org/xorg/xserver/tree/composite/compext.c |
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
854
|
BEGIN { require 5 } |
34
|
|
|
|
|
|
|
package X11::Protocol::Ext::Composite; |
35
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
36
|
1
|
|
|
1
|
|
2490
|
use X11::Protocol; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use vars '$VERSION', '@CARP_NOT'; |
39
|
|
|
|
|
|
|
$VERSION = 29; |
40
|
|
|
|
|
|
|
@CARP_NOT = ('X11::Protocol'); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# uncomment this to run the ### lines |
43
|
|
|
|
|
|
|
#use Smart::Comments; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# these not documented yet ... |
47
|
|
|
|
|
|
|
use constant CLIENT_MAJOR_VERSION => 0; |
48
|
|
|
|
|
|
|
use constant CLIENT_MINOR_VERSION => 3; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $reqs = |
51
|
|
|
|
|
|
|
[ |
52
|
|
|
|
|
|
|
['CompositeQueryVersion', # 0 |
53
|
|
|
|
|
|
|
sub { |
54
|
|
|
|
|
|
|
my ($X, $major, $minor) = @_; |
55
|
|
|
|
|
|
|
### CompositeQueryVersion request |
56
|
|
|
|
|
|
|
return pack 'LL', $major, $minor; |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
sub { |
59
|
|
|
|
|
|
|
my ($X, $data) = @_; |
60
|
|
|
|
|
|
|
### CompositeQueryVersion reply |
61
|
|
|
|
|
|
|
return unpack 'x8LL', $data; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Any interest in holding onto the version? |
64
|
|
|
|
|
|
|
# my ($server_major, $server_minor) = unpack 'x8LL', $data; |
65
|
|
|
|
|
|
|
# ### $server_major |
66
|
|
|
|
|
|
|
# ### $server_minor |
67
|
|
|
|
|
|
|
# my $self; |
68
|
|
|
|
|
|
|
# if ($self = $self->{'ext'}{'Composite'}->[3]) { |
69
|
|
|
|
|
|
|
# $self->{'major'} = $server_major; |
70
|
|
|
|
|
|
|
# $self->{'minor'} = $server_minor; |
71
|
|
|
|
|
|
|
# } |
72
|
|
|
|
|
|
|
# return ($server_major, $server_minor); |
73
|
|
|
|
|
|
|
}], |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
['CompositeRedirectWindow', # 1 |
76
|
|
|
|
|
|
|
\&_request_window_and_update ], |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
['CompositeRedirectSubwindows', # 2 |
79
|
|
|
|
|
|
|
\&_request_window_and_update ], |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
['CompositeUnredirectWindow', # 3 |
82
|
|
|
|
|
|
|
\&_request_window_and_update ], |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
['CompositeUnredirectSubwindows', # 4 |
85
|
|
|
|
|
|
|
\&_request_window_and_update ], |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
['CompositeCreateRegionFromBorderClip', # 5 |
88
|
|
|
|
|
|
|
\&_request_xids ], # ($X, $region, $window) |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
#---------------------------------------------- |
91
|
|
|
|
|
|
|
# version 0.2 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
['CompositeNameWindowPixmap', # 6 |
94
|
|
|
|
|
|
|
\&_request_xids ], # ($X, $window, $pixmap) |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#---------------------------------------------- |
97
|
|
|
|
|
|
|
# version 0.3 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
['CompositeGetOverlayWindow', # 7 |
100
|
|
|
|
|
|
|
\&_request_xids, # ($X, $window) |
101
|
|
|
|
|
|
|
sub { |
102
|
|
|
|
|
|
|
my ($X, $data) = @_; |
103
|
|
|
|
|
|
|
### CompositeGetOverlayWindow reply |
104
|
|
|
|
|
|
|
return unpack 'x8L', $data; |
105
|
|
|
|
|
|
|
}], |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
['CompositeReleaseOverlayWindow', # 8 |
108
|
|
|
|
|
|
|
\&_request_xids ], # ($X, $window) |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#---------------------------------------------- |
111
|
|
|
|
|
|
|
# version 0.4 |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# these untested, probably not working |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# ['CompositeRedirectCoordinate', # 9 |
116
|
|
|
|
|
|
|
# sub { |
117
|
|
|
|
|
|
|
# my ($X, $window, $bool) = @_; |
118
|
|
|
|
|
|
|
# ### CompositeRedirectCoordinate request |
119
|
|
|
|
|
|
|
# return pack 'LL', $major, $minor; |
120
|
|
|
|
|
|
|
# }, |
121
|
|
|
|
|
|
|
# ['CompositeTransformCoordinate', # 10 |
122
|
|
|
|
|
|
|
# sub { |
123
|
|
|
|
|
|
|
# my $X = shift; |
124
|
|
|
|
|
|
|
# my $serial = shift; |
125
|
|
|
|
|
|
|
# my $x = shift; |
126
|
|
|
|
|
|
|
# my $y = shift; |
127
|
|
|
|
|
|
|
# # FIXME: padding ? |
128
|
|
|
|
|
|
|
# return pack('Lss', $serial, $x, $y) . join ('', map {pack 'Lss', @$_}); |
129
|
|
|
|
|
|
|
# }, |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
]; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub _request_window_and_update { |
134
|
|
|
|
|
|
|
my ($X, $window, $update) = @_; |
135
|
|
|
|
|
|
|
### _request_window_and_update() |
136
|
|
|
|
|
|
|
return pack ('LCxxx', |
137
|
|
|
|
|
|
|
$window, |
138
|
|
|
|
|
|
|
$X->num('CompositeUpdate',$update)); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my $CompositeUpdate_array = [ 'Automatic', 'Manual' ]; |
142
|
|
|
|
|
|
|
my $CompositeUpdate_hash = |
143
|
|
|
|
|
|
|
{ X11::Protocol::make_num_hash($CompositeUpdate_array) }; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub new { |
146
|
|
|
|
|
|
|
my ($class, $X, $request_num, $event_num, $error_num) = @_; |
147
|
|
|
|
|
|
|
### Composite new() |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# Constants |
150
|
|
|
|
|
|
|
$X->{'ext_const'}->{'CompositeUpdate'} = $CompositeUpdate_array; |
151
|
|
|
|
|
|
|
$X->{'ext_const_num'}->{'CompositeUpdate'} = $CompositeUpdate_hash; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
# Requests |
154
|
|
|
|
|
|
|
_ext_requests_install ($X, $request_num, $reqs); |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
# Events |
157
|
|
|
|
|
|
|
# untested, probably not working |
158
|
|
|
|
|
|
|
# |
159
|
|
|
|
|
|
|
# $X->{'ext_const'}{'Events'}[$event_num] = 'CompositeTransformCoordinate'; |
160
|
|
|
|
|
|
|
# $X->{'ext_events'}[$event_num] = |
161
|
|
|
|
|
|
|
# [ sub { |
162
|
|
|
|
|
|
|
# my $X = shift; |
163
|
|
|
|
|
|
|
# my $data = shift; |
164
|
|
|
|
|
|
|
# ### CompositeTransformCoordinate unpack: @_[1..$#_] |
165
|
|
|
|
|
|
|
# my ($window, $serial, $x, $y) = unpack 'xxxxLLss', $data; |
166
|
|
|
|
|
|
|
# |
167
|
|
|
|
|
|
|
# return (@_, |
168
|
|
|
|
|
|
|
# name => 'CompositeTransformCoordinate', |
169
|
|
|
|
|
|
|
# serial => $serial, |
170
|
|
|
|
|
|
|
# window => $window, |
171
|
|
|
|
|
|
|
# x => $x, |
172
|
|
|
|
|
|
|
# y => $y, |
173
|
|
|
|
|
|
|
# coordinates => [ map {unpack 'Lss', substr($data,$_*8,8)} 4 .. length($data)/8 ], |
174
|
|
|
|
|
|
|
# ); |
175
|
|
|
|
|
|
|
# }, sub { |
176
|
|
|
|
|
|
|
# my ($X, %h) = @_; |
177
|
|
|
|
|
|
|
# return (pack('x4LLss', |
178
|
|
|
|
|
|
|
# $h{'window'}, |
179
|
|
|
|
|
|
|
# $h{'serial'}, |
180
|
|
|
|
|
|
|
# $h{'x'}, |
181
|
|
|
|
|
|
|
# $h{'y'}) |
182
|
|
|
|
|
|
|
# . join('',map{pack 'Lss', @$_} $h{'coordinates'}), |
183
|
|
|
|
|
|
|
# 1); # "do_seq" put in sequence number |
184
|
|
|
|
|
|
|
# } ]; |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
# Any need to negotiate the version before using? |
187
|
|
|
|
|
|
|
# my ($major, $minor) = $X->req('CompositeQueryVersion', |
188
|
|
|
|
|
|
|
# CLIENT_MAJOR_VERSION, |
189
|
|
|
|
|
|
|
# CLIENT_MINOR_VERSION); |
190
|
|
|
|
|
|
|
# if ($major != 1) { |
191
|
|
|
|
|
|
|
# carp "Unrecognised Composite major version, got $major want 1"; |
192
|
|
|
|
|
|
|
# return 0; |
193
|
|
|
|
|
|
|
# } |
194
|
|
|
|
|
|
|
return bless { |
195
|
|
|
|
|
|
|
# major => $major, |
196
|
|
|
|
|
|
|
# minor => $minor, |
197
|
|
|
|
|
|
|
}, $class; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub _ext_requests_install { |
201
|
|
|
|
|
|
|
my ($X, $request_num, $reqs) = @_; |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
$X->{'ext_request'}->{$request_num} = $reqs; |
204
|
|
|
|
|
|
|
my $href = $X->{'ext_request_num'}; |
205
|
|
|
|
|
|
|
my $i; |
206
|
|
|
|
|
|
|
foreach $i (0 .. $#$reqs) { |
207
|
|
|
|
|
|
|
$href->{$reqs->[$i]->[0]} = [$request_num, $i]; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub _request_xids { |
212
|
|
|
|
|
|
|
my $X = shift; |
213
|
|
|
|
|
|
|
### _request_xids(): @_ |
214
|
|
|
|
|
|
|
return _request_card32s ($X, map {_num_none($_)} @_); |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
sub _request_card32s { |
217
|
|
|
|
|
|
|
shift; |
218
|
|
|
|
|
|
|
### _request_card32s(): @_ |
219
|
|
|
|
|
|
|
return pack 'L*', @_; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
sub _num_none { |
222
|
|
|
|
|
|
|
my ($xid) = @_; |
223
|
|
|
|
|
|
|
if (defined $xid && $xid eq 'None') { |
224
|
|
|
|
|
|
|
return 0; |
225
|
|
|
|
|
|
|
} else { |
226
|
|
|
|
|
|
|
return $xid; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
1; |
231
|
|
|
|
|
|
|
__END__ |