#include #include "lx.h" #include "proto.h" #include "internal.h" typedef struct priv_GetWindowAttributes PRIV_GetWindowAttributes; struct priv_GetWindowAttributes { LX_WINDOW_ATTRIBTUES *attrs; } ; static void done_GetWindowAttributes(LX_OP *op, const unsigned char *rep) { PRIV_GetWindowAttributes *p; LX_WINDOW_ATTRIBUTES a; p = op->reqpriv; do <"ret"> { a.backing_store = lx__proto_to_backingstore(rep[1]); if (a.backing_store == LX__BACKINGSTORE_Error) { lx__protoerr(xc,"GetWindowAttributes returned invalid backing-store value %u",rep[1]); break <"ret">; } a.visual = r_card32(rep+8); a.class = lx__proto_to_wclass(r_card16(rep+12)); if (a.class == LX__WCLASS_Error) { lx__protoerr(xc,"GetWindowAttributes returned invalid class value %u",r_card16(rep+12)); break <"ret">; } a.bit_gravity = lx__proto_to_bitgravity(rep[14]); if (a.bit_gravity == LX__GRAVITY_Error) { lx__protoerr(xc,"GetWindowAttributes returned invalid bit-gravity value %u",rep[14]); break <"ret">; } a.win_gravity = lx__proto_to_wingravity(rep[15]); if (a.win_gravity == LX__GRAVITY_Error) { lx__protoerr(xc,"GetWindowAttributes returned invalid win-gravity value %u",rep[14]); break <"ret">; } a.backing_planes = r_card32(rep+16); a.backing_pixel = r_card32(rep+20); a.save_under = lx__proto_to_boolean(rep[24]); if (a.save_under < 0) { lx_protoerr(xc,"GetWindowAttributes returned invalid save-under value %u",rep[24]); break <"ret">; } a.cmap_installed = lx__proto_to_boolean(rep[25]); if (a.cmap_installed < 0) { lx_protoerr(xc,"GetWindowAttributes returned invalid map-is-installed value %u",rep[25]); break <"ret">; } a.map_state = lx__proto_to_mapstate(rep[26]); if (a.map_state == LX__MAPSTATE_Error) { lx_protoerr(xc,"GetWindowAttributes returned invalid map-state value %u",rep[26]); break <"ret">; } a.override_redirect = lx__proto_to_boolean(rep[27]); if (a.override_redirect < 0) { lx_protoerr(xc,"GetWindowAttributes returned invalid override-redirect value %u",rep[27]); break <"ret">; } a.colormap = r_card32(rep+28); if (a.colormap == 0) a.colormap = LX_COLORMAP_None; a.all_events = r_card32(rep+32); a.our_events = r_card32(rep+36); a.dont_propagate = r_card16(rep+40); if (p->attrs) *p->attrs = a; } while (0); op->reqpriv = 0; free(p); } LX_OP *lx_GetWindowAttributes(LX_CONN *xc, LX_XID window, LX_WINDOW_ATTTRIBUTES *attrs) { unsigned char req[8]; PRIV_GetWindowAttributes *p; if (xc->flags & XCF_FAIL) { lx__bad_call(xc,"lx_GetWindowAttributes"); return(0); } p = malloc(sizeof(PRIV_GetWindowAttributes)); if (! p) { lx__nomem_fail(xc); return(0); } p->attrs = attrs; req[0] = XP_REQ_GetWindowAttributes; req[1] = 0; w_card16(&req[2],2); w_card32(&req[4],window); return(lx__expect_reply(xc,&req[0],8,&done_GetWindowAttributes,p,0)); }