On my Ubuntu Server 21.04 install with just X (no window manager installed), when I run the code with a "normal" window, everything works as expected - I move the mouse over the window, and then can use the keyboard. With fullscreen mode enabled, however, while I see the mouse, I can't seem to get back window focus for the keyboard.
On my Ubuntu Server 21.04 install with just X (no window manager installed), when I run the code with a "normal" window, everything works as expected - I move the mouse over the window, and then can use the keyboard. With fullscreen mode enabled, however, while I see the mouse, I can't seem to get back window focus for the keyboard.