summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2017-03-26 01:22:57 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2017-03-26 01:22:57 +0100
commita1e529eb32909581343dd1335dfb1f8cc55fb2a6 (patch)
treee440a49e6fdf1d38f95c20b78c18b772902a2f8c
parent1a30f422b41250e338d2c1d209aec1b64204c8e0 (diff)
downloaddrakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.tar
drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.tar.gz
drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.tar.bz2
drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.tar.xz
drakx-a1e529eb32909581343dd1335dfb1f8cc55fb2a6.zip
Improve the CPU usage of the clock
-rw-r--r--perl-install/NEWS3
-rwxr-xr-xperl-install/standalone/drakclock8
2 files changed, 8 insertions, 3 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 0288aeb90..bd616cffd 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,6 @@
+- drakclock:
+ o fix the display of the clock (mga#11776)
+
Version 17.75 - 17 March 2017
- diskdrake:
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;
}