Sorry, I should be more specific. The distro is Mandrake 9.1, but I think I have worked out the problem. It has something to do with the autologin feature, you know how you can have it set up to boot you into KDE or whatever, without entering a password. I logged out and switched to a different windows manager, and everything worked fine. Switched back to KDE and that worked too.
Basically all I needed to do was to turn off the autologin. Fascinating eh?