read_xid.c 559 B

12345678910111213141516171819202122232425262728
  1. #include <grass/glocale.h>
  2. #include "cairodriver.h"
  3. void cairo_read_xid(void)
  4. {
  5. #if CAIRO_HAS_XLIB_XRENDER_SURFACE
  6. FILE *fp;
  7. char buf[64];
  8. unsigned long xid;
  9. fp = fopen(ca.file_name, "r");
  10. if (!fp)
  11. G_fatal_error(_("Unable to open input file <%s>"), ca.file_name);
  12. if (!fgets(buf, sizeof(buf), fp))
  13. G_fatal_error(_("Unable to read input file <%s>"), ca.file_name);
  14. if (sscanf(buf, "%lx", &xid) != 1)
  15. G_fatal_error(_("Unable to parse input file <%s>"), ca.file_name);
  16. fclose(fp);
  17. ca.win = (Drawable) xid;
  18. #endif
  19. }