// Copyright status: this file is in the public domain. #include #include "lx.h" #include "internal.h" LX_XIDLIST *lx_screen_visuals(LX_CONN *xc, int s, int d) { SCREENDEPTH *sd; LX_XIDLIST *xl; int i; if ((xc->flags & XCF_FAIL) || (s < 0) || (s >= xc->nscreens) || (d < 0) || (d >= xc->screens[s].ndepths)) return(0); sd = &xc->screens[s].depths[d]; xl = malloc(sizeof(LX_XIDLIST)); if (! xl) return(0); xl->len = sd->nvisuals; xl->ids = malloc(xl->len*sizeof(LX_XID)); if (! xl->ids) { free(xl); return(0); } for (i=sd->nvisuals-1;i>=0;i--) xl->ids[i] = sd->visuals[i].id; return(xl); }