Fullscreen window in X loses keyboard focus

Hi!

I’m running Panda3d on a Raspberry Pi (following some really great instructions from a forum post about how to compile it!), using Ubuntu Server 21.04 with just a minimal X-windows installation. Specifically, I’m hoping to avoid using a window manager. I find that when I run my app normally, everything works great (woohoo!). But if I set it to be fullscreen, then it loads fine, but I lose the ability to control it with the keyboard. I’ve tried both starting the app from within an xterm or having it be the program that is listed in my .xinitrc to start when X starts. Any thoughts?

thanks!
Caleb

As a quick update, I verified that the same phenomenon happens when I run it locally using Xephyr.

As a further update, by running the “infinite_tunnel” demo, I discovered that the keyboard events are being detected, it’s just that the main loop is apparently not starting.

If I use a minimal window manager (i.e., icewm), then everything works.

So to reiterate - there’s something strange about fullscreen=True that for some reason causes the run loop to stall.

Reproducing issue:

Run:

Xephyr :1 -ac -screen 1024x768x16 &
DISPLAY=:1 xterm &

From within that xterm, run:

/usr/bin/python3 infinite_tunnel/main.py

Verify infinite tunnel appears and updates as expected.

To the top of main.py, add:

from panda3d.core import loadPrcFileData
loadPrcFileData("", "fullscreen true")

Run again. Note that tunnel stops updating.

As a workaround, it seems like I can just set the window size (loadPrcFileData("", "win-size 1024 768")) to be the same size as the screen and things work fine.

I can reproduce an inability to switch to full screen when no window manager is active, I think this should fix it:

This issue report discusses the more general case of this problem:

I can confirm that the version with this commit works well for me.

Though now I have a new question: when I ask for a fullscreen window, I get a new/different resolution and framerate than X chose initially. Any idea why this is?

Thanks!

Panda will switch to a resolution based on what you set in win-size.

If you don’t want Panda to switch resolution, ask for a window size of base.pipe.getDisplayWidth() / Height() as window width/height.

Awesome. Thanks!