Fix screen flashing problem with redshift

As an alternative to flux I use redshift on my Linux machine. Recently I stumbled upon very weird problem – each time I close Java desktop app and redshift was active, the screen flashed. It was a very quick change that looked like redshift was disabled and then enabled again.
I was starting redshift like this:
redshift-gtk -l manual -l 51.126:17.033
After trying out few configuration options it turns out that changing video method to vidmode was the right solution for my problem:
redshift-gtk -l manual -l 51.126:17.033 -m vidmode
Now I can develop desktop Java apps without any screen flashing.