Fixed Dialogue positioning and focussing on Linux.

This fixes #220. In my testing it also fixes #642, so I've put it down as fixing that too. You might want to verify that yourself though Andrew, because I wasn't able to reproduce the problem quite as reliably as you were. I strongly suspect that this will also fix the longstanding #62 - perhaps we could get a KDE user to test and close that ticket too if it looks good?