summaryrefslogtreecommitdiffstats
path: root/clock.pm
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2001-03-03 06:20:43 +0000
committerdamien <damien@mandriva.com>2001-03-03 06:20:43 +0000
commit355dfd6be1a2c9773a9e6ed72903cda12a2c7c7b (patch)
tree5752d30fbe029ff1eaa38cf4f054856c13822760 /clock.pm
parentb8514b44c04ec66879a5e142333a2fa28401c97a (diff)
downloadcontrol-center-355dfd6be1a2c9773a9e6ed72903cda12a2c7c7b.tar
control-center-355dfd6be1a2c9773a9e6ed72903cda12a2c7c7b.tar.gz
control-center-355dfd6be1a2c9773a9e6ed72903cda12a2c7c7b.tar.bz2
control-center-355dfd6be1a2c9773a9e6ed72903cda12a2c7c7b.tar.xz
control-center-355dfd6be1a2c9773a9e6ed72903cda12a2c7c7b.zip
updated
Diffstat (limited to 'clock.pm')
-rwxr-xr-xclock.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/clock.pm b/clock.pm
index 5c96ae65..d39d038b 100755
--- a/clock.pm
+++ b/clock.pm
@@ -57,7 +57,7 @@ $hbox2->pack_start($spinner_s, 0, 0, 0);
my $bbox = new Gtk::HButtonBox;
$bbox->set_layout(-end);
-$vbox->pack_start($bbox, 1, 1, 5);
+$vbox->pack_start($bbox, 0, 0, 5);
my $button_ok = new Gtk::Button "OK";
$button_ok->signal_connect ( clicked => sub {
system("date -s " . $adj_h->set_value($hour) . ":" . $adj_m->set_value($min) . ":" . $adj_s->set_value($sec));
@@ -67,10 +67,11 @@ $bbox->add($button_ok );
my $button_cancel = new Gtk::Button "Cancel";
my $button_reset = new Gtk::Button "Reset";
$button_cancel->signal_connect ( clicked => sub {
+ quit_global();
+ Gtk->timeout_remove($timer);
$timer=Gtk->timeout_add(120, sub { time_to_rad(); Repaint($drawing_area) });
time_to_rad(); Repaint($drawing_area);
$button_reset->set_sensitive(0);
- quit_global();
});
$bbox->add($button_cancel );
$button_reset->signal_connect ( clicked => sub {
@@ -84,6 +85,8 @@ $button_reset->set_sensitive(0);
$window->show_all;
$timer=Gtk->timeout_add(120, sub { time_to_rad(); Repaint($drawing_area) });
+Gtk->main_iteration while Gtk->events_pending;
+$::isEmbedded and kill USR2, $::CCPID;
Gtk->main;
@@ -147,7 +150,7 @@ sub rad_to_time {
sub time_to_rad {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);# now_tm = localtime (&now);
- $dRadians_hour = $hour % 12 * $pi / 6.0;
+ $dRadians_hour = $hour % 12 * $pi / 6.0 + ($pi * $min / 360.0);
$dRadians_min = $min * $pi / 30.0;
$dRadians_sec = $sec * $pi / 30.0;
$adj_h->set_value($hour);
@@ -160,7 +163,7 @@ sub Repaint
{
my ($drawing_area) = @_;
- $dRadians_hour = POSIX::floor($dRadians_hour / $pi * 6 + 0.5) * $pi / 6.0;
+ my $dRadians_hour_real = POSIX::floor($dRadians_hour / $pi*6 + 0.5) * $pi/6.0 + $dRadians_min / 12;
$dRadians_min = POSIX::floor($dRadians_min / $pi * 30 + 0.5) * $pi / 30.0;
$dRadians_sec = POSIX::floor($dRadians_sec / $pi * 30 + 0.5) * $pi / 30.0;
$pixmap->draw_rectangle($drawing_area->style->white_gc, 1, 0, 0,
@@ -178,7 +181,7 @@ sub Repaint
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);# now_tm = localtime (&now);
my $dRadians;
foreach ([$gray_gc, 5], [$black_gc, 0]) {
- DrawHour ($pixmap, $_->[0], $midx, $midy, $dRadians_hour, $_->[1]);
+ DrawHour ($pixmap, $_->[0], $midx, $midy, $dRadians_hour_real, $_->[1]);
DrawMin ($pixmap, $_->[0], $midx, $midy, $dRadians_min, $_->[1]);
DrawSec ($pixmap, $_->[0], $midx, $midy, $dRadians_sec, $_->[1]);
}