How to maximize (not fullscreen)?



I want to maximize my window, but not fullscreen it. That is, I don’t want to cover the taskbar. I cannot find a way to do this with just JUCE. I am currently using this hack:

namespace xlib {
  extern "C" {
    #include <X11/Xlib.h>
    #include <X11/Xatom.h>

    void maximizeWindow(Window win) {
      auto display = XOpenDisplay(NULL);

      XEvent ev;
      ev.xclient.window = win;
      ev.xclient.type = ClientMessage;
      ev.xclient.format = 32;
      ev.xclient.message_type = XInternAtom(display, "_NET_WM_STATE", False);[0] = 1;[1] = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);[2] = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", False);[3] = 1;

      XSendEvent(display, DefaultRootWindow(display), False, SubstructureRedirectMask | SubstructureNotifyMask, &ev);



Which works.