runitx Claude Opus 5.5 commited on
Commit
8e3f913
·
unverified ·
1 Parent(s): 8e5bce3

Drop vendored X11::Protocol::Ext::XFIXES, depend on the packaged one

Browse files

lib/X11/Protocol/Ext/XFIXES.pm was a reformatted copy of version 29.
Because lib/ is first on @INC it shadowed the system copy; Debian ships
version 31 in libx11-protocol-other-perl. Declare X11::Protocol (which
was missing from cpanfile too) and X11::Protocol::Ext::XFIXES instead.

Checked the XFIXES path (cursor capture, shutter -f -c) under
t/bin/with-x11: init_extension('XFIXES') succeeds with the system v31
and the capture is written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Files changed (2) hide show
  1. cpanfile +2 -0
  2. lib/X11/Protocol/Ext/XFIXES.pm +0 -1119
cpanfile CHANGED
@@ -16,6 +16,8 @@ requires "Proc::Killfam";
16
  requires "File::Which";
17
  requires "File::Copy::Recursive";
18
  requires "Moo", ">= 2.0";
 
 
19
 
20
  test_requires "Test::MockModule";
21
  test_requires "Test::Strict";
 
16
  requires "File::Which";
17
  requires "File::Copy::Recursive";
18
  requires "Moo", ">= 2.0";
19
+ requires "X11::Protocol";
20
+ requires "X11::Protocol::Ext::XFIXES"; # from the X11-Protocol-Other distribution
21
 
22
  test_requires "Test::MockModule";
23
  test_requires "Test::Strict";
