Depends on which application has the 'focus'. I prefer 'focus follows mouse', so whatever window my mouse is over, is where my keyboard presses are going to register. Other modes are 'click to focus' and some variations on 'focus under mouse'. Microsoft Windows is "Click to Focus" (as an example), although if you play with some of the tweakui tools, you can obtain 'focus follows mouse' if you desire.
I'm not sure what mode your X-windows desktop is in initially, I THINK it's usually 'click to focus' by default, you'd have to check yours, my setup for mouse focus is under 'window behavior' in system settings, KDE 4.7.4)
I'll admit I don't have much experience with Electric Sheep (dreaming screensaver, right?) and XMBC (media center, IIRC). Both of those seem like they'd want to be full-screen apps, which could present problems because of the loss of focus. Almost sounds like a problem with ES, since if it's in the foreground (having taken over as a screensaver...) it SHOULD capture any keystrokes and use that as an abort signal to quit, returning your screen to anything else running.
You might try ALT-TAB to flip between the various apps you've got running, which should rotate focus between them, it sort of depends on how XMBC & ES are being used, whether windowed or full-screen.
You CAN control focus command-line-wise using several programs, of course, I've gone blank... looking through my /bin directories and my notes to find them. I wrote my own control programs a few months ago for a project, seeing what I could do programmatically to control windows and focus...
ah, here's one:
wmctrl, man page says you can raise a window using the '-R' option...
There's another that I found more useful, although I'm totally at a loss to name it today, maybe someone will know what I'm hinting at and post it. I'll keep looking though, evidently my blonde is kicking in hard today.