summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/trailfocus2.c
diff options
context:
space:
mode:
authorkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-17 20:00:20 +0000
committerkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-17 20:00:20 +0000
commit6852a962f0745f2f4feb964c5a6c14d1349f5f46 (patch)
treec3589a92007af9cfbc88a62d9348ac1f84ab62d3 /beryl-plugins/src/trailfocus2.c
parentcda5d80a7de4f166cdd6d872b7c1d5ed2ef2180a (diff)
downloadmarex-dev-6852a962f0745f2f4feb964c5a6c14d1349f5f46.tar.gz
marex-dev-6852a962f0745f2f4feb964c5a6c14d1349f5f46.tar.bz2
trailfocus2:
Fix up range-support and set default saturation/brightness to 100%. git-svn-id: file:///beryl/trunk@2791 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/trailfocus2.c')
-rw-r--r--beryl-plugins/src/trailfocus2.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/beryl-plugins/src/trailfocus2.c b/beryl-plugins/src/trailfocus2.c
index 946abda..e0d0503 100644
--- a/beryl-plugins/src/trailfocus2.c
+++ b/beryl-plugins/src/trailfocus2.c
@@ -314,11 +314,11 @@ static void recalculate_attributes(TrailfocusScreen * ts)
TfAttrib tmp, min, max;
int i;
int start;
- start = ts->opt[SOPT_WINDOWS_START].value.i;
+ start = ts->opt[SOPT_WINDOWS_START].value.i - 1;
ts->win_max = ts->opt[SOPT_WINDOWS].value.i;
- if (start > ts->win_max+1) {
+ if (start >= ts->win_max) {
fprintf(stderr, "trailfocus: WARNING: Attempting to define start higher than max windows.\n");
- start = ts->win_max;
+ start = ts->win_max-1;
}
min.opacity = ts->opt[SOPT_MIN_OPACITY].value.i * OPAQUE / 100;
@@ -327,19 +327,21 @@ static void recalculate_attributes(TrailfocusScreen * ts)
max.opacity = ts->opt[SOPT_MAX_OPACITY].value.i * OPAQUE / 100;
max.brightness = ts->opt[SOPT_MAX_BRIGHTNESS].value.i * OPAQUE / 100;
max.saturation = ts->opt[SOPT_MAX_SATURATION].value.i * OPAQUE / 100;
- ts->win = realloc(ts->win, sizeof(Window) * (ts->win_max + 2));
- ts->inc = realloc(ts->inc, sizeof(TfAttrib) * (ts->win_max + 2));
- tmp.opacity = (max.opacity - min.opacity) / ((ts->win_max - start) + 1);
- tmp.brightness = (max.brightness - min.brightness) / ((ts->win_max - start) +1);
- tmp.saturation = (max.saturation - min.saturation) / ((ts->win_max - start) +1);
- for (i = 0; i < start-1; i++ )
+
+ ts->win = realloc(ts->win, sizeof(Window) * (ts->win_max + 1));
+ ts->inc = realloc(ts->inc, sizeof(TfAttrib) * (ts->win_max + 1));
+
+ tmp.opacity = (max.opacity - min.opacity) / ((ts->win_max - start));
+ tmp.brightness = (max.brightness - min.brightness) / ((ts->win_max - start));
+ tmp.saturation = (max.saturation - min.saturation) / ((ts->win_max - start));
+ for (i = 0; i < start; ++i)
ts->inc[i] = max;
for (i = 0; i+start <= ts->win_max; i++)
{
- ts->inc[i+start].opacity = max.opacity - (tmp.opacity * (i+1));
- ts->inc[i+start].brightness = max.brightness - (tmp.brightness * (1+i));
- ts->inc[i+start].saturation = max.saturation - (tmp.saturation * (1+i));
+ ts->inc[i+start].opacity = max.opacity - (tmp.opacity * i);
+ ts->inc[i+start].brightness = max.brightness - (tmp.brightness * i);
+ ts->inc[i+start].saturation = max.saturation - (tmp.saturation * i);
ts->win[i+start] = 0;
}
// ts->inc[i+start] = min;
@@ -486,7 +488,7 @@ static void trailfocusScreenInitOptions(TrailfocusScreen * ts)
"will get brightness levels between the focused "
"and min. ");
o->type = CompOptionTypeInt;
- o->value.i = 90;
+ o->value.i = 100;
o->rest.i.min = 1;
o->rest.i.max = 100;
o->advanced = False;
@@ -501,7 +503,7 @@ static void trailfocusScreenInitOptions(TrailfocusScreen * ts)
"will get saturation levels between the focused "
"and min. ");
o->type = CompOptionTypeInt;
- o->value.i = 90;
+ o->value.i = 100;
o->rest.i.min = 1;
o->rest.i.max = 100;
o->advanced = False;