title: GTK3 and cairo too slow
body: <p>I've made a very simple animation with GTK3 and cairo and it's too slow for this simple graphics. I don't understand why it's so slow. I tried to use <em>gtk_widget_queue_draw_area</em>, but result is the same, nothing changes.
  Who can explain me, why it's so slow and how can i fix it?</p>
  
  <p>Here's the program:</p>
  
  <pre><code>#include &lt;gtk/gtk.h&gt;
  #include &lt;cairo.h&gt;
  
  void draw(GtkWidget* widget, cairo_t* cr)
  {
      static int width, height,
                 posX = 0,
                 vX = 1;
  
      GtkWidget* window = gtk_widget_get_toplevel(widget);
      gtk_window_get_size(GTK_WINDOW(window), &amp;width, &amp;height);
  
      cairo_set_source_rgb(cr, 0, 0, 0);
      cairo_set_line_width(cr, 1);
  
      cairo_rectangle(cr, posX, height/2, 1, 1);
      cairo_stroke(cr);
  
      if(posX + vX &gt;= width || posX + vX == 0)
          vX = -vX;
      posX += vX;
  
      gtk_widget_queue_draw(window);
  }
  
  int main(int argc, char** argv)
  {
      GtkWidget* window;
      GtkWidget* darea;
  
      gtk_init(&amp;argc, &amp;argv);
  
      window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
      darea = gtk_drawing_area_new();
  
      gtk_container_add(GTK_CONTAINER(window), darea);
  
      gtk_window_set_default_size(GTK_WINDOW(window), 500, 400);
  
      g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
      g_signal_connect(G_OBJECT(darea), "draw", G_CALLBACK(draw), NULL);
  
      gtk_widget_show_all(window);
      gtk_main();
  }
  </code></pre>