While I updated ubuntu from 10.04 to 10.10 my keyboard stopped working. Then I saw that the window borders were missing. So it seemed that metacity crashed. But how can I restart metacity without a keyboard?
In your main menu click: System > Preferences > Appearance and change your Visual Effects from the current value to something else.
That worked for me. Metacity restarted and the keyboard resumed its work.