From f2d22ebc3f95e01fd656d6fb6cccb29f2be57017 Mon Sep 17 00:00:00 2001 From: Sabine Date: Thu, 7 Dec 2023 14:28:26 +0100 Subject: [PATCH] feat(linux): mcompile sort converting functions III --- linux/mcompile/keymap/helpers.cpp | 8 ++++---- linux/mcompile/keymap/keymap.cpp | 6 +++--- linux/mcompile/keymap/keymap.h | 2 +- linux/mcompile/keymap/mcompile.cpp | 9 ++++----- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/linux/mcompile/keymap/helpers.cpp b/linux/mcompile/keymap/helpers.cpp index 93ea3745a5..41ceb0b496 100755 --- a/linux/mcompile/keymap/helpers.cpp +++ b/linux/mcompile/keymap/helpers.cpp @@ -621,8 +621,8 @@ bool InsertKeyvalsFromKeymap(v_dw_3D &All_Vector,GdkKeymap * keymap){ 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] = getKeyvalsOtherFromKeyCode(keymap,(All_Vector[1][i][0]),0); //shift state: unshifted:0 - All_Vector[1][i][1+1] = getKeyvalsOtherFromKeyCode(keymap,(All_Vector[1][i][0]),1); //shift state: shifted:1 + All_Vector[1][i][0+1] = getKeyvalsFromKeyCode(keymap,(All_Vector[1][i][0]),0); //shift state: unshifted:0 + All_Vector[1][i][1+1] = getKeyvalsFromKeyCode(keymap,(All_Vector[1][i][0]),1); //shift state: shifted:1 //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]); @@ -637,8 +637,8 @@ KMX_DWORD writeKeyvalsFromKeymap(GdkKeymap *keymap, guint keycode, int shift_sta KMX_DWORD out; for ( int ii =1; ii< 255;ii++) { - KMX_DWORD out = getKeyvalsOtherFromKeyCode(keymap,ii,0); - KMX_DWORD out2= getKeyvalsOtherFromKeyCode(keymap,ii,1); + KMX_DWORD out = getKeyvalsFromKeyCode(keymap,ii,0); + KMX_DWORD out2= getKeyvalsFromKeyCode(keymap,ii,1); wprintf(L" ii = %i --> keymap = %i (%c)..%i(%c) \n",ii, out,out, out2,out2); } } diff --git a/linux/mcompile/keymap/keymap.cpp b/linux/mcompile/keymap/keymap.cpp index 192a95f529..77090e9b76 100755 --- a/linux/mcompile/keymap/keymap.cpp +++ b/linux/mcompile/keymap/keymap.cpp @@ -325,8 +325,8 @@ int append_other_ToVector(v_dw_3D &All_Vector,GdkKeymap * keymap) { 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] = getKeyvalsOtherFromKeyCode(keymap,All_Vector[0][i][0],0); //shift state: unshifted:0 - All_Vector[1][i][1+1] = getKeyvalsOtherFromKeyCode(keymap,All_Vector[0][i][0],1); //shift state: shifted:1 + All_Vector[1][i][0+1] = getKeyvalsFromKeyCode(keymap,All_Vector[0][i][0],0); //shift state: unshifted:0 + All_Vector[1][i][1+1] = getKeyvalsFromKeyCode(keymap,All_Vector[0][i][0],1); //shift state: shifted:1 //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]); @@ -335,7 +335,7 @@ int append_other_ToVector(v_dw_3D &All_Vector,GdkKeymap * keymap) { } // _S2 can I use gdk_keymap_translate_keyboard_state instead? -KMX_DWORD getKeyvalsOtherFromKeyCode(GdkKeymap *keymap, guint keycode, int shift_state_pos) { +KMX_DWORD getKeyvalsFromKeyCode(GdkKeymap *keymap, guint keycode, int shift_state_pos) { GdkKeymapKey *maps; guint *keyvals; gint count; diff --git a/linux/mcompile/keymap/keymap.h b/linux/mcompile/keymap/keymap.h index a3125098ac..0adf47618d 100755 --- a/linux/mcompile/keymap/keymap.h +++ b/linux/mcompile/keymap/keymap.h @@ -506,7 +506,7 @@ int append_other_ToVector(v_dw_3D &All_Vector, GdkKeymap *keymap); bool InitializeGDK(GdkKeymap **keymap,int argc, gchar *argv[]); // find Keyvals to fill into 2D-Vector of Other Language -KMX_DWORD getKeyvalsOtherFromKeyCode(GdkKeymap *keymap, guint keycode, int shift_state_pos); +KMX_DWORD getKeyvalsFromKeyCode(GdkKeymap *keymap, guint keycode, int shift_state_pos); // returns KeySyms fo ra given key (for unshifted: finds the Keysym according to Shiftstate e.g. a;A or 1;! ) std::wstring get_KeyVals_according_to_keycode_and_Shiftstate_new(GdkKeymap *keymap, guint VK, ShiftState ss, int caps); diff --git a/linux/mcompile/keymap/mcompile.cpp b/linux/mcompile/keymap/mcompile.cpp index a9ce834382..34d14173c9 100755 --- a/linux/mcompile/keymap/mcompile.cpp +++ b/linux/mcompile/keymap/mcompile.cpp @@ -56,11 +56,10 @@ void KMX_TranslateDeadkeyGroup(LPKMX_GROUP group,KMX_WCHAR deadkey, KMX_WORD vk, void KMX_TranslateDeadkeyKey(LPKMX_KEY key, KMX_WCHAR deadkey, KMX_WORD vk, UINT shift, KMX_WORD ch); int KMX_GetDeadkeys(v_dw_2D & dk_ComposeTable, KMX_WORD DeadKey, KMX_WORD *OutputPairs, GdkKeymap* keymap); -int KMX_GetDeadkeys(v_dw_2D & dk_Table, KMX_WORD DeadKey, KMX_WORD *OutputPairs, KMX_WORD sc); +//int KMX_GetDeadkeys(v_dw_2D & dk_Table, KMX_WORD DeadKey, KMX_WORD *OutputPairs, KMX_WORD sc); void KMX_AddDeadkeyRule(LPKMX_KEYBOARD kbd, KMX_WCHAR deadkey, KMX_WORD vk, UINT shift); -KMX_WORD KMX_VKUSToVKUnderlyingLayout_S2(KMX_WORD VKey); KMX_UINT KMX_VKUSToSCUnderlyingLayout(KMX_DWORD VirtualKeyUS); KMX_WCHAR KMX_CharFromSC(GdkKeymap *keymap, KMX_UINT VKShiftState, UINT SC_OTHER, KMX_WCHAR* DeadKey); @@ -420,6 +419,7 @@ void KMX_ConvertDeadkey(LPKMX_KEYBOARD kbd, KMX_WORD vk, UINT shift, KMX_WCHAR d while(*pdk) { // Look up the ch + // go via SC UINT vkUnderlying = KMX_VKUnderlyingLayoutToVKUS(All_Vector, *pdk); KMX_TranslateDeadkeyKeyboard(kbd, dkid, vkUnderlying, *(pdk+1), *(pdk+2)); pdk+=3; @@ -481,7 +481,7 @@ KMX_BOOL KMX_DoConvert(LPKMX_KEYBOARD kbd, PKMX_WCHAR kbid, KMX_BOOL bDeadkeyCon // Loop through each possible key on the keyboard for (int i = 0;KMX_VKMap[i]; i++) { // I4651 - // win goes via VK, Lin goes vie SC + // win goes via VK, Lin goes via SC /*KMX_DWORD vkUnderlying = KMX_VKUSToVKUnderlyingLayout(All_Vector,(int) KMX_VKMap[i] ); KMX_WCHAR ch = KMX_CharFromVK(All_Vector,vkUnderlying, VKShiftState[j], &DeadKey);*/ @@ -601,7 +601,7 @@ KMX_DWORD KMX_CharFromVK(v_dw_3D &All_Vector,KMX_DWORD vkUnderlying, KMX_UINT VK KMX_WCHAR KMX_CharFromSC(GdkKeymap *keymap, KMX_UINT VKShiftState, UINT SC_OTHER, KMX_WCHAR* DeadKey) { int VKShiftState_lin = map_VKShiftState_to_Lin(VKShiftState); - KMX_DWORD KeyvalOther = getKeyvalsOtherFromKeyCode(keymap,SC_OTHER, VKShiftState_lin); + KMX_DWORD KeyvalOther = getKeyvalsFromKeyCode(keymap,SC_OTHER, VKShiftState_lin); // _S2 how to detect deadkeys ? KeyvalOther >deadkeyThreshold KeyvalOther > 255? KeyvalOther > 65000 ? or what else? //if (KeyvalOther > deadkeyThreshold) { @@ -610,7 +610,6 @@ KMX_WCHAR KMX_CharFromSC(GdkKeymap *keymap, KMX_UINT VKShiftState, UINT SC_OTHE *DeadKey = convertNamesToIntegerValue( wstring_from_string(ws)); return 0xFFFF; } - return (KMX_WCHAR) KeyvalOther; }