You may need to restart your display manager to fix your problem.
11.04 and earlier.
sudo service gdm restart
Ubuntu 11.10 and newer.
sudo service lightdm restart
gdm in Ubuntu 11.10
Ubuntu 15.04 and newer.
sudo service sddm restart
While restarting lightdm restarts the entire display manager, you may be able to resolve the issue by restarting unity or compiz (Unity is a compiz plugin).
Restarting Unity (
nohup setsid unity OR
nohup unity --restart on the CLI OR Alt+F2 and type
unity) restarts the Unity shell.
If that doesn't work, restart compiz with
nohup compiz --replace. You may need to restart unity again after restarting compiz.
Restarting lightdm restarts the entire display manager which is most likely to work but it will also close your running applications. Which you need to do depends on how broken your session is. If you can just restart Unity or Compiz, do that. If that doesn't work, restart lightdm.
The following wiki article has additional information about fixing LightDM issues: