We’ve got our application running fullscreen on Windows, and it would be really helpful to us if it could be possible to grab and hold the application focus; I.E. disable alt-tab and prevent other windows from coming frontmost. Is there a command in Panda to enable this mode?
No, sorry. Note that Windows discourages you from doing this sort of thing in general (it’s considered rude to the user).
In general, I agree. It’s pretty rude to steal someone’s desktop UI!
The difficulty comes from a combination of design aspects. We’re planning to create a kiosk-style application, so we specifically don’t want users to be able to get to anything interesting while the game is running. Additionally, I’ve noticed a problem with Panda maintaining audio cohesion if it gets context-switched out-and-back; I’m not sure what causes it, but occasionally (seemingly more often under heavy processor usage) the audio will turn choppy and static-y on any music we are playing. We were hoping that simply stealing the whole UI for our own use could solve the problem, but if that doesn’t work we’ll have to come up with another solution.
Perhaps we could solve the audio problem by packing the audio system away nicely (stopping playing music, muting the sound engine, etc.) when Panda context-switched away. Is there a way for Panda to detect a context-switch?
Thank you for your swift reply on this issue; this forum is incredibly helpful to us!
Hmm. Panda’s supposed to auto-minimize itself when its fullscreen window gets context-switched out, and then it stops rendering. It also yields the timeslice more aggressively while it is minimized, which could lead to choppy audio, I suppose. (Though Windows itself will steal timeslices away from an application that has lost focus, whether it yields them or not, so audio may go choppy anyway, depending on how much background CPU you have left and how much you require for your audio.) There are hooks you can put in your application to detect context switch. In particular, you can listen for the events ‘PandaPaused’ and ‘PandaRestarted’; or, more generally, you could listen for ‘window-event’ and examine the window properties on each event notification; see ShowBase.__windowEvent() for an example.
It wouldn’t take much additional C++ code to intercept and eat Alt-TAB and Alt-F4 (any other keypresses?) at the low level. If you’re comfortable diving into the C++, you could probably hack that in to your personal version of Panda with very little effort.