Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Key table source excerpt
- KeySym CortronKeyMap[] = {
- XK_KP_Space, NoSymbol, NoSymbol, NoSymbol, // 00 // 11 80
- XK_Help, NoSymbol, NoSymbol, NoSymbol, // 71 81
- XK_Execute, NoSymbol, NoSymbol, NoSymbol, // 71 82
- // ...
- XK_Delete, NoSymbol, NoSymbol, NoSymbol, // 10 FF
- };
- #define Alt_Mask Mod3Mask
- CARD8 ctrnModmap[][2] = {
- {94, ShiftMask},
- {95, ShiftMask},
- {15, ControlMask},
- {10, Alt_Mask},
- {0, 0}
- };
- KeySymsRec ctrnKeySyms[] = { {CortronKeyMap, 0, 0x7f, 4} };
- // Code to program key table
- static CARD8 *ctrn_workingModMap = NULL;
- static KeySymsRec *ctrn_workingKeySyms = NULL;
- static Bool decinput_set_cortron_keymap_cb(ClientPtr client, pointer closure)
- {
- set_keymap_t *pc = closure;
- XkbApplyMappingChange(pc->dev, ctrn_workingKeySyms,
- ctrn_workingKeySyms->minKeyCode,
- ctrn_workingKeySyms->maxKeyCode - ctrn_workingKeySyms->minKeyCode + 1,
- ctrn_workingModMap, serverClient);
- free(pc);
- return TRUE;
- }
- static int decinput_set_cortron_keymap(InputInfoPtr pInfo)
- {
- int i;
- DeviceIntPtr dev = pInfo->dev;
- set_keymap_t *pc = calloc(1, sizeof(set_keymap_t));
- if (!pc) return !Success;
- if (!ctrn_workingKeySyms) {
- ctrn_workingKeySyms = &ctrnKeySyms[0];
- if (ctrn_workingKeySyms->minKeyCode < MIN_KEYCODE) {
- ctrn_workingKeySyms->minKeyCode += MIN_KEYCODE;
- ctrn_workingKeySyms->maxKeyCode += MIN_KEYCODE;
- }
- if (ctrn_workingKeySyms->maxKeyCode > MAX_KEYCODE)
- ctrn_workingKeySyms->maxKeyCode = MAX_KEYCODE;
- }
- if (!ctrn_workingModMap) {
- ctrn_workingModMap=(CARD8 *)malloc(MAP_LENGTH);
- if (!ctrn_workingModMap) {
- //ErrorF("ctrnKbdProc failed: could not alloc modmap \n");
- return (!Success);
- }
- (void) memset(ctrn_workingModMap, 0, MAP_LENGTH);
- for(i=0; ctrnModmap[i][0] != 0; i++) {
- ctrn_workingModMap[(ctrnModmap[i][0]) + MIN_KEYCODE] = ctrnModmap[i][1];
- }
- }
- pc->dev = dev;
- QueueWorkProc(decinput_set_cortron_keymap_cb, serverClient, pc);
- return Success;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement