Jump to content
Double Fine Action Forums
Sign in to follow this  
nuclear

Linux fullscreen bug

Recommended Posts

Hello,

I wanted to report a bug for Cave on GNU/Linux. It won't go properly fullscreen, because it doesn't tell the window manager that it wants to become fullscreen. Rather it resizes the window to the size of the display, but the window decorations are left visible.

In order to do this properly, you'd have to follow the EWMH (Extended Window Manager Hints) protocol, to notify the window manager that you wish to go fullscreen without decorations.

Feel free to use the code I wrote for the freeglut project a few years ago to achieve that:


#define _NET_WM_STATE_TOGGLE    2

static int fghEwmhFullscrToggle(void)

{

   XEvent xev;

   long evmask = SubstructureRedirectMask | SubstructureNotifyMask;



   xev.type = ClientMessage;

   xev.xclient.window = fgStructure.CurrentWindow->Window.Handle; /* our window */

   xev.xclient.message_type = fgDisplay.pDisplay.State;  /* <--- the _NET_WM_STATE Atom */

   xev.xclient.format = 32;

   xev.xclient.data.l[0] = _NET_WM_STATE_TOGGLE;

   xev.xclient.data.l[1] = fgDisplay.pDisplay.StateFullScreen; /* 1 for fullscreen, 0 for back to normal */

   xev.xclient.data.l[2] = 0;    /* no second property to toggle */

   xev.xclient.data.l[3] = 1;    /* source indication: application */

   xev.xclient.data.l[4] = 0;    /* unused */



   /* send the event to the root window */

   if(!XSendEvent(fgDisplay.pDisplay.Display, fgDisplay.pDisplay.RootWindow, 0, evmask, &xev;)) {

       return -1;

   }

   return 0;

}

Share this post


Link to post
Share on other sites
Sign in to follow this  

×
×
  • Create New...