// Copyright status: this file is in the public domain. #include #include "lx.h" #include "proto.h" #include "internal.h" void lx_ChangeKeyboardMapping(LX_CONN *xc, int firstcode, int codes, int symspercode, const LX_KEYSYM *syms) { unsigned char *req; int i; if ( (xc->flags & XCF_FAIL) || (firstcode < 0) || (firstcode > 255) || (codes < 0) || (codes > 255) || (symspercode < 0) || (symspercode > 255) ) { lx__bad_call(xc,"lx_ChangeKeyboardMapping"); return; } lx__nochain(xc); req = malloc(8+(4*codes*symspercode)); if (! req) { lx__nomem_fail(xc); return; } req[0] = XP_REQ_ChangeKeyboardMapping; req[1] = codes; w_card16(&req[2],2+(codes*symspercode)); req[4] = firstcode; req[5] = symspercode; req[6] = 0; // unused req[7] = 0; // unused for (i=(codes*symspercode)-1;i>=0;i--) w_card32(req+8+(4*i),syms[i]); lx__send_req_free(xc,&req[0],8+(4*codes*symspercode)); }