Fixed some performance issues when using windows.

They caused the spectrum view to stuck while dragging with right mouse button