title: How to draw an image from file on window with Xlib
body: <p>This is my code:</p>
  
  <pre><code>int main()
  {
      Display *d = XOpenDisplay(0);
      unsigned int bitmap_width, bitmap_height;
      int x, y;
      Pixmap bitmap;
  
      if ( d )
      {
          Window w = XCreateWindow(d, DefaultRootWindow(d), 0, 0, 400,
                     400, 0, CopyFromParent, CopyFromParent,CopyFromParent, 0, 0);
          GC gc = XCreateGC ( d, w, 0 , NULL );
  
          int rc = XReadBitmapFile(d, w,
               "1.bmp",
               &amp;bitmap_width, &amp;bitmap_height,
               &amp;bitmap,
               &amp;x, &amp;y);
  
          XCopyPlane(d, bitmap, w, gc,0, 0, bitmap_width, bitmap_height,0, 0, 1);
          XMapWindow(d, w);
          XFlush(d);
          sleep(10);
      }
      return 0;
  }
  </code></pre>
  
  <p>But window is clear. I do not understand why it is not working. Where did I make mistake?</p>