GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-7b73900583
read_xid.c
Go to the documentation of this file.
1 #include <grass/glocale.h>
2 
3 #include "cairodriver.h"
4 
5 void cairo_read_xid(void)
6 {
7 #if CAIRO_HAS_XLIB_XRENDER_SURFACE
8  FILE *fp;
9  char buf[64];
10  unsigned long xid;
11 
12  fp = fopen(ca.file_name, "r");
13  if (!fp)
14  G_fatal_error(_("Unable to open input file <%s>"), ca.file_name);
15 
16  if (!fgets(buf, sizeof(buf), fp))
17  G_fatal_error(_("Unable to read input file <%s>"), ca.file_name);
18 
19  if (sscanf(buf, "%lx", &xid) != 1)
20  G_fatal_error(_("Unable to parse input file <%s>"), ca.file_name);
21 
22  fclose(fp);
23 
24  ca.win = (Drawable)xid;
25 #endif
26 }
GRASS cairo display driver - header file.
struct cairo_state ca
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
#define _(str)
Definition: glocale.h:10
void cairo_read_xid(void)
Definition: read_xid.c:5
char * file_name
Definition: cairodriver.h:66