Personally I would check collisions based on where the ball will be next cycle and therefore you don't need to worry about things getting stuck in walls.
ie.. check the collision for x+xs before you actually move the ball... if there's no collision then do x=x+xs otherwise xs=-xs and don't move the ball, or move the ball enough so it's against the wall, this way you won't ever get the stuck in the wall syndrome.
Of course dealing with x and y at the same time becomes marginally more complex as if you reduce the amount you're going to move the x, you need to proportionally decrease the ys before you check the Y collision.
ie.
XS = 5
X+XS = Collision
Wall = X+3
Therefore move ball X=X+3 = 3/5ths Of the movement, therefore the ball needs to be checked for Y collision ( 3/5 of YS ) + Y. Otherwise the ball will be changing direction slightly.
Of course.. If you don't do the positioning of the ball against the wall for a collision you'll never have to worry about that.
ie.. check the collision for x+xs before you actually move the ball... if there's no collision then do x=x+xs otherwise xs=-xs and don't move the ball, or move the ball enough so it's against the wall, this way you won't ever get the stuck in the wall syndrome.
Of course dealing with x and y at the same time becomes marginally more complex as if you reduce the amount you're going to move the x, you need to proportionally decrease the ys before you check the Y collision.
ie.
XS = 5
X+XS = Collision
Wall = X+3
Therefore move ball X=X+3 = 3/5ths Of the movement, therefore the ball needs to be checked for Y collision ( 3/5 of YS ) + Y. Otherwise the ball will be changing direction slightly.
Of course.. If you don't do the positioning of the ball against the wall for a collision you'll never have to worry about that.