X11 Full Screen Window (OpenGL)

I am writing an OpenGL application on Linux (Ubuntu 11.10) using Xlib (X11). What is the easiest way to switch between windowed and fullscreen modes?

+6
source share
2 answers

at the protocol level, see the _NET_WM_STATE property with an accompanying client message and a full-screen status flag. this is specified in the EWMH specification. for bonus points you can manually implement full-screen mode, if WM does not report support for an official hint, EWMH specifies a way to check what is supported. You can also grab the mouse pointer and / or if you do not want people to accidentally leave full screen mode.

or, to avoid learning about low-level chaos, just use SDL or GTK or Qt or something else, and they should all have a simple method call to switch full-screen mode.

+4
source

This implements an implementation of what Havoc P has proposed in order to save the following face:

void fullscreen(Display* dpy, Window win) { Atom atoms[2] = { XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False), None }; XChangeProperty( dpy, win, XInternAtom(dpy, "_NET_WM_STATE", False), XA_ATOM, 32, PropModeReplace, atoms, 1 ); } 
+8
source

Source: https://habr.com/ru/post/907330/


All Articles