// Copyright status: this file is in the public domain. #include #include #include #include #include #include typedef struct inputselected_priv INPUTSELECTED_PRIV; struct inputselected_priv { unsigned int *enb; } ; static void done_shape_InputSelected(LX_CONN *xc, const unsigned char *rep, void *pv) { INPUTSELECTED_PRIV *p; int v; p = pv; do <"ret"> { if (lx_xi_r_card32(rep+4) != 0) { lx_xi_protoerr(xc,"SHAPE QueryExtents response length wrong (%u, expecting 0)",lx_xi_r_card32(rep+4)); break <"ret">; } v = lx_xi_proto_to_boolean(rep[1]); if (v < 0) { lx_xi_protoerr(xc,"invalid enable %d in SHAPE InputSelected",rep[8]); break <"ret">; } if (p->enb) *p->enb = v; } while (0); free(p); } LX_OP *lx_shape_InputSelected(LX_CONN *xc, LX_XID win, int *enb) { LX_SHAPE_PRIV *p; INPUTSELECTED_PRIV *qp; unsigned char req[8]; if (lx_xi_conn_failed(xc)) { lx_xi_bad_call(xc,"ls_shape_GetRectangles"); return(0); } p = lx_get_private(xc,lx_shape__px); if (! p) { lx_xi_bad_call(xc,"lx_shape_InputSelected"); return(0); } qp = malloc(sizeof(INPUTSELECTED_PRIV)); if (! qp) { lx_xi_nomem_fail(xc); return(0); } qp->enb = enb; lx_xi_nochain(xc); req[0] = p->major; req[1] = SHAPE_InputSelected; lx_xi_w_card16(&req[2],2); lx_xi_w_card32(&req[4],win); return(lx_xi_expect_reply(xc,req,-1,&done_shape_InputSelected,qp)); }