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@
This commit is contained in:
parent
ad31f353d3
commit
16431ddeb2
3 changed files with 46 additions and 3 deletions
|
@ -1,9 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.29 2018/03/12 11:15:49 wiz Exp $
|
||||
# $NetBSD: Makefile,v 1.30 2018/04/12 16:09:50 bouyer Exp $
|
||||
#
|
||||
|
||||
DISTNAME= Panel-0.3.6
|
||||
PKGNAME= deforaos-panel-0.3.6
|
||||
PKGREVISION= 5
|
||||
PKGREVISION= 6
|
||||
CATEGORIES= x11
|
||||
MASTER_SITES= https://www.defora.org/os/download/download/4417/
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
$NetBSD: distinfo,v 1.13 2016/02/20 00:46:55 khorben Exp $
|
||||
$NetBSD: distinfo,v 1.14 2018/04/12 16:09:50 bouyer Exp $
|
||||
|
||||
SHA1 (Panel-0.3.6.tar.gz) = a87f49c638a2d8df210c21bd684b3fbdc01a375a
|
||||
RMD160 (Panel-0.3.6.tar.gz) = 31a25b60c60b0198352b3fa2f26ee4f59418620d
|
||||
SHA512 (Panel-0.3.6.tar.gz) = cafdeb2e9127520dd65f1cef5e24dadac063146868517173771e8d44eb742687d9d79fa2738086008628c9cadfa39188cc0eb5624bd5efafbc00556e1b58c487
|
||||
Size (Panel-0.3.6.tar.gz) = 146129 bytes
|
||||
SHA1 (patch-src_applets_cpufreq.c) = 76b1fbd3ba6f72b0cd2cc0ef7ad324e98bb29cc3
|
||||
|
|
42
x11/deforaos-panel/patches/patch-src_applets_cpufreq.c
Normal file
42
x11/deforaos-panel/patches/patch-src_applets_cpufreq.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
$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)
|
Loading…
Reference in a new issue