Fixed a minor API bug, and fixed a potential focusing error.

The API needs to be able to handle the user switching to an adjacent
desktop, but the previous version only supported setting the desktop
without getting the current one. That has been fixed.