X11 window resizing stutters
<p>I'm creating an openGL window in X11 and using <code>glxswapbuffers</code> for double buffering.</p>

<p>The problem is: rendering seems fine but I get openGL contents bouncing around and the window border stuttering when resizing.</p>

<p>I tried filtering the ConfigureNotify events, delaying them, setting vsync off with <code>glXSwapInterval</code>... nothing worked.</p>

<p>This is the code I'm using</p>

<pre><code>void Window::redraw() { // Called by any control which needs redrawing
  XEvent event;
  memset(&amp;event, 0, sizeof(event));
  event.type = Expose;
  event.xexpose.display = display;
  XSendEvent(display, window, False, ExposureMask, &amp;event);
}

void Window::resize(int width, int height) {
  this-&gt;Width = width;
  this-&gt;Height = height;
}

bool Window::wndProc(XEvent *evt) {
  switch (evt-&gt;type) {

      case Expose: {

        if (evt-&gt;xexpose.count == 0) { // handle last one only

          while (XCheckTypedWindowEvent(display, window, Expose, evt));

            if (Width != oldWidth || Height != oldHeight)
              resizeViewportAndUpdateDimensions();

          Renderer.drawGLStuff();

          this-&gt;redraw();
        }

        return true;

      } break;

      case ConfigureNotify: {
        this-&gt;resize(evt-&gt;xconfigure.width, evt-&gt;xconfigure.height);

        this-&gt;redraw();
        return true;
      } break;
  }
}
</code></pre>

<p>Notice that this is a different issue (strictly linked to resizing) than <a href="https://stackoverflow.com/q/36365528/3834459">this previous post</a> which I solved via <code>XCheckTypedWindowEvent</code>.</p>