// //////////////////////////////////////////////////////////////////////////// static bool pushedKeyCombo(KEY_CODE subkey) { KEY_CODE metakey=KEY_IGNORE; KEY_MAPPING *pExist; KEY_MAPPING *psMapping; KEY_CODE alt; // check for // alt alt = (KEY_CODE)0; if( keyDown(KEY_RALT) || keyDown(KEY_LALT) ) { metakey= KEY_LALT; alt = KEY_RALT; } // ctrl else if( keyDown(KEY_RCTRL) || keyDown(KEY_LCTRL) ) { metakey = KEY_LCTRL; alt = KEY_RCTRL; } // shift else if( keyDown(KEY_RSHIFT) || keyDown(KEY_LSHIFT) ) { metakey = KEY_LSHIFT; alt = KEY_RSHIFT; } // meta (cmd) else if( keyDown(KEY_RMETA) || keyDown(KEY_LMETA) ) { metakey = KEY_LMETA; alt = KEY_RMETA; } // check if bound to a fixed combo. pExist = keyFindMapping( metakey, subkey ); if(pExist && (pExist->status == KEYMAP_ALWAYS || pExist->status == KEYMAP_ALWAYS_PROCESS)) { selectedKeyMap = NULL; // unhighlght selected. return false; } /* Clear down mappings using these keys... But only if it isn't unassigned */ keyReAssignMapping( metakey, subkey, KEY_IGNORE, (KEY_CODE)KEY_MAXSCAN ); /* Try and see if its there already - damn well should be! */ psMapping = keyGetMappingFromFunction((void*)selectedKeyMap->function); /* Cough if it's not there */ ASSERT( psMapping!=NULL,"Trying to patch a non-existant function mapping - whoop whoop!!!" ); /* Now alter it to the new values */ psMapping->metaKeyCode = metakey; psMapping->subKeyCode = subkey; // was "==" psMapping->status = KEYMAP_ASSIGNABLE; //must be if(alt) { psMapping->altMetaKeyCode = alt; } selectedKeyMap = NULL; // unhighlght selected . return true; }
// //////////////////////////////////////////////////////////////////////////// static bool pushedKeyCombo(KEY_CODE subkey) { KEY_CODE metakey=KEY_IGNORE; KEY_MAPPING *pExist; KEY_MAPPING *psMapping; KEY_CODE alt; // void (*function)(void); // KEY_ACTION action; // KEY_STATUS status; // char name[255]; // check for // alt alt = (KEY_CODE)0; if( keyDown(KEY_RALT) || keyDown(KEY_LALT) ) { metakey= KEY_LALT; alt = KEY_RALT; } // ctrl else if( keyDown(KEY_RCTRL) || keyDown(KEY_LCTRL) ) { metakey = KEY_LCTRL; alt = KEY_RCTRL; } // shift else if( keyDown(KEY_RSHIFT) || keyDown(KEY_LSHIFT) ) { metakey = KEY_LSHIFT; alt = KEY_RSHIFT; } // meta (cmd) else if( keyDown(KEY_RMETA) || keyDown(KEY_LMETA) ) { metakey = KEY_LMETA; alt = KEY_RMETA; } // check if bound to a fixed combo. pExist = keyFindMapping( metakey, subkey ); if(pExist && (pExist->status == KEYMAP_ALWAYS || pExist->status == KEYMAP_ALWAYS_PROCESS)) { selectedKeyMap = NULL; // unhighlght selected. return false; } /* Clear down mappings using these keys... But only if it isn't unassigned */ keyReAssignMapping( metakey, subkey, KEY_IGNORE, (KEY_CODE)KEY_MAXSCAN ); /* Try and see if its there already - damn well should be! */ psMapping = keyGetMappingFromFunction((void*)selectedKeyMap->function); /* Cough if it's not there */ ASSERT( psMapping!=NULL,"Trying to patch a non-existant function mapping - whoop whoop!!!" ); /* Now alter it to the new values */ psMapping->metaKeyCode = metakey; psMapping->subKeyCode = subkey; // was "==" psMapping->status = KEYMAP_ASSIGNABLE; //must be if(alt) { psMapping->altMetaKeyCode = alt; } /* // unbind old mapping with this combo. // function = selectedKeyMap->function; // action = selectedKeyMap->action; // status = selectedKeyMap->status; // sstrcpy(name, selectedKeyMap->pName); // keyRemoveMappingPt(selectedKeyMap); keyAddMapping(status,metakey,subkey,action,function,name); // add new binding. // keyReAssignMapping( selectedKeyMap->metaKeyCode, selectedKeyMap->subKeyCode, metakey, subkey); // keyAddMapping( selectedKeyMap->metaKeyCode = metakey; selectedKeyMap->subKeyCode = subkey; // readd the widgets. // widgDelete(psWScreen,FRONTEND_BACKDROP); // startKeyMapEditor(false); */ selectedKeyMap = NULL; // unhighlght selected . return true; }