Panda Fullscreen Losing Focus

I develop/maintain an application where data is polled from the internet and displayed/updated using Panda. This application runs fullscreen on a dedicated Windows 7 box. An issue I see is that sometimes other background applications will steal focus from the Panda window, causing Panda to minimize. Then, if I click on the Panda tab to bring it back into focus it has turned into an undecorated (non fullscreen) window.

I found this post ( related to this issue but it was from 2006 and I was wondering if there was maybe a Python/config file solution to this issue at this point? I’d like to prevent Panda from being so sensitive to losing focus or disabling it entirely. If I’m not mistaken, I’m looking for an “Always on Top” settings, which some applications (widgets, etc.) implement.

edit: I’m not worried about preventing alt+tab or ctrl+alt+del keyboard interrupts.

Hmm, there’s not such an option; I don’t even think the OS will allow us to prevent the fullscreen window from losing focus. Still, the fact that it comes back wrong after losing focus sounds like a bug (it sounds like it’s failing to restore the fullscreen desktop properties).

One possible workaround would be to create an undecorated window the same size as the desktop, rather than creating a fullscreen window. This should at least work around the bug, and it may also be better behaved when another application steals focus. Only downside is you have to know ahead of time what the desktop resolution is, and you’re forced to use that resolution in your Panda app (and you may have to pay a rendering hit for having a high resolution window).


I had a similar problem with Java application, but it was worse because whenever the OS let something else steal focus, my app would not just become non-full-screen, it would be minimized. The issue turned out to be pretty critical because, for one thing, there’s always some notification window or other little thing that grabs focus briefly during boot. So the effect was that you’d turn the system on, the app would launch and then immediately disappear.

The unpleasant solution I arrived at involved running a second app in the background which constantly checks the state of the main app’s window and maximizes it again if it ever detects it being minimized. ugh. let me know if you need it, I can try and track down what that app was.

Where possible I’ve been using linux for installs, which is a little easier to customize for this kind of thing. since panda’s cross-platform support is very good, you might look at that to see if it’ll be usable for your app.

As it happens I need to look at this more closely for one of my own projects, so here’s a little more info on how to do this in linux if that’s helpful.

First, in general you can just not run other processes like updaters and the like, so you won’t have things popping up in front of your window anyway. However, if you want to be super certain about it, you can set the “always above” property on your panda window so the window manager won’t allow anything to get in front of it.

I used the utility wmctrl, which you can get in Debian/Ubuntu just by doing

sudo apt-get install wmctrl

there’s a lot of nifty things you can do with it.

List windows:

wmctrl -l

Raise and activate a window by name:

wmctrl -a "Panda"

Turn on the “Always Above” option

wmctrl -r "MyPandaApplication" -b add,above

Also force fullscreen, if you didn’t do it from Panda

wmctrl -r "MyPandaApplication" -b add,above,fullscreen

wmctrl works using the window title, so set it in Panda:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData('', 'fullscreen 1')
loadPrcFileData('','window-title MyPandaApplication')

One way to tie it all together is using a shell script. Here’s one I called “”:


# launch the panda app; keep control on command line
python &

# wait a little bit for window to appear
sleep 1

# set keep-above and fullscreen
wmctrl -r "MyPandaApplication" -b add,above,fullscreen

# raise and activate, just in case
wmctrl -a "MyPandaApplication"

# demonstration to show that it works - wait 3 seconds and then launch web browser.  it should not come up in front.
sleep 3
firefox &

@benchang thanks so much for this. This seems to be a pretty decent solution. I’ll look at testing under Linux . Thanks again.