| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | package X11::Protocol::Ext::BIG_REQUESTS; # The `Big Requests Extension' | ||
| 4 | |||
| 5 | # Copyright (C) 1997 Stephen McCamant. All rights reserved. This program | ||
| 6 | # is free software; you can redistribute and/or modify it under the same | ||
| 7 | # terms as Perl itself. | ||
| 8 | |||
| 9 | # The actual mechanism for packing large requests is in X11::Protocol -- | ||
| 10 | # it just checks whether $x->{'ext'}{'BIG_REQUESTS'} is defined. | ||
| 11 | # The only thing this module does is issue the BigReqEnable request. | ||
| 12 | |||
| 13 | use X11::Protocol qw(pad padding padded make_num_hash); | ||
| 14 | use Carp; | ||
| 15 | |||
| 16 | use strict; | ||
| 17 | use vars '$VERSION'; | ||
| 18 | |||
| 19 | $VERSION = 0.01; | ||
| 20 | |||
| 21 | sub new { | ||
| 22 | my($pkg, $x, $request_num, $event_num, $error_num) = @_; | ||
| 23 | my($self) = {}; | ||
| 24 | |||
| 25 | # Constants | ||
| 26 | |||
| 27 | # Events | ||
| 28 | |||
| 29 | # Requests | ||
| 30 | $x->{'ext_request'}{$request_num} = | ||
| 31 | [ | ||
| 32 | ["BigReqEnable", sub { | ||
| 33 | my($self) = shift; | ||
| 34 | return ""; | ||
| 35 | }, sub { | ||
| 36 | my($self) = shift; | ||
| 37 | my($data) = @_; | ||
| 38 | my($max_len) = unpack("xxxxxxxxIxxxxxxxxxxxxxxxxxxxx", $data); | ||
| 39 | return ($max_len); | ||
| 40 | }] | ||
| 41 | ]; | ||
| 42 | my($i); | ||
| 43 | for $i (0 .. $#{$x->{'ext_request'}{$request_num}}) { | ||
| 44 | $x->{'ext_request_num'}{$x->{'ext_request'}{$request_num}[$i][0]} = | ||
| 45 | [$request_num, $i]; | ||
| 46 | } | ||
| 47 | $x->{'maximum_request_length'} = $x->req('BigReqEnable'); | ||
| 48 | return bless $self, $pkg; | ||
| 49 | } | ||
| 50 | |||
| 51 | 1; | ||
| 52 | __END__ |