2

I'm using Xlib to write my own platform library (genius plays, I know), but I can't get fullscreen to work on GNOME based DE. It works on I3 and Xfce but not on GNOME or Unity. Here is what I have so far.

XSizeHints* size_hints;
long hints = 0;

size_hints = XAllocSizeHints();

if (XGetWMSizeHints(_platform.display, _window.window, size_hints, &hints,
    XInternAtom(_platform.display, "WM_SIZE_HINTS", False)) == 0) {
    puts("Failed.");
} 

XLowerWindow(_platform.display, _window.window);
XUnmapWindow(_platform.display, _window.window);
XSync(_platform.display, False);

printf("%ld\n", hints);

XFree(size_hints);

Atom atoms[2] = { XInternAtom(_platform.display, "_NET_WM_STATE_FULLSCREEN", False), None };

XChangeProperty(
    _platform.display,
    _window.window,
    XInternAtom(_platform.display, "_NET_WM_STATE", False),
    XA_ATOM, 32, PropModeReplace, (unsigned char*)atoms, 1);

XMapWindow(_platform.display, _window.window);
XRaiseWindow(_platform.display, _window.window);

Minus all of the XGetWMSizeHints code, this code works fine on other WMs and DEs. According to other Stack Overflow questions, the way to get fullscreen working on GNOME is to either change some WM-NORMAL_HINT values or remove them entirely (How to open a non-decorated fullscreen window on Ubuntu and Fullscreen window without Gnome Panel).

In order to do either I have to use XGetWMSizeHints, but the function is failing. Do I need to create the property for the window first, then use this function? What values should I set in XSizeHints?

jww
  • 97,681
  • 90
  • 411
  • 885
CNJMC1
  • 479
  • 1
  • 5
  • 12
  • 1
    You will likely need to ask on a Gnome related list as it probably relates to the way Gnome Desktop controls the base Xwindow. You may get a response here, but that is a fairly narrow question related to the desktop itself. You may try `gnome-list@gnome.org` – David C. Rankin Mar 12 '19 at 01:28

1 Answers1

2

I've tried your solution in my environment, and it works.

What I noticed though is the return value from XGetWMSizehints is 0 on failure and nonzero on success, which means your example is incorrectly printing "Failed."