-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(linux): add newest changes from mnemonic layout support-mac to mnemonic layout support-linux 🐘 #12837
Merged
Merged
feat(linux): add newest changes from mnemonic layout support-mac to mnemonic layout support-linux 🐘 #12837
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9577a12
chore(linux): add changes from mcompile-mac(PR 11334) to mcompile-linux
SabineSIL e8b9da2
Merge branch 'epic/linux-mcompile' into feat/linux/mcompile-PR_11334
SabineSIL 8d62a9a
chore(linux): mcompile edit comment
SabineSIL ef71a74
chore(linux): undo mcompile edit comment
SabineSIL 1897671
chore(linux): mcompile edit comment
SabineSIL 0529946
chore(linux): mcompile more edit
SabineSIL c983380
chore(linux): change loop for filling the vector of dk triplets
SabineSIL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -20,8 +20,8 @@ KMX_BOOL KMX_DoConvert(LPKMX_KEYBOARD kbd, KMX_BOOL bDeadkeyConversion, gint arg | |||||
/** @brief Collect the key data, translate it to kmx and append to the existing keyboard */ | ||||||
bool KMX_ImportRules(LPKMX_KEYBOARD kp, vec_dword_3D& all_vector, GdkKeymap** keymap, std::vector<KMX_DeadkeyMapping>* KMX_FDeadkeys, KMX_BOOL bDeadkeyConversion); // I4353 // I4327 | ||||||
|
||||||
/** @brief return an array of [usvk, ch_out] pairs: all existing combinations of a deadkey + character for the underlying keyboard */ | ||||||
int KMX_GetDeadkeys(vec_dword_2D& dk_Table, KMX_WORD deadkey, KMX_WORD* outputPairs, GdkKeymap* keymap); | ||||||
/** @brief return a vector of [usvk, ch_out] pairs: all existing combinations of a deadkey + character for the underlying keyboard */ | ||||||
int KMX_GetDeadkeys(vec_dword_2D& dk_Table, KMX_WORD deadkey, std::vector<KMX_WORD> &dk_vec, GdkKeymap* keymap); | ||||||
|
||||||
std::vector<KMX_DeadkeyMapping> KMX_FDeadkeys; // I4353 | ||||||
|
||||||
|
@@ -94,7 +94,10 @@ std::vector<KMX_DeadkeyMapping> KMX_FDeadkeys; // I4353 | |||||
} | ||||||
|
||||||
if (KMX_DoConvert(kmxfile, bDeadkeyConversion, argc, (gchar**)argv)) { // I4552F | ||||||
KMX_SaveKeyboard(kmxfile, outfile); | ||||||
if(!KMX_SaveKeyboard(kmxfile, outfile)) { | ||||||
KMX_LogError(L"Failed to save keyboard (%d)\n", errno); | ||||||
return 3; | ||||||
} | ||||||
} | ||||||
|
||||||
delete kmxfile; | ||||||
|
@@ -358,9 +361,9 @@ KMX_WCHAR KMX_GetUniqueDeadkeyID(LPKMX_KEYBOARD kbd, KMX_WCHAR deadkey) { | |||||
return 0; | ||||||
} | ||||||
|
||||||
for (int i = 0; i < s_ndkids; i++) { | ||||||
if (s_dkids[i].src_deadkey == deadkey) { | ||||||
return s_dkids[i].dst_deadkey; | ||||||
for (int xi = 0; xi < s_ndkids; xi++) { | ||||||
if (s_dkids[xi].src_deadkey == deadkey) { | ||||||
return s_dkids[xi].dst_deadkey; | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -399,8 +402,8 @@ KMX_WCHAR KMX_GetUniqueDeadkeyID(LPKMX_KEYBOARD kbd, KMX_WCHAR deadkey) { | |||||
* @param dk_Table a vector of all possible deadkey combinations for all Linux keyboards | ||||||
*/ | ||||||
void KMX_ConvertDeadkey(LPKMX_KEYBOARD kbd, KMX_WORD vk_US, KMX_DWORD shift, KMX_WCHAR deadkey, vec_dword_3D& all_vector, GdkKeymap* keymap, vec_dword_2D dk_Table) { | ||||||
KMX_WORD deadkeys[size_DK_array] = {0}; | ||||||
KMX_WORD* pdk; | ||||||
|
||||||
std::vector<KMX_WORD> vec_deadkeys; | ||||||
|
||||||
// Lookup the deadkey table for the deadkey in the physical keyboard | ||||||
// Then for each character, go through and map it through | ||||||
|
@@ -412,13 +415,14 @@ void KMX_ConvertDeadkey(LPKMX_KEYBOARD kbd, KMX_WORD vk_US, KMX_DWORD shift, KMX | |||||
KMX_FDeadkeys.push_back(KMX_deadkeyMapping); // dkid, vk, shift); // I4353 | ||||||
KMX_AddDeadkeyRule(kbd, dkid, vk_US, shift); | ||||||
|
||||||
KMX_GetDeadkeys(dk_Table, deadkey, pdk = deadkeys, keymap); // returns array of [usvk, ch_out] pairs | ||||||
KMX_GetDeadkeys(dk_Table, deadkey, vec_deadkeys, keymap); // returns vector of [usvk, ch_out] pairs | ||||||
|
||||||
while (*pdk) { | ||||||
int n=0; | ||||||
while (n < (int)vec_deadkeys.size()) { | ||||||
// Look up the ch | ||||||
KMX_DWORD KeyValUnderlying = (KMX_DWORD) KMX_get_KeyValUnderlying_From_KeyValUS(all_vector, *pdk); | ||||||
KMX_TranslateDeadkeyKeyboard(kbd, dkid, KeyValUnderlying, *(pdk + 1), *(pdk + 2)); | ||||||
pdk += 3; | ||||||
KMX_DWORD KeyValUnderlying = (KMX_DWORD) KMX_get_KeyValUnderlying_From_KeyValUS(all_vector, vec_deadkeys[n]); | ||||||
KMX_TranslateDeadkeyKeyboard(kbd, dkid, KeyValUnderlying, vec_deadkeys[n + 1], vec_deadkeys[n + 2]); | ||||||
n += 3; | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -521,44 +525,34 @@ KMX_BOOL KMX_DoConvert(LPKMX_KEYBOARD kbd, KMX_BOOL bDeadkeyConversion, gint arg | |||||
} | ||||||
|
||||||
/** | ||||||
* @brief return an array of [usvk, ch_out] pairs: all existing combinations of a deadkey + character for the underlying keyboard | ||||||
* @brief return a vector of [usvk, ch_out] pairs: all existing combinations of a deadkey + character for the underlying keyboard | ||||||
* @param dk_Table shiftstate of the deadkey | ||||||
* @param deadkey deadkey character | ||||||
* @param[out] outputPairs pointer to array of [usvk, ch_out] pairs | ||||||
* @param[out] dk_vec vector of [usvk, ch_out] pairs | ||||||
* @param keymap pointer to the currently used (underlying) keyboard Layout | ||||||
* @return size of array of [usvk, ch_out] pairs | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Although I think it's triplets, not pairs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||
*/ | ||||||
int KMX_GetDeadkeys(vec_dword_2D& dk_Table, KMX_WORD deadkey, KMX_WORD* outputPairs, GdkKeymap* keymap) { | ||||||
KMX_WORD* p = outputPairs; | ||||||
|
||||||
int KMX_GetDeadkeys(vec_dword_2D& dk_Table, KMX_WORD deadkey, std::vector<KMX_WORD> &dk_vec, GdkKeymap* keymap) { | ||||||
|
||||||
KMX_DWORD shift; | ||||||
vec_dword_2D dk_SingleTable; | ||||||
int no_dk_counter = 0; | ||||||
int p_counter = 0; | ||||||
|
||||||
query_dk_combinations_for_specific_dk(dk_Table, deadkey, dk_SingleTable); | ||||||
for (int i = 0; i < (int)dk_SingleTable.size(); i++) { | ||||||
KMX_WORD vk = KMX_change_keyname_to_capital(dk_SingleTable[i][1], shift, keymap); | ||||||
if (vk != 0) { | ||||||
|
||||||
if( p_counter < size_DK_array - 3) { | ||||||
dk_vec.push_back(vk); | ||||||
dk_vec.push_back(shift); | ||||||
dk_vec.push_back(dk_SingleTable[i][2]); | ||||||
|
||||||
*p++ = vk; | ||||||
*p++ = shift; | ||||||
*p++ = dk_SingleTable[i][2]; | ||||||
|
||||||
p_counter = p_counter+3; | ||||||
|
||||||
} else { | ||||||
no_dk_counter++; | ||||||
} | ||||||
} else { | ||||||
KMX_LogError(L"Warning: complex deadkey not supported."); | ||||||
} | ||||||
} | ||||||
if(p_counter >= size_DK_array -3) | ||||||
KMX_LogError(L"Warning: %i deadkeys have not been processed.", no_dk_counter); | ||||||
*p = 0; | ||||||
return (p - outputPairs); | ||||||
|
||||||
return dk_vec.size(); | ||||||
} | ||||||
|
||||||
/** | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
since we're accessing
vec_deadkeys[n+2]
(andn+1
)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, its the same thing since we work with a set of 3 elements each ( vec_deadkeys is always a multiple of 3 in size) and then we do
n += 3;
further downvec_deadkeys.size()-2
andvec_deadkeys.size()
would stop the loop after the same amount of loopsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true, and it works. However, using
vec_deadkeys.size() - 2
doesn't change anything in the way the current code works, but it would be a sign of defensive programming.