feat(linux): mcompile-dk replace wchar_t disable more old wchar_t functions

This commit is contained in:
Sabine 2024-03-01 22:38:03 +01:00
parent 7bb97981a7
commit 1c9f879780
5 changed files with 20 additions and 17 deletions

View file

@ -1,7 +1,7 @@
#include "keymap.h"
#include "deadkey.h"
// _S2 TOP_7
// _S2 TOP_7 ok
/*v_dw_1D createLine(std::wstring first, std::wstring second, KMX_DWORD number, std::wstring nameresult) {
v_dw_1D line;
line.push_back(convertNamesTo_DWORD_Value(first));

View file

@ -6,7 +6,7 @@
#include <map>
#include "mc_import_rules.h"
// _S2 TOP_7
// _S2 TOP_7 ok
// create a vector for a dk combination ( ` + a -> à )
//v_dw_1D createLine(std::wstring first, std::wstring second, KMX_DWORD number, std::wstring nameresult);
v_dw_1D createLine(std::string first, std::string second, KMX_DWORD number, std::string nameresult);

View file

@ -10,7 +10,7 @@ int map_VKShiftState_to_LinModifier(int VKShiftState) {
else return VKShiftState;
}
// _S2 TOP_7
// _S2 TOP_7 ok
/*KMX_DWORD convertNamesTo_DWORD_Value(std::wstring tok_wstr) {
// more on https://manpages.ubuntu.com/manpages/jammy/man3/keysyms.3tk.html
std::map<std::wstring, KMX_DWORD > first;
@ -561,7 +561,7 @@ int split_US_To_3D_Vector(v_dw_3D &all_US,v_str_1D completeList) {
for ( int i = 1; i< (int) tokens.size();i++) {
// replace a name with a single character ( a -> a ; equal -> = )
// _S2 TOP_7
// _S2 TOP_7 ok
tokens_int = convertNamesTo_DWORD_Value(tokens[i]);
//tokens_int = convertNamesTo_DWORD_Value( wstring_from_string(tokens[i]));
@ -652,7 +652,7 @@ bool IsKeymanUsedChar(int KV) {
else
return false;
}
// _S2 TOP_7
// _S2 TOP_7 ok
std::wstring convert_DeadkeyValues_ToWstr(int in) {
if (in == 0 )
@ -884,7 +884,7 @@ KMX_DWORD KMX_get_VKUS_From_KeyCodeUnderlying(KMX_DWORD keycode) {
return 0;
}
// _S2 TOP_7
// _S2 TOP_7 ok
std::wstring CodePointToWString(unsigned int codepoint) {
std::wstring str;

View file

@ -71,7 +71,7 @@ static KMX_DWORD deadkey_min = 0xfe50;
static KMX_DWORD deadkey_max = 0xfe52; // _S2 TOP_6 TODO This has to go! my test: to only return 3 dk
int map_VKShiftState_to_LinModifier(int VKShiftState);
// _S2 TOP_7
// _S2 TOP_7 ok
// take a std::wstring (=contents of line symbols-file ) and returns the (int) value of the character
//KMX_DWORD convertNamesTo_DWORD_Value(std::wstring tok_wstr);
KMX_DWORD convertNamesTo_DWORD_Value(std::string tok_str);
@ -503,7 +503,7 @@ const UINT ScanCodeToUSVirtualKey[128] = {
bool IsKeymanUsedChar(int KV);
//------------------------------
// _S2 TOP_7
// _S2 TOP_7 ok
// take deadkey-value (e.g.65106) and return wstring (e.g. '^' )
std::wstring convert_DeadkeyValues_ToWstr(int in);
std::u16string convert_DeadkeyValues_To_U16str(int in);
@ -530,7 +530,7 @@ UINT KMX_get_KeyCodeUnderlying_From_VKUS(KMX_DWORD VirtualKeyUS);
KMX_DWORD KMX_get_VKUS_From_KeyCodeUnderlying(KMX_DWORD keycode);
// convert codePoint to wstring
// _S2 TOP_7
// _S2 TOP_7 ok
std::wstring CodePointToWString(unsigned int codepoint);
std::u16string CodePointToString_16(unsigned int codepoint);

View file

@ -75,7 +75,7 @@ int KMX_ToUnicodeEx(guint keycode, PKMX_WCHAR pwszBuff, int shift_state_pos, int
if (!(keycode <= keycode_max))
return 0;
// _S2 TOP_7
// _S2 TOP_7 ok
KMX_DWORD KeyVal= (KMX_DWORD) KMX_get_KeyVal_From_KeyCode(keymap, keycode, ShiftState(shift_state_pos), caps);
//std::wstring str = convert_DeadkeyValues_ToWstr(KeyVal);
// pwszBuff[0]= * (PKMX_WCHAR) u16string_from_wstring(str).c_str();
@ -144,7 +144,7 @@ public:
UINT SC() {
return this->m_sc;
}
// _S2 TOP_7
// _S2 TOP_7 ok
std::wstring KMX_GetShiftState(ShiftState shiftState, bool capsLock) {
return this->m_rgss[(UINT)shiftState][(capsLock ? 1 : 0)];
}
@ -168,7 +168,7 @@ public:
this->m_rgss_16[(UINT)shiftState][(capsLock ? 1 : 0)] = value;
}
// _S2 TOP_7
// _S2 TOP_7 ok
bool KMX_IsSGCAPS() {
std::wstring stBase = this->KMX_GetShiftState(Base, false); // 0,0 a 4 ß
std::wstring stShift = this->KMX_GetShiftState(Shft, false); // 1,0 A $ ?
@ -195,7 +195,7 @@ public:
(stBase.compare(stShiftCaps) != 0) && // stBase != stShiftCaps
(stShift.compare(stShiftCaps) != 0))); // stShift!= stShiftCaps
}
// _S2 TOP_7
// _S2 TOP_7 ok
bool KMX_IsCapsEqualToShift() {
std::wstring stBase = this->KMX_GetShiftState(Base, false); // 0,0 a 4 ß
std::wstring stShift = this->KMX_GetShiftState(Shft, false); // 1,0 A $ ?
@ -216,7 +216,7 @@ public:
(stBase.compare(stShift) != 0) && // stBase != stShft
(stShift.compare(stCaps) == 0)); // stShft == stCaps
}
// _S2 TOP_7
// _S2 TOP_7 ok
bool KMX_IsAltGrCapsEqualToAltGrShift() {
std::wstring stBase = this->KMX_GetShiftState(MenuCtrl, false); // 0,0
std::wstring stShift = this->KMX_GetShiftState(ShftMenuCtrl, false); // 1,0
@ -237,7 +237,7 @@ public:
(stBase.compare(stShift) != 0) && // stBase != stShft
(stShift.compare(stCaps) == 0)); // stShft == stCaps
}
// _S2 TOP_7
// _S2 TOP_7 ok
bool KMX_IsXxxxGrCapsEqualToXxxxShift() {
std::wstring stBase = this->KMX_GetShiftState(Xxxx, false);
std::wstring stShift = this->KMX_GetShiftState(ShftXxxx, false);
@ -308,7 +308,7 @@ return (
for (int caps = 0; caps <= 1; caps++) {
// _S2 TOP_7
std::wstring st = this->KMX_GetShiftState((ShiftState) ss, (caps == 1));
//std::u16string st16 = this->KMX_GetShiftState_16((ShiftState) ss, (caps == 1));
//std::u16string st = this->KMX_GetShiftState_16((ShiftState) ss, (caps == 1));
if (st.size() == 0) {
// No character assigned here
@ -356,7 +356,7 @@ return (
for (int caps = 0; caps <= 1; caps++) {
// _S2 TOP_7
std::wstring st = this->KMX_GetShiftState((ShiftState) ss, (caps == 1));
//std::u16string st_16 = this->KMX_GetShiftState_16((ShiftState) ss, (caps == 1));
//std::u16string st = this->KMX_GetShiftState_16((ShiftState) ss, (caps == 1));
PKMX_WCHAR p;
if (st.size() == 0) {
@ -527,6 +527,7 @@ bool KMX_ImportRules(LPKMX_KEYBOARD kp,v_dw_3D &All_Vector, GdkKeymap **keymap,
if(*sbBuffer == 0) {
//rgKey[iKey]->KMX_SetShiftState(ss, L"", false, (caps == 0)); // different to windows since behavior on Linux is different
rgKey[iKey]->KMX_SetShiftState(ss, u"", false, (caps));
//rgKey[iKey]->KMX_SetShiftState_16(ss, u"", false, (caps));
}
else {
if( (ss == Ctrl || ss == ShftCtrl) ) {
@ -535,12 +536,14 @@ bool KMX_ImportRules(LPKMX_KEYBOARD kp,v_dw_3D &All_Vector, GdkKeymap **keymap,
sbBuffer[rc] = 0;
//rgKey[iKey]->KMX_SetShiftState(ss, sbBuffer, false, (caps==0));
rgKey[iKey]->KMX_SetShiftState(ss, sbBuffer, false, (caps)); // different to windows since behavior on Linux is different
//rgKey[iKey]->KMX_SetShiftState_16(ss, sbBuffer, false, (caps)); // different to windows since behavior on Linux is different
}
}
else if(rc < 0) {
sbBuffer[2] = 0;
//rgKey[iKey]->SetShiftState(ss, sbBuffer, true, (caps == 0));
rgKey[iKey]->KMX_SetShiftState(ss, sbBuffer, true, (caps )); // different to windows since behavior on Linux is different
//rgKey[iKey]->KMX_SetShiftState_16(ss, sbBuffer, true, (caps )); // different to windows since behavior on Linux is different
refine_alDead(sbBuffer[0], alDead, &alDead_cpl);
}