Thu Apr 12 16:09:50 2018 UTC ()
Also est machdep.cpu.frequency, which is the sysctl's name on recent NetBSD
on arm.
While there also check that the frequency changed before updating the
gtk_label this makes the panel use much less CPU time.

OK khorben@


(bouyer)
diff -r1.29 -r1.30 pkgsrc/x11/deforaos-panel/Makefile
diff -r1.13 -r1.14 pkgsrc/x11/deforaos-panel/distinfo
diff -r0 -r1.1 pkgsrc/x11/deforaos-panel/patches/patch-src_applets_cpufreq.c

cvs diff -r1.29 -r1.30 pkgsrc/x11/deforaos-panel/Makefile (expand / switch to unified diff)

--- pkgsrc/x11/deforaos-panel/Makefile 2018/03/12 11:15:49 1.29
+++ pkgsrc/x11/deforaos-panel/Makefile 2018/04/12 16:09:50 1.30
@@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
1# $NetBSD: Makefile,v 1.29 2018/03/12 11:15:49 wiz Exp $ 1# $NetBSD: Makefile,v 1.30 2018/04/12 16:09:50 bouyer Exp $
2# 2#
3 3
4DISTNAME= Panel-0.3.6 4DISTNAME= Panel-0.3.6
5PKGNAME= deforaos-panel-0.3.6 5PKGNAME= deforaos-panel-0.3.6
6PKGREVISION= 5 6PKGREVISION= 6
7CATEGORIES= x11 7CATEGORIES= x11
8MASTER_SITES= https://www.defora.org/os/download/download/4417/ 8MASTER_SITES= https://www.defora.org/os/download/download/4417/
9 9
10MAINTAINER= khorben@defora.org 10MAINTAINER= khorben@defora.org
11HOMEPAGE= https://www.defora.org/ 11HOMEPAGE= https://www.defora.org/
12COMMENT= DeforaOS desktop panel 12COMMENT= DeforaOS desktop panel
13 13
14LICENSE= gnu-gpl-v3 14LICENSE= gnu-gpl-v3
15 15
16USE_TOOLS+= pkg-config 16USE_TOOLS+= pkg-config
17USE_TOOLS+= xgettext 17USE_TOOLS+= xgettext
18 18
19BUILD_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt 19BUILD_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt

cvs diff -r1.13 -r1.14 pkgsrc/x11/deforaos-panel/distinfo (expand / switch to unified diff)

--- pkgsrc/x11/deforaos-panel/distinfo 2016/02/20 00:46:55 1.13
+++ pkgsrc/x11/deforaos-panel/distinfo 2018/04/12 16:09:50 1.14
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
1$NetBSD: distinfo,v 1.13 2016/02/20 00:46:55 khorben Exp $ 1$NetBSD: distinfo,v 1.14 2018/04/12 16:09:50 bouyer Exp $
2 2
3SHA1 (Panel-0.3.6.tar.gz) = a87f49c638a2d8df210c21bd684b3fbdc01a375a 3SHA1 (Panel-0.3.6.tar.gz) = a87f49c638a2d8df210c21bd684b3fbdc01a375a
4RMD160 (Panel-0.3.6.tar.gz) = 31a25b60c60b0198352b3fa2f26ee4f59418620d 4RMD160 (Panel-0.3.6.tar.gz) = 31a25b60c60b0198352b3fa2f26ee4f59418620d
5SHA512 (Panel-0.3.6.tar.gz) = cafdeb2e9127520dd65f1cef5e24dadac063146868517173771e8d44eb742687d9d79fa2738086008628c9cadfa39188cc0eb5624bd5efafbc00556e1b58c487 5SHA512 (Panel-0.3.6.tar.gz) = cafdeb2e9127520dd65f1cef5e24dadac063146868517173771e8d44eb742687d9d79fa2738086008628c9cadfa39188cc0eb5624bd5efafbc00556e1b58c487
6Size (Panel-0.3.6.tar.gz) = 146129 bytes 6Size (Panel-0.3.6.tar.gz) = 146129 bytes
 7SHA1 (patch-src_applets_cpufreq.c) = 76b1fbd3ba6f72b0cd2cc0ef7ad324e98bb29cc3

File Added: pkgsrc/x11/deforaos-panel/patches/Attic/patch-src_applets_cpufreq.c
$NetBSD: patch-src_applets_cpufreq.c,v 1.1 2018/04/12 16:09:50 bouyer Exp $
Fix systctl name on newer NetBSD
Avoid updating display when not needed.

--- src/applets/cpufreq.c.orig	2016-01-12 02:32:16.000000000 +0100
+++ src/applets/cpufreq.c	2018-04-10 19:27:01.584667727 +0200
@@ -43,6 +43,7 @@
 	int min;
 	int max;
 	int step;
+	int actual;
 #if defined(__FreeBSD__) || defined(__NetBSD__)
 	char const * name;
 #endif
@@ -101,6 +102,9 @@
 	else if(sysctlbyname("machdep.frequency.available", &freq, &freqsize,
 				NULL, 0) == 0)
 		p = "machdep.frequency.current";
+	else if(sysctlbyname("machdep.cpu.frequency.available", &freq, &freqsize,
+				NULL, 0) == 0)
+		p = "machdep.cpu.frequency.current";
 	else
 	{
 		error_set("%s: %s", applet.name, _("No support detected"));
@@ -125,6 +129,7 @@
 	gtk_box_pack_start(GTK_BOX(cpufreq->hbox), image, FALSE, TRUE, 0);
 	cpufreq->min = 0;
 	cpufreq->max = 0;
+	cpufreq->actual = 0;
 	cpufreq->step = 1;
 	cpufreq->name = p;
 	cpufreq->max = atoi(freq);
@@ -181,6 +186,9 @@
 		helper->error(NULL, error_get(NULL), 1);
 		return TRUE;
 	}
+	if (freq == cpufreq->actual)
+		return TRUE;
+	cpufreq->actual = freq;
 	snprintf(buf, sizeof(buf), "%4u", (unsigned int)freq);
 	gtk_label_set_text(GTK_LABEL(cpufreq->label), buf);
 # if GTK_CHECK_VERSION(2, 12, 0)