Esempio n. 1
0
async_load_state *
load_image_async_simple (async_load_state *state,
                         Screen *screen,
                         Window window,
                         Drawable drawable, 
                         char **filename_ret,
                         XRectangle *geometry_ret)
{
  if (state && state->done_p)		/* done! */
    {
      if (filename_ret)
        *filename_ret = state->filename;
      else if (state->filename)
        free (state->filename);

      if (geometry_ret)
        *geometry_ret = state->geom;

      free (state);
      return 0;
    }
  else if (! state)			/* first time */
    {
      state = (async_load_state *) calloc (1, sizeof(*state));
      state->done_p = False;
      print_loading_msg (screen, window);
      load_image_async (screen, window, drawable, 
                        load_image_async_simple_cb,
                        state);
      return state;
    }
  else					/* still waiting */
    return state;
}
Esempio n. 2
0
/* Queues a single image for loading.  Only load one at a time.
   The image is done loading when st->img_loader is null and
   it->loaded_image is a pixmap.
 */
static void
analogtv_load_random_image(struct state *st)
{
  int width=ANALOGTV_PIC_LEN;
  int height=width*3/4;
  Pixmap p;

  if (st->image_loading_p)  /* a load is already in progress */
    return;

  st->image_loading_p = True;
  p = XCreatePixmap(st->dpy, st->window, width, height, st->tv->visdepth);
  hack_resources(st->dpy);
  load_image_async (st->tv->xgwa.screen, st->window, p, image_loaded_cb, st);
}