summaryrefslogtreecommitdiffstats
path: root/clock.pl
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-02-17 08:17:19 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-02-17 08:17:19 +0000
commitdd19958e9f0336da204c2c0bee0fb649b04ed8b9 (patch)
tree5c91698985e3c7f8349060c031e11ad9444b8960 /clock.pl
parent2c51cf1aec29cb9ba15a3da996b838b09accb6b2 (diff)
downloadcontrol-center-dd19958e9f0336da204c2c0bee0fb649b04ed8b9.tar
control-center-dd19958e9f0336da204c2c0bee0fb649b04ed8b9.tar.gz
control-center-dd19958e9f0336da204c2c0bee0fb649b04ed8b9.tar.bz2
control-center-dd19958e9f0336da204c2c0bee0fb649b04ed8b9.tar.xz
control-center-dd19958e9f0336da204c2c0bee0fb649b04ed8b9.zip
- clean up
- fix undisplayed clock when embedded
Diffstat (limited to 'clock.pl')
-rwxr-xr-xclock.pl21
1 files changed, 10 insertions, 11 deletions
diff --git a/clock.pl b/clock.pl
index 3911adba..cf18ecf4 100755
--- a/clock.pl
+++ b/clock.pl
@@ -47,7 +47,7 @@ $button_time->signal_connect(clicked => sub {
}
});
-my $drawing_area = Gtk2::DrawingArea->new;
+my $drawing_area;
my $adj_h = Gtk2::Adjustment->new(0.0, 0.0, 23.0, 1.0, 5.0, 0.0);
my $adj_m = Gtk2::Adjustment->new(0.0, 0.0, 59.0, 1.0, 5.0, 0.0);
@@ -65,7 +65,7 @@ $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0),
),
1, gtkpack_(Gtk2::VBox->new(0,0),
0, gtkpack_(Gtk2::HBox->new(0,0),
- 0, $drawing_area
+ 0, $drawing_area = gtkset_size_request(Gtk2::DrawingArea->new, 300, 300),
),
0, gtkpack_(Gtk2::HBox->new(1,0),
0, Gtk2::HBox->new(1,0),
@@ -102,10 +102,10 @@ $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0),
);
my $pressed;
-$drawing_area->set_size_request(300,300);
$drawing_area->set_events([ 'button_press_mask', 'button_release_mask', "pointer_motion_mask" ]);
$drawing_area->signal_connect(expose_event => \&expose_event);
-$drawing_area->signal_connect(realize => \&configure_event);
+$drawing_area->signal_connect(realize => sub { print "REALIZE\n" });
+$drawing_area->signal_connect(configure => sub { print "CONFIGURE\n" });
$drawing_area->signal_connect(button_press_event => sub { $pressed = 1 });
$drawing_area->signal_connect(button_release_event => sub { $first = 1; $pressed = 0 });
$drawing_area->signal_connect(motion_notify_event => \&motion_event);
@@ -201,13 +201,12 @@ sub determine_radian {
sub expose_event {
my ($widget, $event) = @_;
my ($x, $y, $width, $height) = $event->area->values;
+ unless ($pixmap) {
+ my $window = $widget->window;
+ $pixmap = Gtk2::Gdk::Pixmap->new($window, $width, $height, $window->get_depth);
+ }
$widget->window->draw_drawable($widget->style->fg_gc('normal'), $pixmap, $x, $y, $x, $y, $width, $height);
-}
-
-sub configure_event {
- my ($widget) = @_;
- my $window = $widget->window;
- $pixmap = Gtk2::Gdk::Pixmap->new($window, $widget->allocation->width, $widget->allocation->height, $window->get_depth);
+ 0;
}
sub rad_to_time {
@@ -217,7 +216,7 @@ sub rad_to_time {
}
sub time_to_rad {
- my ($sec, $min, $hour, undef, undef, undef, undef, undef, undef) = @_;
+ my ($sec, $min, $hour) = @_;
$dRadians_hour = $hour % 12 * $PI / 6;
$dRadians_min = $min * $PI / 30;
$dRadians_sec = $sec * $PI / 30;