aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-12-18 19:48:56 +0100
committerMattias Andrée <maandree@kth.se>2016-12-18 19:48:56 +0100
commit0270fcba233754779cbf8c11d2ff22d8ecded556 (patch)
treebf349f9c08ab736116d609b0cb43d92e2c8d360e
parentcg-base: Add NO_DEFAULT_PRIORITY (diff)
downloadcg-tools-0270fcba233754779cbf8c11d2ff22d8ecded556.tar.gz
cg-tools-0270fcba233754779cbf8c11d2ff22d8ecded556.tar.bz2
cg-tools-0270fcba233754779cbf8c11d2ff22d8ecded556.tar.xz
cg-base: add filters_n
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--src/cg-base.c6
-rw-r--r--src/cg-base.h5
-rw-r--r--src/cg-brilliance.c8
-rw-r--r--src/cg-darkroom.c8
-rw-r--r--src/cg-gamma.c10
-rw-r--r--src/cg-limits.c10
-rw-r--r--src/cg-negative.c8
-rw-r--r--src/cg-rainbow.c4
-rw-r--r--src/cg-sleepmode.c6
9 files changed, 38 insertions, 27 deletions
diff --git a/src/cg-base.c b/src/cg-base.c
index 2de0abc..c0abf47 100644
--- a/src/cg-base.c
+++ b/src/cg-base.c
@@ -61,6 +61,11 @@ libcoopgamma_crtc_info_t* crtc_info = NULL;
*/
size_t crtcs_n = 0;
+/**
+ * The number of filters
+ */
+size_t filters_n = 0;
+
/**
* Contexts for asynchronous ramp updates
@@ -724,6 +729,7 @@ int main(int argc, char* argv[])
dealloc_crtcs = 1;
for (; crtcs[crtcs_n] != NULL; crtcs_n++);
}
+ filters_n = crtcs_n;
if (crtcs_n == 0)
{
diff --git a/src/cg-base.h b/src/cg-base.h
index 5ab23a9..f4beed1 100644
--- a/src/cg-base.h
+++ b/src/cg-base.h
@@ -133,6 +133,11 @@ extern libcoopgamma_crtc_info_t* crtc_info;
*/
extern size_t crtcs_n;
+/**
+ * The number of filters
+ */
+extern size_t filters_n;
+
/**
diff --git a/src/cg-brilliance.c b/src/cg-brilliance.c
index 5215448..05b8a5c 100644
--- a/src/cg-brilliance.c
+++ b/src/cg-brilliance.c
@@ -248,20 +248,20 @@ int start(void)
size_t i, j;
if (xflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_REMOVE;
else if (dflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_DEATH;
else
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_REMOVAL;
if (!xflag)
if ((r = make_slaves()) < 0)
return r;
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_updates[i].master) || !(crtc_info[i].supported))
continue;
diff --git a/src/cg-darkroom.c b/src/cg-darkroom.c
index 8d7d7fd..06655e6 100644
--- a/src/cg-darkroom.c
+++ b/src/cg-darkroom.c
@@ -250,20 +250,20 @@ int start(void)
size_t i, j;
if (xflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_REMOVE;
else if (dflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_DEATH;
else
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_REMOVAL;
if (!xflag)
if ((r = make_slaves()) < 0)
return r;
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_updates[i].master) || !(crtc_info[i].supported))
continue;
diff --git a/src/cg-gamma.c b/src/cg-gamma.c
index d44b761..7a51ba0 100644
--- a/src/cg-gamma.c
+++ b/src/cg-gamma.c
@@ -460,13 +460,13 @@ int start(void)
size_t i, j;
if (xflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_REMOVE;
else if (dflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_DEATH;
else
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_REMOVAL;
if (!xflag && (names != NULL))
@@ -474,7 +474,7 @@ int start(void)
return cleanup(r);
if (names == NULL)
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_updates[i].master) || !(crtc_info[i].supported))
continue;
@@ -492,7 +492,7 @@ int start(void)
}
}
else
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_info[i].supported))
continue;
diff --git a/src/cg-limits.c b/src/cg-limits.c
index 3f057bd..2e342e9 100644
--- a/src/cg-limits.c
+++ b/src/cg-limits.c
@@ -633,13 +633,13 @@ int start(void)
size_t i, j, k;
if (xflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_REMOVE;
else if (dflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_DEATH;
else
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_REMOVAL;
if (!xflag && ((brightness_names != NULL) || (contrast_names != NULL)))
@@ -647,7 +647,7 @@ int start(void)
return cleanup(r);
if ((brightness_names == NULL) && (contrast_names == NULL))
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_updates[i].master) || !(crtc_info[i].supported))
continue;
@@ -671,7 +671,7 @@ int start(void)
char* empty = NULL;
char** bnames = brightness_names ? brightness_names : &empty;
char** cnames = contrast_names ? contrast_names : &empty;
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_info[i].supported))
continue;
diff --git a/src/cg-negative.c b/src/cg-negative.c
index 28b87ea..a16695a 100644
--- a/src/cg-negative.c
+++ b/src/cg-negative.c
@@ -190,20 +190,20 @@ int start(void)
size_t i, j;
if (xflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_REMOVE;
else if (dflag)
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_DEATH;
else
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_REMOVAL;
if (!xflag)
if ((r = make_slaves()) < 0)
return r;
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_updates[i].master) || !(crtc_info[i].supported))
continue;
diff --git a/src/cg-rainbow.c b/src/cg-rainbow.c
index 6ef606e..f6e6460 100644
--- a/src/cg-rainbow.c
+++ b/src/cg-rainbow.c
@@ -225,7 +225,7 @@ int start(void)
double pal[3];
double t, starttime;
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_DEATH;
if ((r = make_slaves()) < 0)
@@ -247,7 +247,7 @@ int start(void)
if (pal[1] > 1) pal[1] = 1;
if (pal[2] > 1) pal[2] = 1;
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_updates[i].master) || !(crtc_info[i].supported))
continue;
diff --git a/src/cg-sleepmode.c b/src/cg-sleepmode.c
index c4a41e6..dd6f3e5 100644
--- a/src/cg-sleepmode.c
+++ b/src/cg-sleepmode.c
@@ -294,7 +294,7 @@ int start(void)
fade_green = !isinf(greent) && !isnan(greent);
fade_blue = !isinf(bluet) && !isnan(bluet);
- for (i = 0; i < crtcs_n; i++)
+ for (i = 0; i < filters_n; i++)
crtc_updates[i].filter.lifespan = LIBCOOPGAMMA_UNTIL_DEATH;
if ((r = make_slaves()) < 0)
@@ -319,7 +319,7 @@ int start(void)
if (fade_blue)
{if (blue = 1 + t * bluet, blue > 1) blue = 1; else if (blue < 0) blue = 0;}
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_updates[i].master) || !(crtc_info[i].supported))
continue;
@@ -419,7 +419,7 @@ int start(void)
if (blue > 1) blue = 1; else if (blue < 0) blue = 0;
}
- for (i = 0, r = 1; i < crtcs_n; i++)
+ for (i = 0, r = 1; i < filters_n; i++)
{
if (!(crtc_updates[i].master) || !(crtc_info[i].supported))
continue;