Set lower limit on slide/shade speed.
Fixes crash if speed is set to 0.
This commit is contained in:
parent
c08ff59b9c
commit
489c4c669d
|
@ -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_ */
|
||||
|
|
|
@ -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);
|
||||
|
|
10
src/slide.c
10
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,
|
||||
|
|
Loading…
Reference in New Issue