Why is java application running smoother when moving mouse over it?

I’m working with tutorial from this topic - “Fixed timestep” section. After run this code, the ball has kind of lag, but there is still 60 FPS. After I move mouse over application’s window and move it in random directions, the ball is moving smoothly. It happens even if window application isn’t focused! What’s wrong? Can it be fixed?

I’m using Ubuntu 13.04 with Oracle JDK7

I’ve found that it happens with every application.

Here’s video

J8SBjKncgRw

Do you have any example or code? That is fairly wild for me :slight_smile:

Whether a window has focus does not affect whether it receives mouse move events or not, so it would not change the effect whether your window had focus or not. Are you using the example in the first post? One problem I notice with it is that it uses outdated an interpolation value because repaint does not trigger painting immediately. Interpolation time should be calculated when the screen is painted, not later. I do not know if that is a problem in practice.

What type of “lag” is it?

If what you said is true, then it’s related to OS not Java. OS has duty to split processing cycling duty for each application. On some HW acceleration enabled program like game, putting them to background will decrease their share. I forget what this is called for.

I posted link in first topic

[quote]If what you said is true, then it’s related to OS not Java. OS has duty to split processing cycling duty for each application. On some HW acceleration enabled program like game, putting them to background will decrease their share. I forget what this is called for.
[/quote]
I think you can be right, that’s why I gave you information about my OS.

I record this video. Now it should be clear

J8SBjKncgRw