-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8840 from keymanapp/feature/linux-mcompile-query-…
…data feat(linux): mcompile query data 🐘
- Loading branch information
Showing
14 changed files
with
2,943 additions
and
0 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Keymap | ||
|
||
Sample program that reads US basic keyboard and compares to key value group | ||
|
||
|
||
|
||
TODO check if US basic is the right Keyboard to compare with | ||
TODO non-letter characters don't work OK yet | ||
TODO Umlauts don't work OK yet | ||
TODO Check for use of correct dimensions in Vector/prevent error if dims are not correct | ||
TODO prevent crashes: handle possible Errors in CreateCompleteRow_US, Split_US_To_3D_Vector | ||
TODO check Keycode of TLDE, BKSL, LSGT | ||
TODO remove unnecessary printf/cout | ||
TODO path for xkb/symbols as compile time option in meson | ||
TODO append_other_ToVector: ensure shift states of GetKeyvalsFromKeymap are not out of range | ||
TODO check how many/which shift states we use ( at the moment we read all shiftstate-columns of US but then use only 2 colums | ||
(non-shift + shift) then use as many colums for Other ) | ||
|
||
TODO define folder to store File_US.txt" in and find better name | ||
TODO get rid of GTK functions that are deprecated and use X11 instead | ||
TODO retrieve name of Other keyboard and use appropriate name instead of "Other" | ||
TODO ... |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// In ths program we use a 3D-Vector Vector[language][Keys][Shiftstates] | ||
#pragma once | ||
|
||
#include <X11/XKBlib.h> | ||
#include <X11/Xlib.h> | ||
#include <gdk/gdk.h> | ||
|
||
#include <algorithm> | ||
#include <fstream> | ||
#include <iomanip> | ||
#include <iostream> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "mc_kmxfile.h" | ||
#include "mc_savekeyboard.h" | ||
|
||
typedef std::vector<std::string> v_str_1D; | ||
typedef std::vector<std::vector<std::string> > v_str_2D; | ||
typedef std::vector<std::vector<std::vector<std::string> > > v_str_3D; | ||
|
||
int shift_state_count = 2; // use shiftstate : no shift, shift | ||
|
||
// read configuration file, split and write to 3D-Vector (Data for US on [0][ ][ ] ) | ||
void write_US_ToVector(v_str_3D &vec, std::string language, const char *text); | ||
|
||
// 1. step: read complete Row of Configuration file US | ||
void CreateCompleteRow_US(v_str_1D &complete_List, FILE *fpp, const char *text, std::string language); | ||
|
||
// 2nd step: write contents to 3D vector | ||
void Split_US_To_3D_Vector(v_str_3D &all_US, v_str_1D completeList); | ||
|
||
// replace Name of Key (e.g. <AD06>) wih Keycode ( e.g. 15 ) | ||
int replace_PosKey_with_Keycode(std::string in); | ||
|
||
// append characters using GDK to 3D-Vector (Data for Other Language on [1][ ][ ] ) | ||
void append_other_ToVector(v_str_3D &All_Vector, GdkKeymap *keymap); | ||
|
||
// create an empty 2D vector containing "--" in all fields | ||
v_str_2D create_empty_2D(int dim_rows, int dim_shifts); | ||
|
||
// find Keyvals to fill into 2D-Vector of Other Language | ||
int GetKeyvalsFromKeymap(GdkKeymap *keymap, guint keycode, int shift_state_pos); | ||
|
||
// print both sets of characters (US and OtherLanguage) to console and file for comparison | ||
void extract_difference(v_str_3D &All_Vector); | ||
|
||
// get mapped key from Other (Other->US) | ||
std::string get_Other_Char_FromUS(std::string in, v_str_3D &All_Vector); | ||
// get mapped key from US->Other (US->Other) | ||
std::string get_US_Char_FromOther(std::string in, v_str_3D &All_Vector); | ||
// get KeyNr from US | ||
std::string getKeyNrOf_USChar(std::string in, v_str_3D &All_Vector); | ||
// get KeyNr from Other | ||
std::string getKeyNrOf_OtherChar(std::string in, v_str_3D &All_Vector); | ||
|
||
// for testing/debugging - may be deleted later | ||
// prints out a 1:1 mapping US->Other | ||
void print_simple_map_US(v_str_3D &All_Vector, int shiftstate); | ||
// prints out a 1:1 mapping Other->US | ||
void print_simple_map_Other(v_str_3D &All_Vector, int shiftstate); | ||
// test of above functions (character mapping US <-> Other; KeyNr <-> CHaracter) | ||
void test_in_out(v_str_3D &All_Vector); | ||
// testing of Vector contents ( first row of US and Other) | ||
bool test(v_str_3D &V); | ||
// writing out mapping of some characters: a,b,m,w,x,y,z | ||
void test_specific_Characters(v_str_3D &All_Vector); |
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#pragma once | ||
#include <stdint.h> | ||
|
||
#include <stdint.h> | ||
|
||
/* | ||
#if defined(_WIN32) || defined(_WIN64) | ||
#define snprintf _snprintf | ||
#define vsnprintf _vsnprintf | ||
#define strcasecmp _stricmp | ||
#define strncasecmp _strnicmp | ||
#endif | ||
*/ | ||
|
||
#if defined(__LP64__) || defined(_LP64) | ||
/* 64-bit, g++ */ | ||
#define KMX_64BIT | ||
#endif | ||
|
||
#if defined(_WIN64) && !defined(USE_64) | ||
/* 64-bit, Windows */ | ||
#define KMX_64BIT | ||
#endif | ||
|
||
typedef uint32_t KMX_DWORD; | ||
typedef int32_t KMX_BOOL; | ||
typedef uint8_t KMX_BYTE; | ||
typedef uint16_t KMX_WORD; | ||
|
||
#if defined(__cplusplus) | ||
typedef char16_t km_kbp_cp; | ||
typedef char32_t km_kbp_usv; | ||
#else | ||
typedef uint16_t km_kbp_cp; // code point | ||
typedef uint32_t km_kbp_usv; // Unicode Scalar Value | ||
#endif | ||
|
||
typedef km_kbp_cp KMX_WCHAR; // wc, 16-bit UNICODE character | ||
|
||
typedef wchar_t WCHAR; // _S2 needs to be removed/ wchart-> char16 | ||
typedef WCHAR KMX_WCHART; // _S2 needs to be removed/ wchart-> char16 | ||
typedef KMX_WCHAR* PKMX_WCHAR; // _S2 | ||
typedef wchar_t* PWSTR; // _S2 needs to be removed/ wchart-> char16 | ||
typedef PWSTR PKMX_WCHART; // _S2 needs to be removed/ wchart-> char16 | ||
|
||
typedef wchar_t* LPKMX_WCHART; // _S2 needs to be removed/ wchart-> char16 | ||
|
||
typedef char* LPSTR; // _S2 needs to be removed? | ||
typedef LPSTR LPKMX_STR; // _S2 needs to be removed? | ||
|
||
typedef uint8_t* LPBYTE; // _S2 needs to be removed/? | ||
typedef LPBYTE LPKMX_BYTE; // _S2 needs to be removed? | ||
|
||
typedef uint8_t* PBYTE; // _S2 needs to be removed/? | ||
typedef PBYTE PKMX_BYTE; // _S2 needs to be removed? | ||
|
||
// _S2 LPKEYBOARD ok to leave as is?? | ||
|
||
typedef char KMX_CHAR; // _S2 needs to be removed/? | ||
typedef char* PKMX_STR; // _S2 needs to be removed/? | ||
|
||
typedef KMX_CHAR* PKMX_CHAR; // _S2 needs to be removed/? | ||
|
||
typedef uint32_t KMX_UINT; | ||
|
||
typedef KMX_BYTE* PKMX_BYTE; | ||
typedef KMX_WORD* PKMX_WORD; | ||
typedef KMX_DWORD* PKMX_DWORD; | ||
|
||
#ifndef FALSE | ||
#define FALSE 0 | ||
#endif | ||
|
||
#ifndef TRUE | ||
#define TRUE 1 | ||
#endif | ||
|
||
// Macros and types to support char16_t vs wchar_t depending on project | ||
|
||
#ifdef USE_CHAR16_T | ||
#define lpuch(x) u ## x | ||
typedef km_kbp_cp KMX_UCHAR; | ||
#else | ||
#define lpuch(x) L ## x | ||
typedef wchar_t KMX_UCHAR; | ||
#endif | ||
|
||
typedef KMX_UCHAR* KMX_PUCHAR; |
Oops, something went wrong.