1

I'm working on a game built with SDL 1.2 which uses exclusive full screen mode on Linux. This means it grabs all input from the window manager, so Alt-F4 and Alt-Tab have to be implemented inside the game itself.

Alt-F4 is easy. For Alt-Tab, I want to change the game from full screen to windowed mode, so the user can access the rest of the desktop. The proper way to do this in SDL involves destroying a bunch of OpenGL stuff and rebuilding it, which is infeasible in the current codebase, and would also take long (think 10 seconds).

However, I've noticed that if the game opens a web URL with xdg-open, the window manager, at least in Ubuntu 15.04, automatically makes the game a window (so as to be able to display the newly opened browser to the user), and manages to do this quickly and without errors.

Is there any way to coerce the window manager to do this from the game (on a keypress), without opening another window/application?

Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
  • If your window manager is EWMH-compliant, you should be able to send a `_NET_WM_STATE` client message to the root window, requesting the `_NET_WM_STATE_FULLSCREEN` state to be toggled or removed. See http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472615568 for more information. – Frédéric Hamidi Dec 15 '15 at 11:06

0 Answers0