Logo Search packages:      
Sourcecode: wayland-demos version File versions  Download package

static void eventdemo_draw ( struct eventdemo e ) [static]

Redraws the window.

Draws a red rectangle as demonstration of per-window data.

Definition at line 97 of file eventdemo.c.

References log_redraw.

Referenced by eventdemo_create(), and redraw_handler().

                                    {
      if (log_redraw)
            printf("redraw\n");

      cairo_surface_t *surface;
      cairo_t *cr;
      struct rectangle rect;

      window_draw(e->window);
      window_get_child_allocation(e->window, &rect);
      surface = window_get_surface(e->window);

      cr = cairo_create(surface);
      cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);

      cairo_rectangle(cr, rect.x, rect.y, rect.width, rect.height);
      cairo_set_source_rgba(cr, 0, 0, 0, 0.8);
      cairo_fill(cr);

      cairo_rectangle(cr, e->x, e->y, e->w, e->h);
      cairo_set_source_rgba(cr, 1.0, 0, 0, 1);
      cairo_fill(cr);

      cairo_destroy(cr);
      cairo_surface_destroy(surface);
      window_flush(e->window);
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index