title: In X11, how do I set the window title before creating it?
body: <p>Context:</p>
  
  <p>I use glfw under xmonad. Glfw apparently sets the window title <em>after</em> creating the window, thus not allowing xmonad to properly handle it. I want to modify the glfw source so that I can set the window title before creating the window.</p>
  
  <p>Problem:</p>
  
  <p>So I download glfw-2.6, and I look into lib/x11/x11_window.c ; the lines causing the trouble are:</p>
  
  <pre><code>// Create a window
  _glfwWin.Win = XCreateWindow(
      _glfwLibrary.Dpy,
      RootWindow( _glfwLibrary.Dpy, _glfwWin.VI-&gt;screen ),
      0, 0,                            // Upper left corner
      _glfwWin.Width, _glfwWin.Height, // Width, height
      0,                               // Borderwidth
      _glfwWin.VI-&gt;depth,              // Depth
      InputOutput,
      _glfwWin.VI-&gt;visual,
      CWBorderPixel | CWColormap | CWEventMask,
      &amp;wa
  );
  </code></pre>
  
  <p>Followed sometime later by:</p>
  
  <pre><code>_glfwPlatformSetWindowTitle( "GLFW Window" );
  </code></pre>
  
  <p>where</p>
  
  <pre><code>void _glfwPlatformSetWindowTitle( const char *title )
  {
      // Set window &amp; icon title
      XStoreName( _glfwLibrary.Dpy, _glfwWin.Win, title );
      XSetIconName( _glfwLibrary.Dpy, _glfwWin.Win, title );
  }
  </code></pre>
  
  <p>Now, if I tr yto move the glfwPlatformSetWindowTitle call before the CreateWindow call, I get a segfault -- as I should, since _glfwWin.win would not be defined.</p>
  
  <p>I don't know how to solve this problem since to set the window title, I need _glfwWin.Win to be initialized, but to initialize it, I need to create the window.</p>
  
  <p>Thus, I ask: in X11, what is the proper way to set the window title before creating the window?</p>
  
  <p>Thanks!</p>