kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=489c4c669d52fc871952b9106e3d36cef662a9d0

commit 489c4c669d52fc871952b9106e3d36cef662a9d0
Author: Kim Woelders <[email protected]>
Date:   Fri Oct 17 12:19:07 2014 +0200

    Set lower limit on slide/shade speed.
    
    Fixes crash if speed is set to 0.
---
 src/animation.h |  5 ++++-
 src/ewin-ops.c  |  4 ++++
 src/slide.c     | 10 +++++-----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/animation.h b/src/animation.h
index 24077b1..5f96eb4 100644
--- a/src/animation.h
+++ b/src/animation.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Daniel Manjarres
- * Copyright (C) 2012 Kim Woelders
+ * Copyright (C) 2012-2014 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -96,4 +96,7 @@ void                AnimatorsFree(EObj * eo);
 
 void               *AnimatorGetData(Animator * an);
 
+/* Misc. limits */
+#define SPEED_MIN       100
+
 #endif /* _ANIMATION_H_ */
diff --git a/src/ewin-ops.c b/src/ewin-ops.c
index 7c409bd..e8ed8b7 100644
--- a/src/ewin-ops.c
+++ b/src/ewin-ops.c
@@ -1049,6 +1049,8 @@ EwinShade(EWin * ewin)
    _EwinShadeStart(&esd);
    if ((Conf.shading.animate) || (ewin->type == EWIN_TYPE_MENU))
      {
+       if (Conf.shading.speed < SPEED_MIN)
+          Conf.shading.speed = SPEED_MIN;
        duration = 1000000 / Conf.shading.speed;
        an = AnimatorAdd(&ewin->o, ANIM_SHADE, _EwinShadeRun, duration, 0,
                         sizeof(esd), &esd);
@@ -1266,6 +1268,8 @@ EwinUnShade(EWin * ewin)
    _EwinUnshadeStart(&esd);
    if ((Conf.shading.animate) || (ewin->type == EWIN_TYPE_MENU))
      {
+       if (Conf.shading.speed < SPEED_MIN)
+          Conf.shading.speed = SPEED_MIN;
        duration = 1000000 / Conf.shading.speed;
        an = AnimatorAdd(&ewin->o, ANIM_SHADE, _EwinUnshadeRun, duration, 0,
                         sizeof(esd), &esd);
diff --git a/src/slide.c b/src/slide.c
index 974c8d6..b0495a1 100644
--- a/src/slide.c
+++ b/src/slide.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Kim Woelders
+ * Copyright (C) 2013-2014 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -68,8 +68,8 @@ EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty, 
int fw, int fh,
    p.tw = tw;
    p.th = th;
 
-   if (speed <= 10)
-      speed = 10;
+   if (speed < SPEED_MIN)
+      speed = SPEED_MIN;
    duration = 1000000 / speed;
 
    AnimatorAdd(eo, ANIM_SLIDE, _EobjSlideSizeTo, duration, 1, sizeof(p), &p);
@@ -166,8 +166,8 @@ EwinSlideSizeTo(EWin * ewin, int tx, int ty, int tw, int th,
    p.firstlast = 0;
    p.warp = warp;
 
-   if (speed <= 10)
-      speed = 10;
+   if (speed < SPEED_MIN)
+      speed = SPEED_MIN;
    duration = 1000000 / speed;
 
    an = AnimatorAdd((EObj *) ewin, ANIM_SLIDE, _EwinSlideSizeTo, duration, 0,

-- 


Reply via email to