lib/X11/Protocol/Ext/XFIXES.pm DELETED
@@ -1,1119 +0,0 @@
1
- # Copyright 2011, 2012, 2013, 2014 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 <http://www.gnu.org/licenses/>.
17
-
18
- BEGIN { require 5 }
19
-
20
- package X11::Protocol::Ext::XFIXES;
21
- use X11::Protocol 'padded';
22
- use strict;
23
- use warnings;
24
- use Carp;
25
-
26
- use vars '$VERSION', '@CARP_NOT';
27
- $VERSION = 29;
28
- @CARP_NOT = ('X11::Protocol');
29
-
30
- # uncomment this to run the ### lines
31
- # use Smart::Comments;
32
-
33
- # /usr/share/doc/x11proto-fixes-dev/fixesproto.txt.gz
34
- # http://cgit.freedesktop.org/xorg/proto/fixesproto/tree/fixesproto.txt
35
- # /usr/include/X11/extensions/xfixesproto.h
36
- # /usr/include/X11/extensions/xfixeswire.h
37
- #
38
- # /usr/share/doc/x11proto-xext-dev/shape.txt.gz
39
- #
40
- # /usr/include/X11/extensions/Xfixes.h
41
- # Xlib.
42
- #
43
- # /usr/share/doc/x11proto-core-dev/x11protocol.txt.gz
44
-
45
- # these not documented yet ...
46
- use constant CLIENT_MAJOR_VERSION => 5;
47
- use constant CLIENT_MINOR_VERSION => 0;
48
-
49
- #------------------------------------------------------------------------------
50
- # symbolic constants
51
-
52
- use constant constants_list => (
53
- XFixesWindowRegionKind => ['Bounding', 'Clip'],
54
- XFixesSaveSetMode => ['Insert', 'Delete'],
55
- XFixesSaveSetTarget => ['Nearest', 'Root'],
56
- XFixesSaveSetMap => ['Map', 'Unmap'],
57
-
58
- XFixesSelectionNotifySubtype => ['SetSelectionOwner', 'SelectionWindowDestroy', 'SelectionClientClose'],
59
- XFixesCursorNotifySubtype => ['DisplayCursor'],
60
-
61
- # Not sure about these two ...
62
- # XFixesSelectionEventMask => [ 'SetSelectionOwner',
63
- # 'SelectionWindowDestroy',
64
- # 'SelectionClientClose' ],
65
- # XFixesCursorEventMask => [ 'DisplayCursor' ],
66
- );
67
-
68
- sub _ext_constants_install {
69
- my ($X, $constants_arrayref) = @_;
70
- foreach (my $i = 0 ; $i <= $#$constants_arrayref ; $i += 2) {
71
- my $name = $constants_arrayref->[$i];
72
- my $aref = $constants_arrayref->[$i + 1];
73
- $X->{'ext_const'}->{$name} = $aref;
74
- $X->{'ext_const_num'}->{$name} = {X11::Protocol::make_num_hash($aref)};
75
- }
76
- }
77
-
78
- #------------------------------------------------------------------------------
79
- # events
80
-
81
- my $events_arrayref = [
82
- XFixesSelectionNotify => [
83
- 'xCxxL5',
84
- ['subtype', 'XFixesSelectionNotifySubtype'],
85
- 'window',
86
- ['owner', ['None']], # window
87
- 'selection', # atom
88
- 'time',
89
- 'selection_time',
90
- ],
91
-
92
- XFixesCursorNotify => [
93
- sub {
94
- my $X = shift;
95
- my $data = shift;
96
- ### XFixesCursorNotify unpack: @_
97
- my ($subtype, $window, $cursor_serial, $time, $cursor_name) = unpack 'xCxxL4', $data;
98
- return (
99
- @_, # base fields
100
- subtype => $X->interp('XFixesCursorNotifySubtype', $subtype),
101
- window => _interp_none($X, $window), # probably not None though
102
- cursor_serial => $cursor_serial,
103
- time => _interp_time($time),
104
-
105
- # "name" field only in XFIXES 2.0 up, probably pad garbage
106
- # in 1.0, so omit there. Give it as "cursor_name" since
107
- # plain "name" is the event name.
108
- (
109
- $X->{'ext'}->{'XFIXES'}->[3]->{'major'} >= 2
110
- ? (cursor_name => $cursor_name)
111
- : ()));
112
- },
113
- sub {
114
- my ($X, %h) = @_;
115
-
116
- # "cursor_name" can be omitted as for a 1.0 event
117
- return (pack('xCxxL4x12', $X->num('XFixesCursorNotifySubtype', $h{'subtype'}), _num_none($h{'window'}), $h{'cursor_serial'}, _num_time($h{'time'}), _num_none($h{'cursor_name'} || 0)), 1)
118
- ; # "do_seq" put in sequence number
119
- }
120
- ],
121
- ];
122
-
123
- sub _ext_events_install {
124
- my ($X, $event_num, $events_arrayref) = @_;
125
- foreach (my $i = 0 ; $i <= $#$events_arrayref ; $i += 2) {
126
- my $name = $events_arrayref->[$i];
127
- if (defined(my $already = $X->{'ext_const'}->{'Events'}->[$event_num])) {
128
- carp "Event $event_num $already overwritten with $name";
129
- }
130
- $X->{'ext_const'}->{'Events'}->[$event_num] = $name;
131
- $X->{'ext_events'}->[$event_num] = $events_arrayref->[$i + 1]; # pack/unpack
132
- $event_num++;
133
- }
134
- }
135
-
136
- #------------------------------------------------------------------------------
137
- # requests
138
-
139
- my $requests_arrayref = [[
140
- 'XFixesQueryVersion', # 0
141
- sub {
142
- my ($X, $major, $minor) = @_;
143
- ### XFixesQueryVersion request
144
- return pack 'LL', $major, $minor;
145
- },
146
- sub {
147
- my ($X, $data) = @_;
148
- ### XFixesQueryVersion reply: "$X"
149
- my @ret = unpack 'x8SS', $data;
150
- my $self;
151
- if ($self = $X->{'ext'}->{'XFIXES'}->[3]) {
152
- ($self->{'major'}, $self->{'minor'}) = @ret;
153
- }
154
- return @ret;
155
- }
156
- ],
157
-
158
- [
159
- 'XFixesChangeSaveSet', # 1
160
- sub {
161
- my ($X, $window, $mode, $target, $map) = @_;
162
- return pack('CCCxL', $X->num('XFixesSaveSetMode', $mode), $X->num('XFixesSaveSetTarget', $target), $X->num('XFixesSaveSetMap', $map), $window);
163
- }
164
- ],
165
-
166
- [
167
- 'XFixesSelectSelectionInput', # 2
168
- # ($X, $window, $selection, $event_mask)
169
- # nothing special for $event_mask yet
170
- \&_request_card32s
171
- ],
172
-
173
- [
174
- 'XFixesSelectCursorInput', # 3
175
- # ($X, $window, $event_mask) nothing special for $event_mask yet
176
- \&_request_card32s
177
- ],
178
-
179
- [
180
- 'XFixesGetCursorImage', # 4
181
- \&_request_empty,
182
- sub {
183
- my ($X, $data) = @_;
184
-
185
- # (rootx,rooty, width,height, xhot,yhot, serial, ... then pixels)
186
- my @ret = unpack 'x8ssSSSSL', $data;
187
- return (@ret, substr($data, 32, 4 * $ret[2] * $ret[3])); # width*height
188
- }
189
- ],
190
-
191
- #---------------------------------------------------------------------------
192
- # version 2.0
193
-
194
- [
195
- 'XFixesCreateRegion', # 5
196
- \&_request_region_and_rectangles
197
- ],
198
-
199
- [
200
- 'XFixesCreateRegionFromBitmap', # 6
201
- \&_request_xids
202
- ],
203
-
204
- [
205
- 'XFixesCreateRegionFromWindow', # 7
206
- sub {
207
- my ($X, $region, $window, $kind) = @_;
208
- ### XFixesCreateRegionFromWindow: $region, $window, $kind
209
- return pack('LLCxxx', $region, $window, $X->num('XFixesWindowRegionKind', $kind));
210
- }
211
- ],
212
-
213
- [
214
- 'XFixesCreateRegionFromGC', # 8
215
- \&_request_xids
216
- ],
217
-
218
- [
219
- 'XFixesCreateRegionFromPicture', # 9
220
- \&_request_xids
221
- ],
222
-
223
- [
224
- 'XFixesDestroyRegion', # 10
225
- \&_request_xids
226
- ],
227
-
228
- [
229
- 'XFixesSetRegion', # 11
230
- \&_request_region_and_rectangles
231
- ],
232
-
233
- [
234
- 'XFixesCopyRegion', # 12
235
- \&_request_xids
236
- ],
237
-
238
- [
239
- 'XFixesUnionRegion', # 13
240
- \&_request_xids
241
- ],
242
- [
243
- 'XFixesIntersectRegion', # 14
244
- \&_request_xids
245
- ],
246
- [
247
- 'XFixesSubtractRegion', # 15
248
- \&_request_xids
249
- ],
250
-
251
- [
252
- 'XFixesInvertRegion', # 16
253
- sub {
254
- my ($X, $src, $rect, $dst) = @_;
255
- return pack 'LssSSL', $src, @$rect, $dst;
256
- }
257
- ],
258
-
259
- [
260
- 'XFixesTranslateRegion', # 17
261
- sub {
262
- shift; # ($X, $region, $dx, $dy)
263
- return pack 'Lss', @_;
264
- }
265
- ],
266
-
267
- [
268
- 'XFixesRegionExtents', # 18
269
- \&_request_card32s
270
- ], # ($X, $src, $dst)
271
-
272
- [
273
- 'XFixesFetchRegion', # 19
274
- \&_request_card32s, # ($X, $region)
275
- sub {
276
- my ($X, $data) = @_;
277
- ### XFixesFetchRegion reply: length($data)
278
- my @ret = ([unpack 'x8ssSS', $data]); # bounding
279
- for (my $pos = 32 ; $pos < length($data) ; $pos += 8) {
280
- push @ret, [unpack 'ssSS', substr($data, $pos, 8)];
281
- }
282
- return @ret;
283
- }
284
- ],
285
-
286
- [
287
- 'XFixesSetGCClipRegion', # 20
288
- \&_request_xid_xy_region
289
- ], # ($gc, $x, $y, $region)
290
-
291
- [
292
- 'XFixesSetWindowShapeRegion', # 21
293
- sub {
294
- my ($X, $window, $shape_kind, $x, $y, $region) = @_;
295
-
296
- # use ShapeKind if SHAPE initialized, otherwise same Bounding and
297
- # Clip from XFixesWindowRegionKind
298
- my $kind_type = ($X->{'ext_const'}->{'ShapeKind'} ? 'ShapeKind' : 'XFixesWindowRegionKind');
299
- return pack('LCxxxssL', $window, $X->num($kind_type, $shape_kind), $x, $y, _num_none($region));
300
- }
301
- ],
302
-
303
- [
304
- 'XFixesSetPictureClipRegion', # 22
305
- \&_request_xid_xy_region
306
- ], # ($pict, $x, $y, $region)
307
-
308
- [
309
- 'XFixesSetCursorName', # 23
310
- sub {
311
- my ($X, $cursor, $str) = @_;
312
- ### XFixesSetCursorName request
313
- ### $cursor
314
- ### $str
315
- return pack('LSxx' . padded($str), $cursor, length($str), $str);
316
- }
317
- ],
318
-
319
- [
320
- 'XFixesGetCursorName', # 24
321
- \&_request_xids,
322
- sub {
323
- my ($X, $data) = @_;
324
- ### XFixesGetCursorName reply
325
- my ($atom, $len) = unpack 'x8LS', $data;
326
- return (_interp_none($X, $atom), substr($data, 32, $len));
327
- }
328
- ],
329
-
330
- [
331
- 'XFixesGetCursorImageAndName', # 25
332
- \&_request_empty,
333
- sub {
334
- my ($X, $data) = @_;
335
-
336
- # (x,y, w,h, xhot,yhot, serial, atom, $namelen, ... then pixels+name)
337
- my @ret = unpack 'x8ssSSSSLLSxx', $data;
338
- my $namelen = pop @ret;
339
- my $atom = pop @ret;
340
- my $pixelsize = 4 * $ret[2] * $ret[3];
341
- return (
342
- @ret,
343
- substr($data, 32, $pixelsize), # pixels
344
- _interp_none($X, $atom),
345
- substr($data, 32 + $pixelsize, $namelen)); # name
346
- }
347
- ],
348
-
349
- [
350
- 'XFixesChangeCursor', # 26
351
- sub {
352
- my ($X, $src, $dst) = @_;
353
- return pack 'LL', $src, $dst;
354
- }
355
- ],
356
-
357
- [
358
- 'XFixesChangeCursorByName', # 27
359
- sub {
360
- my ($X, $src, $str) = @_;
361
- return pack('LSxx' . padded($str), $src, length($str), $str);
362
- }
363
- ],
364
-
365
- #---------------------------------------------------------------------------
366
- # version 3.0
367
-
368
- [
369
- 'XFixesExpandRegion', # 28
370
- sub {
371
- shift; # $X
372
- return pack 'LLSSSS', @_; # $src, $dst, $left,$right, $top,$bottom
373
- }
374
- ],
375
-
376
- #---------------------------------------------------------------------------
377
- # version 4.0
378
-
379
- [
380
- 'XFixesHideCursor', # 29
381
- \&_request_xids
382
- ],
383
- [
384
- 'XFixesShowCursor', # 30
385
- \&_request_xids
386
- ],
387
-
388
- #---------------------------------------------------------------------------
389
- # version 5.0
390
-
391
- [
392
- 'XFixesCreatePointerBarrier', # 31
393
- sub {
394
- my ($X, $barrier, $drawable, $x1, $y1, $x2, $y2, $directions, @devices) = @_;
395
- my $devices = pack 'S*', map { _num_xinputdevice($_) } @devices;
396
- ### @devices
397
- ### $devices
398
- ### format: 'LLssssLxxS'.padded($devices)
399
- return pack(
400
- 'LLssssLxxS' . padded($devices),
401
- $barrier, # CARD32
402
- $drawable, # CARD32
403
- $x1, $y1, $x2, $y2, # INT16 x 4
404
- $directions, # CARD32
405
- scalar(@devices), # CARD16 num_devices
406
- $devices
407
- ); # packed CARD16s
408
- }
409
- ],
410
-
411
- [
412
- 'XFixesDestroyPointerBarrier', # 32
413
- \&_request_xids
414
- ], # ($X, $barrier) single barrier to destroy
415
- ];
416
-
417
- sub _ext_requests_install {
418
- my ($X, $request_num, $requests_arrayref) = @_;
419
-
420
- $X->{'ext_request'}->{$request_num} = $requests_arrayref;
421
- my $href = $X->{'ext_request_num'};
422
- my $i;
423
- foreach $i (0 .. $#$requests_arrayref) {
424
- $href->{$requests_arrayref->[$i]->[0]} = [$request_num, $i];
425
- }
426
- }
427
-
428
- #------------------------------------------------------------------------------
429
-
430
- sub new {
431
- my ($class, $X, $request_num, $event_num, $error_num) = @_;
432
- ### XFIXES new()
433
-
434
- my $self = bless {}, $class;
435
- _ext_constants_install($X, [$self->constants_list]);
436
- _ext_requests_install($X, $request_num, $requests_arrayref);
437
- _ext_events_install($X, $event_num, $events_arrayref);
438
-
439
- # the protocol spec says must query version with what we support
440
- # need it to know which error types are defined too, as otherwise oughtn't
441
- # touch anything at $event_num
442
- my ($server_major, $server_minor) = $X->req('XFixesQueryVersion', CLIENT_MAJOR_VERSION, CLIENT_MINOR_VERSION);
443
- $self->{'major'} = $server_major;
444
- $self->{'minor'} = $server_minor;
445
-
446
- # Errors
447
- _ext_error_install(
448
- $X, $error_num,
449
-
450
- # version 2.0
451
- ($server_major >= 2 ? ('Region') : ()),
452
-
453
- # version 5.0
454
- ($server_major >= 5 ? ('Barrier') : ()));
455
-
456
- return $self;
457
- }
458
-
459
- sub _request_empty {
460
- if (@_ > 1) {
461
- croak "No parameters in this request";
462
- }
463
- return '';
464
- }
465
-
466
- sub _request_xids {
467
- my $X = shift;
468
- ### _request_xids(): @_
469
- return _request_card32s($X, map { _num_none($_) } @_);
470
- }
471
-
472
- sub _request_card32s {
473
- shift;
474
- ### _request_card32s(): @_
475
- return pack 'L*', @_;
476
- }
477
-
478
- sub _request_xid_xy_region {
479
- my ($X, $xid, $x, $y, $region) = @_;
480
- return pack('LLss', $xid, _num_none($region), $x, $y);
481
- }
482
-
483
- sub _request_region_and_rectangles {
484
- shift; # $X
485
- ### _request_region_and_rectangles: @_
486
- my $region = shift;
487
- ### ret: pack('L',$region) . _pack_rectangles(@_)
488
- return pack('L', $region) . _pack_rectangles(@_);
489
- }
490
-
491
- sub _pack_rectangles {
492
- return join('', map { pack 'ssSS', @$_ } @_);
493
- }
494
-
495
- sub _num_none {
496
- my ($xid) = @_;
497
- if (defined $xid && $xid eq 'None') {
498
- return 0;
499
- } else {
500
- return $xid;
501
- }
502
- }
503
-
504
- sub _interp_none {
505
- my ($X, $xid) = @_;
506
- if ($X->{'do_interp'} && $xid == 0) {
507
- return 'None';
508
- } else {
509
- return $xid;
510
- }
511
- }
512
-
513
- sub _interp_time {
514
- my ($time) = @_;
515
- if ($time == 0) {
516
- return 'CurrentTime';
517
- } else {
518
- return $time;
519
- }
520
- }
521
-
522
- sub _num_time {
523
- my ($time) = @_;
524
- if ($time eq 'CurrentTime') {
525
- return 0;
526
- } else {
527
- return $time;
528
- }
529
- }
530
-
531
- sub _num_xinputdevice {
532
- my ($device) = @_;
533
- if ($device eq 'AllDevices') { return 0; }
534
- if ($device eq 'AllMasterDevices') { return 1; }
535
- return $device;
536
- }
537
-
538
- sub _ext_error_install {
539
- my $X = shift; # ($X, $errname1,$errname2,...)
540
- ### _ext_error_install: @_
541
- my $error_num = shift;
542
- my $aref = $X->{'ext_const'}{'Error'} # copy
543
- = [@{$X->{'ext_const'}{'Error'} || []}];
544
- my $href = $X->{'ext_const_num'}{'Error'} # copy
545
- = {%{$X->{'ext_const_num'}{'Error'} || {}}};
546
- my $i;
547
- foreach $i (0 .. $#_) {
548
- $aref->[$error_num + $i] = $_[$i];
549
- $href->{$_[$i]} = $error_num + $i;
550
- }
551
- }
552
-
553
- 1;
554
- __END__
555
-
556
- =for stopwords XFIXES XID reparent Unmap arrayref AARRGGBB GG pre-multiplied pixmap RENDER ShapeKind subwindow Ryde hotspot ARGB GC ie latin-1 DisplayCursor RGB bitmask XIDs YX-banded subtypes XTEST Xvfb xdm Xlib Xinerama subtype
557
-
558
- =head1 NAME
559
-
560
- X11::Protocol::Ext::XFIXES - miscellaneous "fixes" extension
561
-
562
- =head1 SYNOPSIS
563
-
564
- use X11::Protocol;
565
- my $X = X11::Protocol->new;
566
- $X->init_extension('XFIXES')
567
- or print "XFIXES extension not available";
568
-
569
- =head1 DESCRIPTION
570
-
571
- The XFIXES extension adds some features which are conceived as "fixing"
572
- omissions in the core X11 protocol, including
573
-
574
- =over
575
-
576
- =item *
577
-
578
- Events for changes to the selection (the cut and paste between clients).
579
-
580
- =item *
581
-
582
- Current cursor image fetching, cursor change events, and cursor naming and
583
- hiding.
584
-
585
- =item *
586
-
587
- Server-side "region" objects representing a set of rectangles.
588
-
589
- =back
590
-
591
- =head1 REQUESTS
592
-
593
- The following are made available with an C<init_extension()> per
594
- L<X11::Protocol/EXTENSIONS>.
595
-
596
- my $bool = $X->init_extension('XFIXES');
597
-
598
- =head2 XFIXES version 1.0
599
-
600
- =over
601
-
602
- =item C<($server_major, $server_minor) = $X-E<gt>XFixesQueryVersion ($client_major, $client_minor)>
603
-
604
- Negotiate a protocol version with the server. C<$client_major> and
605
- C<$client_minor> is what the client would like, the returned
606
- C<$server_major> and C<$server_minor> is what the server will do, which
607
- might be less than requested (but not more than).
608
-
609
- The current code in this module supports up to 4.0 and automatically
610
- negotiates within C<init_extension()>, so direct use of
611
- C<XFixesQueryVersion()> is not necessary. Asking for higher than the code
612
- supports might be a bad idea.
613
-
614
- =item C<($atom, $str) = $X-E<gt>XFixesChangeSaveSet ($window, $mode, $target, $map)>
615
-
616
- Insert or delete C<$window> (an XID) from the "save set" of resources to be
617
- retained on the server when the client disconnects. This is an extended
618
- version of the core C<ChangeSaveSet()> request.
619
-
620
- C<$mode> is either "Insert" or "Delete".
621
-
622
- C<$target> is how to reparent C<$window> on client close-down, either
623
- "Nearest" or "Root". The core C<ChangeSaveSet()> is "Nearest" and means go
624
- to the next non-client ancestor window. "Root" means go to the root window.
625
-
626
- C<$map> is either "Map" or "Unmap" to apply to C<$window> on close-down.
627
- The core C<ChangeSaveSet()> is "Map".
628
-
629
- =item $X-E<gt>XFixesSelectSelectionInput ($window, $selection, $event_mask)>
630
-
631
- Select C<XFixesSelectionNotify> events (see L</"EVENTS"> below) to be sent
632
- to C<$window> when C<$selection> (an atom) changes.
633
-
634
- $X->XFixesSelectSelectionInput ($my_window,
635
- $X->atom('PRIMARY'),
636
- 0x07);
637
-
638
- C<$window> is given in the resulting C<XFixesSelectionNotify>. It probably
639
- works to make it just a root window. Selections are global to the whole
640
- server, so the window doesn't implicitly choose a screen or anything.
641
-
642
- C<$event_mask> has three bits for which event subtypes should be reported.
643
-
644
- bitpos bitval
645
- SetSelectionOwner 0 0x01
646
- SelectionWindowDestroy 1 0x02
647
- SelectionClientClose 2 0x04
648
-
649
- There's no pack function for these yet so just give an integer, for instance
650
- 0x07 for all three.
651
-
652
- See F<examples/xfixes-selection.pl> for a sample program listening to
653
- selection changes with this request.
654
-
655
- =item $X-E<gt>XFixesSelectCursorInput ($window, $event_mask)>
656
-
657
- Select C<XFixesCursorNotify> events (see L</"EVENTS"> below) to be sent to
658
- the client.
659
-
660
- C<$window> is given in the resulting C<XFixesSelectionNotify>. It probably
661
- works to make it just a root window. The cursor image is global and the
662
- events are for any change, not merely within C<$window>.
663
-
664
- C<$event_mask> has only a single bit, asking for displayed cursor changes,
665
-
666
- bitpos bitval
667
- DisplayCursor 0 0x01
668
-
669
- There's no pack function for this yet, just give integer 1 or 0.
670
-
671
- =item ($root_x,$root_y, $width,$height, $xhot,$yhot, $serial, $pixels) = $X-E<gt>XFixesGetCursorImage ()>
672
-
673
- Return the size and pixel contents of the currently displayed mouse pointer
674
- cursor.
675
-
676
- C<$root_x>,C<$root_y> is the pointer location in root window coordinates
677
- (similar to C<QueryPointer()>).
678
-
679
- C<$width>,C<$height> is the size of the cursor image. C<$xhot>,C<$yhot> is
680
- the "hotspot" position within that, which is the pixel that follows the
681
- pointer location.
682
-
683
- C<$pixels> is a byte string of packed "ARGB" pixel values. Each is 32-bits
684
- in client byte order, with C<$width> many in each row and C<$height> such
685
- rows and no padding in between, so a total C<4*$width*$height> bytes. This
686
- can be unpacked with for instance
687
-
688
- my @argb = unpack 'L*', $pixels; # each 0xAARRGGBB
689
-
690
- # top left pixel is in $argb[0]
691
- my $alpha = ($argb[0] >> 24) & 0xFF; # each value
692
- my $red = ($argb[0] >> 16) & 0xFF; # 0 to 255
693
- my $green = ($argb[0] >> 8) & 0xFF;
694
- my $blue = $argb[0] & 0xFF;
695
-
696
- The alpha transparency is pre-multiplied into the RGB components, so if the
697
- alpha is zero (transparent) then the components are zero too.
698
-
699
- The core C<CreateCursor()> bitmask always makes alpha=0 transparent or
700
- alpha=255 opaque pixels. The RENDER extension (see
701
- L<X11::Protocol::Ext::RENDER>) can make partially transparent cursors.
702
-
703
- There's no direct way to get the image of a cursor by its XID (except
704
- something dodgy like a C<GrabPointer()> to make it the displayed cursor).
705
- Usually cursor XIDs are only ever created by a client itself so no need to
706
- read back (and the cursor XID can't be read out of an arbitrary window --
707
- though the XTEST extension can do some comparing, per
708
- L<X11::Protocol::Ext::XTEST>).
709
-
710
- For reference, in the X.org server circa version 1.11, the server may start
711
- up with no cursor at all, and when that happens an attempt to
712
- C<XFixesGetCursorImage()> gives a "Cursor" error. In practice this probably
713
- only happens using a bare Xvfb or similar, since in normal use xdm or the
714
- window manager will almost certainly have set a cursor.
715
-
716
- See F<examples/xfixes-cursor-image.pl> in the X11-Protocol-Other sources for
717
- a sample program getting the cursor image with this request.
718
-
719
- =back
720
-
721
- =head2 XFIXES version 2.0
722
-
723
- A region object on the server represents a set of rectangles, each
724
- x,y,width,height, with positive or negative x,y, and the set possibly made
725
- of disconnected sections, etc. (Basically a server-side copy of the Xlib
726
- region code, see L<XCreateRegion(3)>.)
727
-
728
- Each rectangle might be just 1x1 for a single pixel, so a region can
729
- represent any bitmap, but it's geared towards the sort of rectangle
730
- arithmetic which arises from overlapping rectangular windows etc.
731
-
732
- =over
733
-
734
- =item C<$X-E<gt>XFixesCreateRegion ($region, $rect...)>
735
-
736
- Create C<$region> (a new XID) as a region and set it to the union of the
737
- given rectangles, or empty if none. Each C<$rect> is an arrayref
738
- C<[$x,$y,$width,$height]>.
739
-
740
- my $region = $X->new_rsrc;
741
- $X->XFixesCreateRegion ($region, [0,0,10,5], [100,100,1,1]);
742
-
743
- =item C<$X-E<gt>XFixesCreateRegionFromBitmap ($region, $bitmap)>
744
-
745
- Create a region initialized from the 1 bits of C<$bitmap> (a pixmap XID).
746
-
747
- my $region = $X->new_rsrc;
748
- $X->XFixesCreateRegionFromBitmap ($region, $bitmap);
749
-
750
- =item C<$X-E<gt>XFixesCreateRegionFromWindow ($region, $window, $kind)>
751
-
752
- Create a region initialized from the shape of C<$window> (an XID). C<$kind>
753
- is either "Bounding" or "Clip" as per the SHAPE extension (see
754
- L<X11::Protocol::Ext::SHAPE>).
755
-
756
- my $region = $X->new_rsrc;
757
- $X->XFixesCreateRegionFromBitmap ($region, $window, 'Clip');
758
-
759
- There's no need to C<$X-E<gt>init_extension('SHAPE')> before using this
760
- request. Any shape is just on the server and results in a C<$region> of
761
- either a single rectangle or set of rectangles for a shape.
762
-
763
- =item C<$X-E<gt>XFixesCreateRegionFromGC ($region, $gc)>
764
-
765
- Create a region initialized from the clip mask of C<$gc> (an XID).
766
-
767
- my $region = $X->new_rsrc;
768
- $X->XFixesCreateRegionFromGC ($region, $gc);
769
-
770
- The region is relative to the GC C<clip_x_origin> and C<clip_y_origin>,
771
- ie. those offsets are not applied to the X,Y in the region.
772
-
773
- =item C<$X-E<gt>XFixesCreateRegionFromPicture ($region, $picture)>
774
-
775
- Create a region initialized from a RENDER C<$picture> (an XID).
776
-
777
- my $region = $X->new_rsrc;
778
- $X->XFixesCreateRegionFromBitmap ($region, $picture);
779
-
780
- The region is relative to the picture C<clip_x_origin> and C<clip_y_origin>,
781
- ie. those offsets are not applied to the X,Y in the region.
782
-
783
- Picture objects are from the RENDER extension (see
784
- L<X11::Protocol::Ext::RENDER>). This request always exists, but is not
785
- useful without RENDER.
786
-
787
- =item C<$X-E<gt>XFixesDestroyRegion ($region)>
788
-
789
- Destroy C<$region>.
790
-
791
- =item C<$X-E<gt>XFixesSetRegion ($region, $rect...)>
792
-
793
- Set C<$region> to the union of the given rectangles, or empty if none. Each
794
- C<$rect> is an arrayref C<[$x,$y,$width,$height]>, as per
795
- C<XFixesCreateRegion()> above.
796
-
797
- $X->XFixesSetRegion ($region, [0,0,20,10], [100,100,5,5])
798
-
799
- =item C<$X-E<gt>XFixesCopyRegion ($dst, $src)>
800
-
801
- Copy a region C<$src> to region C<$dst>.
802
-
803
- =item C<$X-E<gt>XFixesUnionRegion ($src1, $src2, $dst)>
804
-
805
- =item C<$X-E<gt>XFixesIntersectRegion ($src1, $src2, $dst)>
806
-
807
- =item C<$X-E<gt>XFixesSubtractRegion ($src1, $src2, $dst)>
808
-
809
- Set region C<$dst> to respectively the union or intersection of C<$src1> and
810
- C<$src2>, or the subtraction C<$src1> - C<$src2>.
811
-
812
- C<$dst> can be one of the source regions if desired, to change in-place.
813
-
814
- =item C<$X-E<gt>XFixesInvertRegion ($src, $rect, $dst)>
815
-
816
- Set region C<$dst> to the inverse of C<$src> bounded by rectangle C<$rect>,
817
- ie. C<$rect> subtract C<$src>. C<$rect> is an arrayref
818
- C<[$x,$y,$width,$height]>.
819
-
820
- $X-XFixesInvertRegion ($src, [10,10, 200,100], $dst)>
821
-
822
- C<$dst> can be the same as C<$src> to do an "in-place" invert.
823
-
824
- =item C<$X-E<gt>XFixesTranslateRegion ($region, $dx, $dy)>
825
-
826
- Move the area covered by C<$region> by an offset C<$dx> and C<$dy>
827
- (integers).
828
-
829
- =item C<$X-E<gt>XFixesRegionExtents ($dst, $src)>
830
-
831
- Set region C<$dst> to the rectangular bounds of region C<$src>. If C<$src>
832
- is empty then C<$dst> is set to empty.
833
-
834
- =item C<($bounding, @parts) = $X-E<gt>XFixesFetchRegion ($region)>
835
-
836
- Return the rectangles which cover C<$region>. Each returned element is an
837
- arrayref
838
-
839
- [$x,$y,$width,$height]
840
-
841
- The first is a bounding rectangle, and after that the individual rectangles
842
- making up the region, in "YX-banded" order.
843
-
844
- my ($bounding, @rects) = $X->XFixesFetchRegion ($region);
845
- print "bounded by ",join(',',@$bounding);
846
- foreach my $rect (@rects) {
847
- print " rect part ",join(',',@$rect);
848
- }
849
-
850
- =item C<$X-E<gt>XFixesSetGCClipRegion ($gc, $clip_x_origin, $clip_y_origin, $region)>
851
-
852
- Set the clip mask of C<$gc> (an XID) to C<$region> (an XID), and set the
853
- clip origin to C<$clip_x_origin>,C<$clip_x_origin>.
854
-
855
- This is similar to the core C<SetClipRectangles()>, but the rectangles are
856
- from C<$region> (and no "ordering" parameter).
857
-
858
- =item C<$X-E<gt>XFixesSetWindowShapeRegion ($window, $kind, $x_offset, $y_offset, $region)>
859
-
860
- Set the shape mask of C<$window> (an XID) to C<$region>, at offset
861
- C<$x_offset>,C<$y_offset> into the window. C<$kind> is a ShapeKind, either
862
- "Bounding" or "Clip".
863
-
864
- This is similar to C<ShapeMask()> (see L<X11::Protocol::Ext::SHAPE>) with
865
- operation "Set" and a a region instead of a bitmap.
866
-
867
- It's not necessary to C<$X-E<gt>init_extension('SHAPE')> before using this
868
- request. If SHAPE is not available on the server then presumably this
869
- request gives an error reply.
870
-
871
- =item C<$X-E<gt>XFixesSetPictureClipRegion ($picture, $clip_x_origin, $clip_y_origin, $region)>
872
-
873
- Set the clip mask of RENDER C<$picture> (an XID) to C<$region>, and set the
874
- clip origin to C<$clip_x_origin>,C<$clip_x_origin>.
875
-
876
- This is similar to C<RenderSetPictureClipRectangles()>, but the rectangles
877
- are from C<$region>.
878
-
879
- Picture objects are from the RENDER extension (see
880
- L<X11::Protocol::Ext::RENDER>). The request always exists, but is not useful
881
- without RENDER.
882
-
883
- =item C<$X-E<gt>XFixesSetCursorName ($cursor, $str)>
884
-
885
- Set a name for cursor object C<$cursor> (an XID). The name string C<$str>
886
- is interned as an atom in the server and therefore should consist only of
887
- latin-1 characters. (Perhaps in the future that might be enforced here, or
888
- wide chars converted.)
889
-
890
- =item C<($atom, $str) = $X-E<gt>XFixesGetCursorName ($cursor)>
891
-
892
- Get the name of mouse pointer cursor C<$cursor> (an XID), as set by
893
- C<XFixesSetCursorName()>.
894
-
895
- The returned C<$atom> is the name atom (an integer) and C<$str> is the name
896
- string (which is the atom's name). If there's no name for C<$cursor> then
897
- C<$atom> is string "None" (or 0 if no C<$X-E<gt>{'do_interp'}>) and C<$str>
898
- is empty "".
899
-
900
- =item C<($x,$y, $width,$height, $xhot,$yhot, $serial, $pixels, $atom, $str) = $X-E<gt>XFixesGetCursorImageAndName ()>
901
-
902
- Get the image and name of the current mouse pointer cursor. The return is
903
- per C<XFixesGetCursorImage()> plus C<XFixesGetCursorName()> described above.
904
-
905
- =item C<$X-E<gt>XFixesChangeCursor ($src, $dst)>
906
-
907
- Change the contents of cursor C<$dst> (an XID) to the contents of
908
- cursor C<$src> (an XID).
909
-
910
- =item C<$X-E<gt>XFixesChangeCursorByName ($src, $dst_str)>
911
-
912
- Change the contents of any cursors with name C<$dst_str> (a string) to the
913
- contents of cursor C<$src>. If there's no cursors with name C<$dst_str>
914
- then do nothing.
915
-
916
- =back
917
-
918
- =head2 XFIXES version 3.0
919
-
920
- =over
921
-
922
- =item C<$X-E<gt>XFixesExpandRegion ($src, $dst, $left,$right,$top,$bottom)>
923
-
924
- Set region C<$dst> (an XID) to the rectangles of region C<$src>, with each
925
- rectangle expanded by C<$left>, C<$right>, C<$top>, C<$bottom> many pixels
926
- in those respective directions.
927
-
928
- Notice it doesn't matter how C<$src> is expressed as rectangles, the effect
929
- is as if each individual pixel in C<$src> was expanded and the union of the
930
- result taken.
931
-
932
- =back
933
-
934
- =head2 XFIXES version 4.0
935
-
936
- =over
937
-
938
- =item C<$X-E<gt>XFixesHideCursor ($window)>
939
-
940
- =item C<$X-E<gt>XFixesShowCursor ($window)>
941
-
942
- Hide or show the mouse pointer cursor while it's in C<$window> (an XID) or
943
- any subwindow of C<$window>.
944
-
945
- This hiding for each window is a per-client setting. If more than one
946
- client requests hiding then the cursor remains hidden until all of them
947
- "show" again. If a client disconnects or is killed then its hides are
948
- automatically undone.
949
-
950
- =back
951
-
952
- =head2 XFIXES version 5.0
953
-
954
- =over
955
-
956
- =item C<$X-E<gt>XFixesCreatePointerBarrier ($barrier, $drawable, $x1,$y1, $x2,$y2, $directions)>
957
-
958
- =item C<$X-E<gt>XFixesCreatePointerBarrier ($barrier, $drawable, $x1,$y1, $x2,$y2, $directions, $deviceid...)>
959
-
960
- Create C<$barrier> (a new XID) as a barrier object which prevents user mouse
961
- pointer movement across a line between points C<$x1,$y1> and C<$x2,$y2>.
962
- For example
963
-
964
- my $barrier = $X->new_rsrc;
965
- $X->XFixesCreatePointerBarrier ($barrier, $X->root,
966
- 100,100, 100,500,
967
- 0);
968
-
969
- X,Y coordinates are screen coordinates on the screen of C<$drawable>. The
970
- line must be horizontal or vertical, so either C<$x1==$x2> or C<$y1==$y2>
971
- (but not both). A horizontal barrier is across the top edge of the line
972
- pixels, a vertical barrier is along the left edge of the line pixels.
973
-
974
- C<$directions> is an integer OR of the follow bits for which directions to
975
- allow some movement across the line. A value 0 means no movement across is
976
- allowed.
977
-
978
- PositiveX 1
979
- PositiveY 2
980
- NegativeX 4
981
- NegativeY 8
982
-
983
- For example on a horizontal line, value 8 would allow the pointer to move
984
- through the line in the negative Y direction (up the screen), and movement
985
- in the positive Y direction (down the screen) would still be forbidden.
986
-
987
- C<$directions> can let the user move the mouse out of some sort of forbidden
988
- region but not go back in.
989
-
990
- Optional C<$deviceid> arguments are X Input Extension 2.0 devices the
991
- barrier should apply to (see L<X11::Protocol::Ext::XInputExtension>). With
992
- no arguments the barrier is just for the core protocol mouse pointer. Each
993
- argument can be
994
-
995
- device ID integer
996
- "AllDevices" enum string, 0
997
- "AllMasterDevices" enum string, 1
998
-
999
- It's not necessary to C<$X-E<gt>init_extension('XInputExtension')> before
1000
- using this request.
1001
-
1002
- The user can move the mouse pointer to go around a barrier line but by
1003
- putting lines together a region can be constructed keeping the pointer
1004
- inside or outside, or even making a maze to trick the user!
1005
-
1006
- Touchscreen pad input is not affected by barriers, and
1007
- C<$X-E<gt>WarpPointer()> can still move the pointer anywhere.
1008
-
1009
- One intended use is when a Xinerama screen (see
1010
- L<X11::Protocol::Ext::XINERAMA>) is made from monitors of different pixel
1011
- sizes so parts of the logical screen extent are off the edge of one of the
1012
- smaller monitors. Barriers can prevent the user losing the mouse in one of
1013
- those dead regions.
1014
-
1015
- For reference, some X.org server versions prior to some time around version
1016
- 1.14 did not accept C<$deviceid> arguments in the request and gave a
1017
- C<Length> error on attempting to pass them. Those servers might have given
1018
- an C<Implementation> error anyway (for barrier feature not yet implemented).
1019
-
1020
- =item C<$X-E<gt>XFixesDestroyPointerBarrier ($barrier)>
1021
-
1022
- Destroy the given barrier (an XID).
1023
-
1024
- =back
1025
-
1026
- =head1 EVENTS
1027
-
1028
- The following events have the usual fields
1029
-
1030
- name "XFixes..."
1031
- synthetic true if from a SendEvent
1032
- code integer opcode
1033
- sequence_number integer
1034
-
1035
- =over
1036
-
1037
- =item C<XFixesSelectionNotify>
1038
-
1039
- This is sent to the client when selected by C<XFixesSelectSelectionInput>
1040
- above. It reports changes to the selection. The event-specific fields are
1041
-
1042
- subtype enum string
1043
- window XID
1044
- owner XID of owner window, or "None"
1045
- selection atom integer
1046
- time integer, server timestamp
1047
- selection_time integer, server timestamp
1048
-
1049
- C<subtype> is one of
1050
-
1051
- SetSelectionOwner
1052
- SelectionWindowDestroy
1053
- SelectionClientClose
1054
-
1055
- C<time> is when the event was generated, C<selection_time> is when the
1056
- selection was owned.
1057
-
1058
- =item C<XFixesCursorNotify>
1059
-
1060
- This is sent to the client when selected by C<XFixesSelectCursorInput()>
1061
- above. It reports when the currently displayed mouse pointer cursor has
1062
- changed. It has the following event-specific fields,
1063
-
1064
- subtype enum string, currently always "DisplayCursor"
1065
- window XID
1066
- cursor_serial integer
1067
- time integer, server timestamp
1068
- cursor_name atom or "None" (XFIXES 2.0 up)
1069
-
1070
- C<subtype> is "DisplayCursor" when the displayed cursor has changed. This
1071
- is the only subtype currently.
1072
-
1073
- C<cursor_serial> is a serial number as per C<XFixesGetCursorImage()>.
1074
- A client can use this to notice when the displayed cursor is something it
1075
- has already fetched with C<XFixesGetCursorImage()>.
1076
-
1077
- C<cursor_name> is the atom of the name given to the cursor by
1078
- C<XFixesSetCursorName>, or string "None" if no name. This field is new in
1079
- XFIXES 2.0 and is present in the event unpack only if the server does XFIXES
1080
- 2.0 or higher. For C<$X-E<gt>pack_event()>, C<cursor_name> is optional and
1081
- the field is set if given.
1082
-
1083
- =back
1084
-
1085
- =head1 ERRORS
1086
-
1087
- Error type "Region" is a bad C<$region> resource XID in a request (XFIXES
1088
- 2.0 up).
1089
-
1090
- =head1 SEE ALSO
1091
-
1092
- L<X11::Protocol>,
1093
- L<X11::Protocol::Ext::SHAPE>,
1094
- L<X11::Protocol::Ext::RENDER>
1095
-
1096
- F</usr/share/doc/x11proto-fixes-dev/fixesproto.txt.gz>
1097
-
1098
- =head1 HOME PAGE
1099
-
1100
- L<http://user42.tuxfamily.org/x11-protocol-other/index.html>
1101
-
1102
- =head1 LICENSE
1103
-
1104
- Copyright 2011, 2012, 2013, 2014 Kevin Ryde
1105
-
1106
- X11-Protocol-Other is free software; you can redistribute it and/or modify
1107
- it under the terms of the GNU General Public License as published by the
1108
- Free Software Foundation; either version 3, or (at your option) any later
1109
- version.
1110
-
1111
- X11-Protocol-Other is distributed in the hope that it will be useful, but
1112
- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1113
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
1114
- more details.
1115
-
1116
- You should have received a copy of the GNU General Public License along with
1117
- X11-Protocol-Other. If not, see <http://www.gnu.org/licenses/>.
1118
-
1119
- =cut