File: test.pl

package info (click to toggle)
adesklets 0.6.1-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,044 kB
  • ctags: 1,325
  • sloc: ansic: 5,939; sh: 3,983; python: 2,344; perl: 333; makefile: 211; yacc: 80; lex: 42
file content (36 lines) | stat: -rw-r--r-- 1,099 bytes parent folder | download | duplicates (2)
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
# test.pl - Lucas Brutschy <lbrutschy@users.sourceforge.net>, 2006
#
# Small, non-exhaustive adesklets test script:
#        - Resize adesklets window to 100x100 pixels
#        - Set it to be pseudo-transparent
#        - Draw a translucent light grey rectangle on it
#        - Map it on screen
#        - Mark with a red dot the pointer position every time 
#          a user click
#
# To try it:
#        - Install adesklets with perl support enabled (default)
#        - Run perl test.py from this directory

use strict;
use adesklets;

adesklets::open_streams();

# these are just normal adesklet commands
adesklets::window_resize(100,100);
adesklets::window_reset(adesklets::WINDOW_UNMANAGED);
adesklets::window_set_transparency(1);
adesklets::context_set_color(255,255,255,64);
adesklets::image_fill_rectangle(5,5,90,90);
adesklets::window_show();

adesklets::event_loop(ButtonPress=>\&onbutton); # supply a hash of callbacks
adesklets::close_streams();

sub onbutton
{
    my($x,$y) = @_;
    adesklets::context_set_color(255,0,0,255);
    adesklets::image_fill_rectangle($x,$y,3,3);    
}