1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
#!/usr/bin/perl -w
# Copyright 2011, 2012 Kevin Ryde
# This file is part of X11-Protocol-Other.
#
# X11-Protocol-Other is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3, or (at your option) any
# later version.
#
# X11-Protocol-Other is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with X11-Protocol-Other. If not, see <http://www.gnu.org/licenses/>.
use strict;
use X11::Protocol;
use lib 'devel', '.';
# uncomment this to run the ### lines
use Smart::Comments;
{
# MitScreenSaverSetAttributes() initial window contents
my $X = X11::Protocol->new (':0');
$X->init_extension('MIT-SCREEN-SAVER') or die;
$X->MitScreenSaverSelectInput ($X->root, 0x03);
$X->QueryPointer($X->root); # sync
$X->MitScreenSaverSetAttributes
($X->root,
'InputOutput', # class
0, # depth, from parent
'CopyFromParent', # visual
100,100, # x,y
1000,500, # width,height
0, # border
# background_pixmap => "None",
background_pixel => $X->white_pixel,
);
$X->QueryPointer($X->root); # sync
$X->{'event_handler'} = sub {
my (%h) = @_;
### event_handler: \%h
if ($h{'name'} eq 'MitScreenSaverNotify') {
### %h
}
};
$X->ForceScreenSaver ('Activate');
for (;;) {
$X->handle_input;
}
exit 0;
}
{
# MitScreenSaverSetAttributes()
my $X = X11::Protocol->new (':0');
$X->init_extension('MIT-SCREEN-SAVER') or die;
$X->MitScreenSaverSelectInput ($X->root, 0x03);
$X->QueryPointer($X->root); # sync
$X->MitScreenSaverSetAttributes
($X->root,
'InputOutput', # class
0, # depth, from parent
'CopyFromParent', # visual
0,0, # x,y
1000,500, # width,height
0, # border
background_pixel => $X->white_pixel,
);
$X->QueryPointer($X->root); # sync
$X->{'event_handler'} = sub {
my (%h) = @_;
### event_handler: \%h
if ($h{'name'} eq 'MitScreenSaverNotify') {
my @info = $X->MitScreenSaverQueryInfo ($X->root);
### @info
}
};
for (;;) {
$X->handle_input;
}
exit 0;
}
{
# conflicting MitScreenSaverSetAttributes()
my $X1 = X11::Protocol->new (':0');
my $X2 = X11::Protocol->new (':0');
$X1->init_extension('MIT-SCREEN-SAVER') or die;
$X2->init_extension('MIT-SCREEN-SAVER') or die;
$X1->MitScreenSaverSetAttributes
($X1->root,
'InputOutput', # class
0, # depth, from parent
'CopyFromParent', # visual
0,0, # x,y
1000,500, # width,height
0, # border
background_pixel => $X1->white_pixel,
);
$X1->QueryPointer($X1->root); # sync
$X2->MitScreenSaverSetAttributes
($X2->root,
'InputOutput', # class
0, # depth, from parent
'CopyFromParent', # visual
0,0, # x,y
1000,500, # width,height
0, # border
background_pixel => $X2->white_pixel,
);
$X2->QueryPointer($X2->root); # sync
exit 0;
}
{
my $X = X11::Protocol->new (':0');
$X->init_extension('MIT-SCREEN-SAVER') or die;
### root: $X->root
{ my @version = $X->MitScreenSaverQueryVersion (99,99);
### @version
}
$X->QueryPointer($X->root); # sync
{ my @info = $X->MitScreenSaverQueryInfo ($X->root);
### @info
}
$X->QueryPointer($X->root); # sync
$X->MitScreenSaverSelectInput ($X->root, 0x03);
$X->QueryPointer($X->root); # sync
$X->MitScreenSaverUnsetAttributes ($X->root);
$X->QueryPointer($X->root); # sync
$X->MitScreenSaverSetAttributes
($X->root,
'InputOutput', # class
0, # depth, from parent
'CopyFromParent', # visual
0,0, # x,y
1000,500, # width,height
0, # border
background_pixel => $X->white_pixel,
);
$X->QueryPointer($X->root); # sync
{ my @info = $X->MitScreenSaverQueryInfo ($X->root);
### @info
}
$X->QueryPointer($X->root); # sync
exit 0;
$X->{'event_handler'} = sub {
my (%h) = @_;
### event_handler: \%h
if ($h{'name'} eq 'MitScreenSaverNotify') {
my @info = $X->MitScreenSaverQueryInfo ($X->root);
### @info
}
};
$X->ForceScreenSaver ('Activate');
$X->QueryPointer($X->root); # sync
foreach (1 .. 20) {
$X->handle_input;
}
exit 0;
}
|