line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2011, 2012, 2013, 2014, 2017 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
|
1
|
|
|
1
|
|
463
|
BEGIN { require 5 } |
19
|
|
|
|
|
|
|
package X11::Protocol::Ext::XINERAMA; |
20
|
1
|
|
|
1
|
|
11
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
21
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
6
|
use vars '$VERSION', '@CARP_NOT'; |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
102
|
|
24
|
|
|
|
|
|
|
$VERSION = 31; |
25
|
|
|
|
|
|
|
@CARP_NOT = ('X11::Protocol'); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# uncomment this to run the ### lines |
28
|
|
|
|
|
|
|
#use Smart::Comments; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# /usr/include/X11/extensions/panoramiXproto.h |
31
|
|
|
|
|
|
|
# Protocol structs etc. |
32
|
|
|
|
|
|
|
# http://cgit.freedesktop.org/xorg/proto/xineramaproto/tree/panoramiXproto.h |
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
# /usr/include/X11/extensions/Xinerama.h |
35
|
|
|
|
|
|
|
# /usr/include/X11/extensions/panoramiXext.h |
36
|
|
|
|
|
|
|
# Xlib. |
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# http://www.kernel.org/doc/als1999/Conference/IMcCartney/xinerama.html |
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
# XINERAMA 1.0 in X11R6.4 |
41
|
|
|
|
|
|
|
# XINERAMA 1.1 in X11R6.7 |
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
### XINERAMA.pm loads |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# these not documented yet ... |
47
|
1
|
|
|
1
|
|
6
|
use constant CLIENT_MAJOR_VERSION => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
115
|
|
48
|
1
|
|
|
1
|
|
7
|
use constant CLIENT_MINOR_VERSION => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
650
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $reqs = |
51
|
|
|
|
|
|
|
[ |
52
|
|
|
|
|
|
|
[ 'PanoramiXQueryVersion', # 0 |
53
|
|
|
|
|
|
|
sub { |
54
|
|
|
|
|
|
|
my ($X, $major, $minor) = @_; |
55
|
|
|
|
|
|
|
### PanoramiXQueryVersion |
56
|
|
|
|
|
|
|
return pack 'CCxx', $major, $minor; |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
sub { |
59
|
|
|
|
|
|
|
my ($X, $data) = @_; |
60
|
|
|
|
|
|
|
return unpack 'x8SS', $data; |
61
|
|
|
|
|
|
|
}], |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
[ 'PanoramiXGetState', # 1 |
64
|
|
|
|
|
|
|
\&_request_xids, # ($X, $window) |
65
|
|
|
|
|
|
|
sub { |
66
|
|
|
|
|
|
|
my ($X, $data) = @_; |
67
|
|
|
|
|
|
|
### PanoramiXGetState reply |
68
|
|
|
|
|
|
|
### state and window: unpack 'xCx6L', $data |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Reply "window" field may be set only in XINERAMA 1.1, not the |
71
|
|
|
|
|
|
|
# X11R6.4 1.0. It's a copy of the request, so think can ignore. |
72
|
|
|
|
|
|
|
return unpack 'xC', $data; |
73
|
|
|
|
|
|
|
}], |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
[ 'PanoramiXGetScreenCount', # 2 |
76
|
|
|
|
|
|
|
\&_request_xids, # ($X, $window) |
77
|
|
|
|
|
|
|
sub { |
78
|
|
|
|
|
|
|
my ($X, $data) = @_; |
79
|
|
|
|
|
|
|
### PanoramiXGetScreenCount reply: unpack "C*", $data |
80
|
|
|
|
|
|
|
### count and window: unpack 'xCx6L', $data |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Reply "window" field may be set only in XINERAMA 1.1, not the |
83
|
|
|
|
|
|
|
# X11R6.4 1.0. It's a copy of the request, so think can ignore. |
84
|
|
|
|
|
|
|
return unpack 'xC', $data; |
85
|
|
|
|
|
|
|
}], |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
[ 'PanoramiXGetScreenSize', # 3 |
88
|
|
|
|
|
|
|
# ($X, $window, $screen) |
89
|
|
|
|
|
|
|
# $screen is an integer not an xid, so ought not allow 'None' there |
90
|
|
|
|
|
|
|
\&_request_xids, |
91
|
|
|
|
|
|
|
sub { |
92
|
|
|
|
|
|
|
my ($X, $data) = @_; |
93
|
|
|
|
|
|
|
### PanoramiXGetScreenSize reply |
94
|
|
|
|
|
|
|
### w,h,win,screen: unpack 'x8L*', $data |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# Reply "window" and "screen" fields may be set only in XINERAMA 1.1, |
97
|
|
|
|
|
|
|
# not the X11R6.4 1.0. They're a copy of the request, so think can |
98
|
|
|
|
|
|
|
# ignore. |
99
|
|
|
|
|
|
|
return unpack 'x8LL', $data; # ($width,$height) |
100
|
|
|
|
|
|
|
}], |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
#------------ |
103
|
|
|
|
|
|
|
# version 1.1 |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
["XineramaIsActive", # 4 |
106
|
|
|
|
|
|
|
\&_request_empty, # ($X) |
107
|
|
|
|
|
|
|
sub { |
108
|
|
|
|
|
|
|
my ($X, $data) = @_; |
109
|
|
|
|
|
|
|
return unpack 'x8L', $data; |
110
|
|
|
|
|
|
|
}], |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
["XineramaQueryScreens", # 5 |
113
|
|
|
|
|
|
|
\&_request_empty, # ($X) |
114
|
|
|
|
|
|
|
sub { |
115
|
|
|
|
|
|
|
my ($X, $data) = @_; |
116
|
|
|
|
|
|
|
### XineramaQueryScreens reply: unpack 'x8L*', $data |
117
|
|
|
|
|
|
|
my $num = unpack 'x8L', $data; |
118
|
|
|
|
|
|
|
map {[ unpack 'ssSS', substr($data, 32+8*$_, 8) ]} 0 .. $num-1; |
119
|
|
|
|
|
|
|
}], |
120
|
|
|
|
|
|
|
]; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub new { |
123
|
0
|
|
|
0
|
0
|
|
my ($class, $X, $request_num, $event_num, $error_num) = @_; |
124
|
|
|
|
|
|
|
### XINERAMA new() |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
_ext_requests_install ($X, $request_num, $reqs); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Any need to negotiate? |
129
|
|
|
|
|
|
|
# my ($major, $minor) = $X->req('PanoramiXQueryVersion', |
130
|
|
|
|
|
|
|
# CLIENT_MAJOR_VERSION, CLIENT_MINOR_VERSION); |
131
|
|
|
|
|
|
|
# ### $major |
132
|
|
|
|
|
|
|
# ### $minor |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
return bless { |
135
|
|
|
|
|
|
|
# major => $major, |
136
|
|
|
|
|
|
|
# minor => $minor, |
137
|
|
|
|
|
|
|
}, $class; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub _ext_requests_install { |
141
|
0
|
|
|
0
|
|
|
my ($X, $request_num, $reqs) = @_; |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
$X->{'ext_request'}->{$request_num} = $reqs; |
144
|
0
|
|
|
|
|
|
my $href = $X->{'ext_request_num'}; |
145
|
0
|
|
|
|
|
|
my $i; |
146
|
0
|
|
|
|
|
|
foreach $i (0 .. $#$reqs) { |
147
|
0
|
|
|
|
|
|
$href->{$reqs->[$i]->[0]} = [$request_num, $i]; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub _request_empty { |
152
|
0
|
0
|
|
0
|
|
|
if (@_ > 1) { |
153
|
0
|
|
|
|
|
|
croak "No parameters in this request"; |
154
|
|
|
|
|
|
|
} |
155
|
0
|
|
|
|
|
|
return ''; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub _request_xids { |
159
|
0
|
|
|
0
|
|
|
my $X = shift; |
160
|
|
|
|
|
|
|
### _request_xids(): @_ |
161
|
0
|
|
|
|
|
|
return _request_card32s ($X, map {_num_none($_)} @_); |
|
0
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
sub _request_card32s { |
164
|
0
|
|
|
0
|
|
|
shift; |
165
|
|
|
|
|
|
|
### _request_card32s(): @_ |
166
|
0
|
|
|
|
|
|
return pack 'L*', @_; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
sub _num_none { |
169
|
0
|
|
|
0
|
|
|
my ($xid) = @_; |
170
|
0
|
0
|
0
|
|
|
|
if (defined $xid && $xid eq 'None') { |
171
|
0
|
|
|
|
|
|
return 0; |
172
|
|
|
|
|
|
|
} else { |
173
|
0
|
|
|
|
|
|
return $xid; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
1; |
178
|
|
|
|
|
|
|
__END__ |