feat(linux): mcompile fill rgKey 220 (221)

This commit is contained in:
Sabine 2023-10-27 22:52:24 +02:00
parent 652a1b56b6
commit ee328bb7a2
4 changed files with 153 additions and 254 deletions

View file

@ -103,17 +103,6 @@ KMX_DWORD convertNamesToValue(std::wstring tok_wstr){
//initializing
//first[L"grave"] 96 = /*FE50; ???*/;
//first[L"apostrophe"] = /*27;*/;
//first[L"braceleft"] = /*7B;*/;
//first[L"braceright"] = /*7D ;*/;
first[L"underscore"] = 95 /*5F;*/;
first[L"plus"] = 43 /*2B;*/;
first[L"semicolon"] = 59/*3B;*/;
first[L"quotedbl"] = 34 /*22;*/;
first[L"less"] = 60/* 3C;*/;
first[L"greater"] = 62 /*3E ;*/;
first[L"question"] = 63 /*3F*/;
first[L"bar"] = 124 /*7C*/;
first[L"exclam"] = 33;
first[L"at"] = 64;
@ -125,24 +114,33 @@ KMX_DWORD convertNamesToValue(std::wstring tok_wstr){
first[L"asterisk"] = 42;
first[L"parenleft"] = 40;
first[L"parenright"] = 41;
first[L"braceleft"] = 123; /* { */
first[L"braceright"] = 125; /* } */
//todo dieser block ist nötig; nicht dieVK-Nr
first[L"equal"] = 61; /* BB = 187 VK_OEM_PLUS*/
first[L"backslash"] = 92; /* DC = 220 \ | VK_OEM_5 */
first[L"bracketleft"] = 91; /* DB = 219 [ { VK_OEM_4 */
first[L"bracketright"] = 93; /* DD = 221 ] } VK_OEM_6 */
first[L"colon"] = 58; /* BA = 186 ; VK_OEM_1 */
first[L"comma"] = 44; /* BC = 188 , VK_OEM_COMMA */
first[L"period"] = 46; /* BE = 190 . VK_OEM_PERIOD */
first[L"slash"] = 47; /* BF = 191 / ? VK_OEM_2 */
first[L"minus"] = 45; /* BD = 189 - VK_OEM_MINUS */
first[L"space"] = 32; /* 20 = 32 ? */
first[L"apostrophe"] = 39; /* DE = 222 ' " ? VK_OEM_7 */
first[L"dead_acute"] = VK_ACCENT; /* C0 = 192 ` ~ VK_OEM_3 */
first[L"dead_grave"] = VK_ACCENT; /* C0 = 192 ? */
first[L"ssharp"] = VK_xDF; /* DF = 223 ß */
first[L"minus"] = 45; /* BD = 189 - VK_OEM_MINUS */
first[L"underscore"] = 95; /* 5F = 95 _;*/
first[L"equal"] = 61; /* BB = 187 = VK_OEM_PLUS*/
first[L"plus"] = 43; /* 2B = 43 + ;*/
first[L"bracketleft"] = 91; /* DB = 219 [ { VK_OEM_4 */
first[L"braceleft"] = 123; /* 7B = 123 { */
first[L"bracketright"] = 93; /* DD = 221 ] } VK_OEM_6 */
first[L"braceright"] = 125; /* 7d = 125 } */
first[L"semicolon"] = 59; /* 3B = 59 ; ;*/
first[L"colon"] = 58; /* BA = 186 ; VK_OEM_1 */
first[L"apostrophe"] = 39; /* DE = 222 ' " ? VK_OEM_7 */
first[L"quotedbl"] = 34; /* 22 = 34 " ;*/
first[L"backslash"] = 92; /* DC = 220 \ | VK_OEM_5 */
first[L"bar"] = 124; /* 7C = 124 | */
first[L"comma"] = 44; /* BC = 188 , VK_OEM_COMMA */
first[L"less"] = 60; /* 3C = 60 < ;*/
first[L"period"] = 46; /* BE = 190 . VK_OEM_PERIOD */
first[L"greater"] = 62; /* 3E = 62 > ;*/
first[L"slash"] = 47; /* BF = 191 / ? VK_OEM_2 */
first[L"question"] = 63; /* 3F = 63 ? */
first[L"space"] = 32; /* 20 = 32 */
first[L"dead_acute"] = 180; /* C0 = 192 ` ~ VK_OEM_3 */
first[L"grave"] = 96; /* C0 = 192 ? */
first[L"ssharp"] = 223; /* DF = 223 ß */
//first[L"equal"] = VK_EQUAL; /* BB = 187 VK_OEM_PLUS*/
//first[L"backslash"] = VK_BKSLASH; /* DC = 220 \ | VK_OEM_5 */
@ -246,21 +244,21 @@ int replace_PosKey_with_Keycode_use_Lin(std::string in) {
int out = returnIfCharInvalid;
// _S2 these are the Scancode-Values we use in Keyman ( = like the windows scancodes)
// NAME IN SYMBOLS-FILE KEYCODE (LIN STYLE) (WIN STYLE) VK_US VK_DE
/*on US keyb;*/
if ( in == "key<TLDE>") out = 49; /* 0X VK_ */ // TOASK correct ???
else if ( in == "key<AE01>") out = 10; /* 0X02 VK_1 */
else if ( in == "key<AE02>") out = 11; /* 0X03 VK_2 */
else if ( in == "key<AE03>") out = 12; /* 0X04 VK_3 */
else if ( in == "key<AE04>") out = 13; /* 0X05 VK_4 */
else if ( in == "key<AE05>") out = 14; /* 0X06 VK_5 */
else if ( in == "key<AE06>") out = 15; /* 0X07 VK_6 */
else if ( in == "key<AE07>") out = 16; /* 0X08 VK_7 */
else if ( in == "key<AE08>") out = 17; /* 0X09 VK_8 */
else if ( in == "key<AE09>") out = 18; /* 0X0A VK_9 */
else if ( in == "key<AE10>") out = 19; /* 0X0B VK_0 */
else if ( in == "key<AE11>") out = 20; /*out = 61;*/ /* 0X0C VK_MINUS de ẞ*/
else if ( in == "key<AE12>") out = 21; /* 0X0D VK_EQUALS DE ' */
// NAME IN SYMBOLS-FILE KEYCODE (LIN STYLE) (WIN STYLE) VK_US VK_DE
/*on US keyb;*/
if ( in == "key<TLDE>") out = 49; /* VK_ */ // TOASK correct ???
else if ( in == "key<AE01>") out = 10; /* 0X02 VK_1 */
else if ( in == "key<AE02>") out = 11; /* 0X03 VK_2 */
else if ( in == "key<AE03>") out = 12; /* 0X04 VK_3 */
else if ( in == "key<AE04>") out = 13; /* 0X05 VK_4 */
else if ( in == "key<AE05>") out = 14; /* 0X06 VK_5 */
else if ( in == "key<AE06>") out = 15; /* 0X07 VK_6 */
else if ( in == "key<AE07>") out = 16; /* 0X08 VK_7 */
else if ( in == "key<AE08>") out = 17; /* 0X09 VK_8 */
else if ( in == "key<AE09>") out = 18; /* 0X0A VK_9 */
else if ( in == "key<AE10>") out = 19; /* 0X0B VK_0 */
else if ( in == "key<AE11>") out = 20; /*out = 61;*/ /* 0X0C VK_MINUS de ẞ*/
else if ( in == "key<AE12>") out = 21; /* 0X0D VK_EQUALS DE ' */
else if ( in == "key<AD01>") out = 24; /* 0X10 VK_Q */
else if ( in == "key<AD02>") out = 25; /* 0X11 VK_W */
@ -353,31 +351,17 @@ int append_other_ToVector(v_dw_3D &All_Vector,GdkKeymap * keymap) {
// get key name US stored in [0][i][0] and copy to name in "other"-block[1][i][0]
All_Vector[1][i][0] = All_Vector[0][i][0];
/*
// get Keyvals of this key and copy to unshifted/shifted in "other"-block[1][i][1] / block[1][i][2]
All_Vector[1][i][0+1] = getKeyvalsFromKeymap(keymap,keycode_map[All_Vector[0][i][0]],0); //shift state: unshifted:0
All_Vector[1][i][1+1] = getKeyvalsFromKeymap(keymap,keycode_map[All_Vector[0][i][0]],1); //shift state: shifted:1
KMX_DWORD inValue = All_Vector[0][i][0];
KMX_DWORD KeycodeMapped_inValue = keycode_map[All_Vector[0][i][0]];
KMX_DWORD resultOf_GETKEYVALS = getKeyvalsFromKeymap(keymap,keycode_map[All_Vector[0][i][0]],0);
KMX_DWORD resultOf_GETKEYVALS_shift = getKeyvalsFromKeymap(keymap,keycode_map[All_Vector[0][i][0]],1);
wprintf(L" inValue: %i -KeycodeMapped_inValue: %i, resultOf_GETKEYVALS: %i , resultOf_GETKEYVALS_shift: %i : %d (US): -- %i (%c) -- %i (%c) ---- (other): %i (%c) -- %i(%c) \n",inValue,KeycodeMapped_inValue,resultOf_GETKEYVALS,resultOf_GETKEYVALS_shift,(All_Vector[1][i][0]),All_Vector[0][i][1],All_Vector[0][i][1],All_Vector[0][i][2],All_Vector[0][i][2],All_Vector[1][i][1] ,All_Vector[1][i][1],All_Vector[1][i][2],All_Vector[1][i][2]);
*/
// get Keyvals of this key and copy to unshifted/shifted in "other"-block[1][i][1] / block[1][i][2]
All_Vector[1][i][0+1] = getKeyvalsFromKeymap(keymap,All_Vector[0][i][0],0); //shift state: unshifted:0
All_Vector[1][i][1+1] = getKeyvalsFromKeymap(keymap,All_Vector[0][i][0],1); //shift state: shifted:1
KMX_DWORD inValue = All_Vector[0][i][0];
KMX_DWORD KeycodeMapped_inValue = All_Vector[0][i][0];
KMX_DWORD resultOf_GETKEYVALS = getKeyvalsFromKeymap(keymap,All_Vector[0][i][0],0);
KMX_DWORD resultOf_GETKEYVALS_shift = getKeyvalsFromKeymap(keymap,All_Vector[0][i][0],1);
//wprintf(L" inValue: %i -KeycodeMapped_inValue: %i, resultOf_GETKEYVALS: %i , resultOf_GETKEYVALS_shift: %i : %d (US): -- %i (%c) -- %i (%c) ---- (other): %i (%c) -- %i(%c) \n",inValue,KeycodeMapped_inValue,resultOf_GETKEYVALS,resultOf_GETKEYVALS_shift,(All_Vector[1][i][0]),All_Vector[0][i][1],All_Vector[0][i][1],All_Vector[0][i][2],All_Vector[0][i][2],All_Vector[1][i][1] ,All_Vector[1][i][1],All_Vector[1][i][2],All_Vector[1][i][2]);
//KMX_DWORD inValue = All_Vector[0][i][0];
//KMX_DWORD KeycodeMapped_inValue = All_Vector[0][i][0];
//KMX_DWORD resultOf_GETKEYVALS = getKeyvalsFromKeymap(keymap,All_Vector[0][i][0],0);
//KMX_DWORD resultOf_GETKEYVALS_shift = getKeyvalsFromKeymap(keymap,All_Vector[0][i][0],1);
//wprintf(L" inValue: %i -KeycodeMapped_inValue: %i, resultOf_GETKEYVALS: %i , resultOf_GETKEYVALS_shift: %i : %d (US): -- %i (%c) -- %i (%c) ---- (other): %i (%c) -- %i(%c) \n",inValue,KeycodeMapped_inValue,resultOf_GETKEYVALS,resultOf_GETKEYVALS_shift,(All_Vector[1][i][0]),All_Vector[0][i][1],All_Vector[0][i][1],All_Vector[0][i][2],All_Vector[0][i][2],All_Vector[1][i][1] ,All_Vector[1][i][1],All_Vector[1][i][2],All_Vector[1][i][2]);
//wprintf(L" Keycodes US dw : %d (US): -- %i (%c) -- %i (%c) ---- (other): %i (%c) -- %i(%c) \n",(All_Vector[1][i][0]),All_Vector[0][i][1],All_Vector[0][i][1],All_Vector[0][i][2],All_Vector[0][i][2],All_Vector[1][i][1] ,All_Vector[1][i][1],All_Vector[1][i][2],All_Vector[1][i][2]);
//wprintf(L" Keycodes ->Other dw:-: %d (US): -- %i (%c) -- %i (%c) \n\n",(All_Vector[1][i][0]),All_Vector[1][i][1],All_Vector[1][i][1],All_Vector[1][i][2],All_Vector[1][i][2]);
@ -414,7 +398,6 @@ KMX_DWORD writeKeyvalsFromKeymap(GdkKeymap *keymap, guint keycode, int shift_sta
KMX_DWORD out2= getKeyvalsFromKeymap(keymap,ii,1);
wprintf(L" ii = %i --> keymap = %i (%c)..%i(%c) \n",ii, out,out, out2,out2);
}
}
KMX_DWORD getKeyvalsFromKeymap(GdkKeymap *keymap, guint keycode, int shift_state_pos) {
@ -438,7 +421,7 @@ KMX_DWORD getKeyvalsFromKeymap(GdkKeymap *keymap, guint keycode, int shift_state
// _S2 what is 65104-65106, 65506, 21840
// _S2 if out of range of what ( ascii??) return 0 or other value ?
if (out > 255) {
wprintf(L"out of range: found value out( %i) for keycode = %i /shift_state_pos %i (49= TLDE 21= VK_EQUALS 62 = RSHIFT on US keyboard) \n", out,keycode,shift_state_pos);
wprintf(L"out of range: found value out( %i) for keycode = %i /shift_state_pos %i (49= TLDE 21= VK_EQUALS on US keyboard) \n", out,keycode,shift_state_pos);
out = 0;
}
@ -485,163 +468,94 @@ bool test_single(v_dw_3D &V) {
wprintf(L" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
return true;
}
// _S2 ToDo something does not work yet
// query All_Vector
// return RETURN NON SHIFTED CHAR [1] the VirtualKey of the Other Keyboard for given Scancode
KMX_DWORD get_VirtualKey_Other_From_SC_BAK(KMX_DWORD SC , v_dw_3D &All_Vector){
// find correct row of char in US
for( int k=0; k< (int)All_Vector.size()-1;k++) {
for( int i=0; i< (int)All_Vector[1].size()-1;i++) {
// _S2 what if we use column 3(altgr) and 4 (shift+altgr) ??
KMX_DWORD map_To_VK(KMX_DWORD SC ){
// if there is a Keyman VK.. defined map to Keyman VKcode
int unshiftedchar = All_Vector[k][i][1];
if (unshiftedchar < 57) {
// if (SC < 57) {
// if( true) {
// values for numbers are stored in column All_Vector[1][i][ 1 ]
//if ( All_Vector[k][i][0] == SC ) {
if ( All_Vector[0][i][0] == SC ) {
//wprintf(L" SC= %i .. i= %i .. %i:\t\t %i(%c) (%i (%c) : %i (%c) ) --- \n",SC , i, All_Vector[k][i][0] , All_Vector[k][i][1] ,All_Vector[k][i][2],All_Vector[k][i][2] ,All_Vector[k][i][1] , All_Vector[k][i][2] , All_Vector[k][i][2] );
//return All_Vector[k][i][1];
return All_Vector[1][i][1];
}
}
else {
// shifted values e.g. "Q" (=81) are stored in column All_Vector[1][i][ 2 ]
if ( All_Vector[k][i][0] == SC ) {
//wprintf(L" SC= %i .. i= %i .. %i:\t\t %i(%c) (%i (%c) : %i (%c) ) --- \n",SC , i, All_Vector[k][i][0] , All_Vector[k][i][1] ,All_Vector[1][i][2],All_Vector[1][i][2] ,All_Vector[k][i][1] , All_Vector[k][i][2] , All_Vector[k][i][2] );
return All_Vector[1][i][2];
}
}
if ( SC == 49) return VK_BKSLASH; /* ; 220 = ` oder ^ */
if ( SC == 20) return VK_LBRKT; /* ; 219 = - oder ß */
if ( SC == 21) return VK_RBRKT; /* ; 221 = = oder ' */
/*if (IsKeyIn_VKMap(SC))
return SC; //_S2 what do I return if not found??*/
}
}
return 0;
}
if ( SC == 34) return VK_COLON; /* ; 186 VK_OEM_4 = [ oder ü */
if ( SC == 35) return VK_EQUAL; /* ; 187 = ] oder + */
KMX_DWORD map_VK(KMX_DWORD SC ){
if ( SC == 20) return VK_HYPHEN; /* ; 189 = - oder ß */
if ( SC == 21) return VK_EQUAL; /* ; 187 = oder ' */
if ( SC == 47) return VK_ACCENT; /* ; 192 VK_OEM_1 = : oder ö */
if ( SC == 48) return VK_QUOTE; /* ' 222 VK_OEM_7 = " oder Ä */
if ( SC == 51) return VK_SLASH; /* ; 191 = \ oder # */
if ( SC == 34) return VK_LBRKT; /* ; 186 VK_OEM_4 [ oder ü */
if ( SC == 35) return VK_RBRKT; /* ; 221 = ] oder + */
if ( SC == 59) return VK_COMMA; /* ; 188 = , oder , */
if ( SC == 60) return VK_PERIOD; /* ; 190 = . oder . */
if ( SC == 61) return VK_HYPHEN; /* ; 189 = / oder - */
if ( SC == 47) return VK_COLON; /* ; 192 VK_OEM_1 : oder ö */
if ( SC == 48) return VK_QUOTE; /* ' 222 VK_OEM_7 " oder Ä */
if ( SC == 51) return VK_BKSLASH; /* ; 220 = \ oder # */
if ( SC == 59) return VK_COMMA; /* ; 188 = , oder , */
if ( SC == 60) return VK_PERIOD; /* ; 190 = . oder . */
if ( SC == 61) return VK_SLASH; /* ; 191 = / oder - */
if ( SC == 65) return VK_SPACE; /* ; 32 VK_SPACE = oder */
if ( SC == 65) return VK_SPACE; /* ; 32 VK_SPACE = oder */
else
return SC;
}
KMX_DWORD map_SC(KMX_DWORD VK ){
if ( VK == VK_HYPHEN) return 20; /* ; = oder */
if ( VK == VK_EQUAL) return 21; /* ; 187 = oder ' */
// return RETURN NON SHIFTED CHAR [1] the VirtualKey of the US Keyboard for given Scancode
KMX_DWORD get_VirtualKey_Other_Layer1_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector){
// find correct row of char in US
for( int i=0; i< (int)All_Vector[0].size()-1;i++) {
if ( All_Vector[0][i][0] == SC ) {
//wprintf(L" SC= %i .. i= %i .. %i:\t\t %i (%c) : %i (%c) --- ",SC , i, All_Vector[0][i][0] , All_Vector[0][i][1] ,All_Vector[0][i][1] , All_Vector[0][i][2] , All_Vector[0][i][2] );
return All_Vector[1][i][1] ;
}
}
return 0; //_S2 what do I return if not found??
}
// return RETURN NON SHIFTED CHAR [1] the VirtualKey of the US Keyboard for given Scancode
KMX_DWORD get_VirtualKey_Other_Layer2_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector){
// find correct row of char in US
for( int i=0; i< (int)All_Vector[0].size()-1;i++) {
if ( All_Vector[0][i][0] == SC ) {
//wprintf(L" SC= %i .. i= %i .. %i:\t\t %i (%c) : %i (%c) --- ",SC , i, All_Vector[0][i][0] , All_Vector[0][i][1] ,All_Vector[0][i][1] , All_Vector[0][i][2] , All_Vector[0][i][2] );
return All_Vector[1][i][2] ;
}
int ertzu=99;
}
if ( VK == VK_LBRKT) return 34; /* ; 186 VK_OEM_4 [ oder ü */
if ( VK == VK_RBRKT) return 35; /* ; VK_RBRKT = oder */
int ertzwrtu=99;
return 0; //_S2 what do I return if not found??
if ( VK == VK_ACCENT) return 47; /* ; 192 VK_OEM_1 : oder ö */
if ( VK == VK_QUOTE) return 48; /* ' 222 VK_OEM_7 " oder Ä */
if ( VK == VK_BKSLASH) return 51; /* ; = oder */
if ( VK == VK_COMMA) return 59; /* ; = oder */
if ( VK == VK_PERIOD) return 60; /* ; = oder */
if ( VK == VK_SLASH) return 61; /* ; = oder */
if ( VK == VK_SPACE) return 65; /* ; VK_SPACE = oder */
else
return VK;
int eerurziurtzu=99;
}
// _S2 ToDo something does not work yet
// query All_Vector
// return RETURN NON SHIFTED CHAR [1] the VirtualKey of the Other Keyboard for given Scancode
KMX_DWORD get_VirtualKey_Other_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector){
for( int i=0; i< (int)All_Vector[0].size();i++) {
//number keys return unshifted value ( e.g. 1 not !)
if(SC <= 19) {
if ( All_Vector[0][i][0] == SC)
return All_Vector[1][i][1];
}
// other keys
if((SC > 19) ) {
if ( All_Vector[0][i][0] == map_SC(SC)) {
if ( All_Vector[0][i][0] == SC) {
// normal capital characters return the value of capital char ( e.g. A)
if ((All_Vector[1][i][2] >= 65 ) && (All_Vector[1][i][2] < 91 )) {
//int sdfghj= map_SC(SC);
//int sdfgheuj= map_VK(SC);
if ((All_Vector[1][i][2] >= 65 ) && (All_Vector[1][i][2] < 91 ))
return All_Vector[1][i][2];
}
// special characters return Keyman defined values (e.g. VK_ACCENT)
else {
//int test = map_SC(SC);
//int sdfghj= map_VK(SC);
return map_VK(SC);
}
else
//return All_Vector[1][i][1];
return map_To_VK(SC);
}
}
}
return 0;
}
// _S2 ToDo something does not work yet
// query All_Vector
// return RETURN NON SHIFTED CHAR [1] the VirtualKey of the Other Keyboard for given Scancode
KMX_DWORD get_VirtualKey_Other_From_SC_BAK2(KMX_DWORD SC , v_dw_3D &All_Vector){
// find correct row of char in US
for( int k=1; k< (int)All_Vector.size();k++) {
for( int i=0; i< (int)All_Vector[1].size()-1;i++) {
// _S2 what if we use column 3(altgr) and 4 (shift+altgr) ??
int unshiftedchar = All_Vector[k][i][1];
if (unshiftedchar < 57) {
// if (SC < 57) {
// if( true) {
// values for numbers are stored in column All_Vector[1][i][ 1 ]
//if ( All_Vector[k][i][0] == SC ) {
if ( All_Vector[0][i][0] == SC ) {
//wprintf(L" SC= %i .. i= %i .. %i:\t\t %i(%c) (%i (%c) : %i (%c) ) --- \n",SC , i, All_Vector[k][i][0] , All_Vector[k][i][1] ,All_Vector[k][i][2],All_Vector[k][i][2] ,All_Vector[k][i][1] , All_Vector[k][i][2] , All_Vector[k][i][2] );
//return All_Vector[k][i][1];
//return All_Vector[1][i][1];
return map_VK( SC);
}
}
else {
// shifted values e.g. "Q" (=81) are stored in column All_Vector[1][i][ 2 ]
if ( All_Vector[k][i][0] == SC ) {
//wprintf(L" SC= %i .. i= %i .. %i:\t\t %i(%c) (%i (%c) : %i (%c) ) --- \n",SC , i, All_Vector[k][i][0] , All_Vector[k][i][1] ,All_Vector[1][i][2],All_Vector[1][i][2] ,All_Vector[k][i][1] , All_Vector[k][i][2] , All_Vector[k][i][2] );
return map_VK(SC);
}
}
/*if (IsKeyIn_VKMap(SC))
return SC; //_S2 what do I return if not found??*/
}
}
return 0;
}
// _S2 not needed, can go later
// return RETURN NON SHIFTED CHAR [1] the VirtualKey of the US Keyboard for given Scancode
KMX_DWORD get_VirtualKey_US_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector){
// find correct row of char in US
for( int i=0; i< (int)All_Vector[0].size()-1;i++) {
if ( All_Vector[0][i][0] == SC ) {
//wprintf(L" SC= %i .. i= %i .. %i:\t\t %i (%c) : %i (%c) --- ",SC , i, All_Vector[0][i][0] , All_Vector[0][i][1] ,All_Vector[0][i][1] , All_Vector[0][i][2] , All_Vector[0][i][2] );
return All_Vector[0][i][1] ; // shouldn this be [0][i][2]?
//return All_Vector[0][i][2] ; // would be shifted version
return All_Vector[0][i][1] ;
}
}
return 0; //_S2 what do I return if not found??
@ -671,26 +585,18 @@ KMX_DWORD get_SC_From_VirtualKey_US(KMX_DWORD VK_US , v_dw_3D &All_Vector){
return 0; //_S2 what do I return if not found??
}
// return the position of the VK in Other in All_Vector
KMX_DWORD get_position_From_VirtualKey_Other(KMX_DWORD VK_Other , v_dw_3D &All_Vector){
// find correct row of char in US
for( int i=0; i< (int)All_Vector[0].size()-1;i++) {
if ( ( All_Vector[1][i][1] == VK_Other ) || ( All_Vector[1][i][2] == VK_Other )) {
//if ( ( All_Vector[0][i][1] == VK_US ) ) {
//wprintf(L" VK_Other= %i .. i= %i .. %i\t\t %i (%c) : %i (%c) +++ %i\t\t %i (%c) : %i (%c) \n",VK_Other , i,
// All_Vector[0][i][0] , All_Vector[0][i][1] ,All_Vector[0][i][1] , All_Vector[0][i][2] , All_Vector[0][i][2],
// All_Vector[1][i][0] , All_Vector[1][i][1] ,All_Vector[1][i][1] , All_Vector[1][i][2] , All_Vector[1][i][2] );
return i;
}
}
return 0; //_S2 what do I return if not found??
}
KMX_DWORD get_position_From_VirtualKey_Other_2(KMX_DWORD VK_Other , v_dw_3D &All_Vector){
return VK_Other; //_S2 what do I return if not found??
}
// _S2 maybe not needed
bool IsKeyIn_VKMap(UINT SC) {
for (int i=0; i< sizeof( KMX_VKMap)/sizeof( KMX_VKMap[0]); i++) {
if ( SC == KMX_VKMap[i])
@ -699,53 +605,49 @@ bool IsKeyIn_VKMap(UINT SC) {
return false;
}
const int Lin_KM__map(int i) {
const int Lin_KM__map(int i, v_dw_3D &All_Vector) {
// MAP:
// VK KEYMAN-STYLE -> KEYCODE LINUX-STYLE
// e.g 188 -> 59
//All_Vector_[ 1 ][ in which line of US did find the value 58 ][ take second or third column wherever I find 58 ]]
// finds 59th row (not value 59)
//int vk0 = get_VirtualKey_Other_From_SC(dw, All_Vector);
//int vk1 = get_VirtualKey_US_From_SC(dw, All_Vector);
//int vk2 = get_VirtualKey_Other_Layer1_From_SC(dw, All_Vector);
int vk3 = get_VirtualKey_Other_Layer2_From_SC(dw, All_Vector);
if ( i>160)
{
wprintf(L"dw = %i i=%i ----> vk3=%i\n",dw,i, vk3);
}
//return vk3;
//if (i == 32 ) return ; /* */5
//if (i == 186 ) return 252; /* Ü */
if (i == 187 )
return 43; /* + * */
if (i == 188 )
return 59; /* COMMA */
// if (i == 189 )
// return 45; /* - _ */
if (i == 190 )
return 58; /* PERIOD */
if (i == 191 )
return 35; /* # ' */
//if (i == 191 ) return 63; /* */
//if (i == 214 ) return 192; /* Ö */
if (i == 219 )
return 223; /* Sharp-S+ ? */
if (i == 220 )
return 92; /* ^ ° */
//if (i == 221 )
//return 180; /* ' ` */
//if (i == 223 ) return ; /* */
if (i == 226 )
return 60; /* < > */
if (i == 187 ) {wprintf(L" swapped: i (%i) to 43 \n",dw,i); return 43; }/* + * */
if (i == 188 ) {wprintf(L" swapped: i (%i) to 59 \n",dw,i); return 59; }/* COMMA */
if (i == 189 ) {wprintf(L" swapped: i (%i) to 95 \n",dw,i); return 95; }/* - _ */
if (i == 190 ) {wprintf(L" swapped: i (%i) to 58 \n",dw,i); return 58; }/* PERIOD */
if (i == 191 ) {wprintf(L" swapped: i (%i) to 35 \n",dw,i); return 35; }/* # ' */
//if (i == 191 ) {wprintf(L" swapped: i (%i) to 63 \n",dw,i); return 63; }/* */
//if (i == 214 ) {wprintf(L" swapped: i (%i) to 192 \n",dw,i); return 192; }/* Ö */
if (i == 219 ) {wprintf(L" swapped: i (%i) to 223 \n",dw,i); return 223; }/* Sharp-S+ ? */
if (i == 220 ) {wprintf(L" swapped: i (%i) to 92 \n",dw,i); return 92; }/* ^ ° */
//if (i == 221 ) {wprintf(L" swapped: i (%i) to 180 \n",dw,i); return 180; }/* ' ` */
//if (i == 223 ) {wprintf(L" swapped: i (%i) to 59 \n",dw,i); return ; }/* */
if (i == 65105 )
return 92; /* */
if (i == 226 ) {wprintf(L" swapped: i (%i) to 60 \n",dw,i); return 60; }/* < > */
if (i == 65105 ) {wprintf(L" swapped: i (%i) to 92 \n",dw,i); return 92; }/* */
// das is t nötig, damit werte in rgkey[]rg_ss[0,1] geschrieben werden
// this is?? this is pos of rgKey[pos]
if (i == 192 )
return 214; /* Ö */
if (i == 186 )
return 220; /* Ü */
//if (i == 222 ) return 228; /* Ä */
if (i == 222 )
return 196; /* Ä */
// e.g. rgKey[192] contains character 214
if (i == 192 ) {wprintf(L" swapped: i (%i) to 214 \n",dw,i); return 214; }/* Ö */
if (i == 186 ) {wprintf(L" swapped: i (%i) to 220 \n",dw,i); return 220; }/* Ü */
if (i == 222 ) {wprintf(L" swapped: i (%i) to 196 \n",dw,i); return 196; }/* Ä */
return i;
}

View file

@ -57,7 +57,7 @@ const KMX_DWORD KMX_VKMap[] = {
0
};
// _S2 how many fielsds do I need??
// _S2 how many fields do I need??
// mapping between Linux keycodes and keyman SC
const int keycode_map[60]={
0, /* */
@ -122,6 +122,7 @@ const int keycode_map[60]={
0, /* */
};
// _S2 not used-can go later
// _S2 how many fielsds do I need??
const int Lin_KM__map_arr[70]={
0, /* */
@ -200,6 +201,7 @@ const int Lin_KM__map_arr[70]={
};
const int Lin_KM__map(int i);
const int Lin_KM__map(int i, v_dw_3D &All_Vector);
// this is what we return when we find an invalid character
//_S2 Which character do we use in that case? 0 or FFFF or 32 or ??
@ -226,12 +228,13 @@ int replace_PosKey_with_Keycode_use_Lin(std::string in);
// create an empty 2D vector containing "--" in all fields
v_dw_2D create_empty_2D(int dim_rows, int dim_shifts);
// get Keyvals from VectorFile.txt and insert into All_Vector
//bool InsertKeyvalsFromVectorFile(v_dw_3D &All_Vector);
// query All_Vector
// return the VirtualKey of the Other Keyboard for given Scancode
KMX_DWORD get_VirtualKey_Other_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector);
KMX_DWORD get_VirtualKey_Other_Layer1_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector);
KMX_DWORD get_VirtualKey_Other_Layer2_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector);
// return the VirtualKey of the US Keyboard for given Scancode
KMX_DWORD get_VirtualKey_US_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector);
// return the Scancode of for given VirtualKey of Other Keyboard

View file

@ -144,8 +144,6 @@ public:
//right-hand keys, the left-hand scan code is returned.
//If there is no translation, the function returns 0.*/
this->m_sc = get_SC_From_VirtualKey_Other(KMX_virtualKey, All_Vector);
this->m_hkl = hkl;
this->m_vk = KMX_virtualKey;
@ -488,7 +486,7 @@ public:
// _S2 where to put this??
const int CODE__SIZE[] = {
-1, // undefined 0x00
-1, // undefined 0x00
1, // CODE_ANY 0x01
2, // CODE_INDEX 0x02
0, // CODE_CONTEXT 0x03
@ -497,14 +495,14 @@ const int CODE__SIZE[] = {
0, // CODE_RETURN 0x06
0, // CODE_BEEP 0x07
1, // CODE_DEADKEY 0x08
-1, // unused 0x09
-1, // unused 0x09
2, // CODE_EXTENDED 0x0A
-1, // CODE_EXTENDEDEND 0x0B (unused)
-1, // CODE_EXTENDEDEND 0x0B (unused)
1, // CODE_SWITCH 0x0C
-1, // CODE_KEY 0x0D (never used)
-1, // CODE_KEY 0x0D (never used)
0, // CODE_CLEARCONTEXT 0x0E
1, // CODE_CALL 0x0F
-1, // UC_SENTINEL_EXTENDEDEND 0x10 (not valid with UC_SENTINEL)
-1, // UC_SENTINEL_EXTENDEDEND 0x10 (not valid with UC_SENTINEL)
1, // CODE_CONTEXTEX 0x11
1, // CODE_NOTANY 0x12
2, // CODE_SETOPT 0x13
@ -621,11 +619,9 @@ std::wstring get_VirtualKey_Other_from_iKey(KMX_DWORD iKey, ShiftState &ss, int
// ss 0,2,4...
if ( ss % 2 == 0) {
// aAAa 4$$4
if ( is_Letter(pos, All_Vector) || is_Number(pos, All_Vector))
icaps = ss+2-caps;
// ..:: ##''
else
icaps = ss+1;
@ -636,11 +632,11 @@ std::wstring get_VirtualKey_Other_from_iKey(KMX_DWORD iKey, ShiftState &ss, int
// aAAa 4$$4
if ( is_Letter(pos, All_Vector) || is_Number(pos, All_Vector))
icaps = ss+caps;
// ..:: ##''
else
icaps = ss+1;
}
return std::wstring(1, (int) All_Vector[1][pos][icaps]);
}
return L"";
@ -726,13 +722,12 @@ bool KMX_ImportRules(KMX_WCHAR *kbid, LPKMX_KEYBOARD kp,v_dw_3D &All_Vector,std
}
}
*/
// _S2 test rgkey can go later
for(UINT iKey = 160; iKey < rgKey.size(); iKey++) {
if(rgKey[iKey] != NULL) {
wprintf(L" Key Nr %i is available\n",iKey);
}
}
// _S2 test rgkey can go later
for(UINT iKey = 160; iKey < rgKey.size(); iKey++) {
if(rgKey[iKey] != NULL) {
wprintf(L" Key Nr %i is available\n",iKey);
}
}
// _S2 in this part we skip shiftstates 4, 5, 8, 9
for(UINT iKey = 0; iKey < rgKey.size(); iKey++) {
@ -740,7 +735,7 @@ bool KMX_ImportRules(KMX_WCHAR *kbid, LPKMX_KEYBOARD kp,v_dw_3D &All_Vector,std
WCHAR sbBuffer[256]; // Scratchpad we use many places
//UINT mapped_ikey = Lin_KM__map[iKey];
UINT mapped_ikey = Lin_KM__map(iKey);
UINT mapped_ikey = Lin_KM__map(iKey, All_Vector);
for(ShiftState ss = Base; ss <= loader.MaxShiftState(); ss = (ShiftState)((int)ss + 1)) {
if(ss == Menu || ss == ShftMenu) {
@ -750,7 +745,7 @@ bool KMX_ImportRules(KMX_WCHAR *kbid, LPKMX_KEYBOARD kp,v_dw_3D &All_Vector,std
for(int caps = 0; caps <= 1; caps++) {
wprintf(L"this was ss %i - ikey %i\n",ss ,iKey);
//wprintf(L"this was ss %i - ikey %i\n",ss ,iKey);
//_S2 TODO
//_S2 get char - do I need rc ?? ( was rc = ToUnicodeEx...)
std::wstring VK_Other = get_VirtualKey_Other_from_iKey(mapped_ikey, ss, caps, All_Vector);
@ -790,6 +785,7 @@ bool KMX_ImportRules(KMX_WCHAR *kbid, LPKMX_KEYBOARD kp,v_dw_3D &All_Vector,std
// } from rc<0
}
}
wprintf(L" Values for SC: %i\t: VK: %i \n", rgKey[iKey]->SC(),rgKey[iKey]->VK() );
}
}

View file

@ -167,6 +167,7 @@ int run(int argc, std::vector<std::u16string> str_argv, char* argv_ch[] = NULL){
LPKMX_KEYBOARD kmxfile;
if(!KMX_LoadKeyboard(infile, &kmxfile)) {
KMX_LogError(L"Failed to load keyboard (%d)\n", errno );
return 3;
@ -388,7 +389,7 @@ KMX_BOOL KMX_DoConvert(LPKMX_KEYBOARD kbd, PKMX_WCHAR kbid, KMX_BOOL bDeadkeyCon
else
ERROR = L" ";
wprintf(L" DoConvert-read i: %i \t(KMX_VKMap): %i (%c) \t---> vkUnderlying: %i (%c) \tshiftstate[%i]: ( %i ) \t---- > ch: %i (%c) \t%ls \t%ls\n" , i,(int) KMX_VKMap[i],(int)KMX_VKMap[i], vkUnderlying,vkUnderlying, j, VKShiftState[j] , ch ,ch , ((int) vkUnderlying != (int) KMX_VKMap[i] ) ? L" *** ": L"", ERROR);
wprintf(L" DoConvert-read i: %i \t(KMX_VKMap): %i (%c) \t---> vkUnderlying: %i (%c) \tshiftstate[%i]: ( %i ) \t---- > ch: %i (%c) \t%ls \t%ls\n" , i,(int) KMX_VKMap[i],(int)KMX_VKMap[i], vkUnderlying,vkUnderlying, j, VKShiftState[j] , ch ,ch , ((int) vkUnderlying != (int) KMX_VKMap[i] ) ? L" *** ": L"", ERROR);
//LogError("--- VK_%d -> VK_%d [%c] dk=%d", VKMap[i], vkUnderlying, ch == 0 ? 32 : ch, DeadKey);
/* _S2 ToDo
@ -412,9 +413,6 @@ KMX_BOOL KMX_DoConvert(LPKMX_KEYBOARD kbd, PKMX_WCHAR kbid, KMX_BOOL bDeadkeyCon
KMX_ReportUnconvertedKeyboardRules(kbd);
// _S2 convert mcompile Step1: use (wrong) Datatype WCHAR (=wchar_t)
// _S2 convert mcompile Step2: use (OK) Datatype KMX_WCHAR (=char16_t)
if(!KMX_ImportRules(kbid, kbd, All_Vector, &KMX_FDeadkeys, bDeadkeyConversion)) { // I4353 // I4552
return FALSE;
}