diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2017-03-26 01:22:57 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2017-03-26 01:22:57 +0100 |
commit | a1e529eb32909581343dd1335dfb1f8cc55fb2a6 (patch) | |
tree | e440a49e6fdf1d38f95c20b78c18b772902a2f8c /perl-install/standalone/drakclock | |
parent | 1a30f422b41250e338d2c1d209aec1b64204c8e0 (diff) | |
download | drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.tar drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.tar.gz drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.tar.bz2 drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.tar.xz drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.zip |
Improve the CPU usage of the clock
Diffstat (limited to 'perl-install/standalone/drakclock')
-rwxr-xr-x | perl-install/standalone/drakclock | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/perl-install/standalone/drakclock b/perl-install/standalone/drakclock index c9fcf0c46..deb192bd5 100755 --- a/perl-install/standalone/drakclock +++ b/perl-install/standalone/drakclock @@ -319,7 +319,7 @@ sub determine_radian { sub draw { my ($widget, $event) = @_; $cairo = $event; - Repaint(); + Repaint(undef, 1); 0; } @@ -340,7 +340,7 @@ sub time_to_rad { } sub Repaint { - my ($o_update_time) = @_; + my ($o_update_time, $skip_redraw) = @_; my ($sec, $min, $hour) = localtime(time()); time_to_rad($sec, $min, $hour) if $o_update_time; ($midx, $midy) = ($drawing_area->get_allocated_width/2, $drawing_area->get_allocated_height/2); @@ -353,7 +353,9 @@ sub Repaint { DrawHour(); DrawMin(); DrawSec(); - $drawing_area->queue_draw; + # Only redraw the clock if there are changes. + # This highly decreases the CPU usage. + $drawing_area->queue_draw unless $skip_redraw; 1; } |