Cleanup of ad84d9f (r77846)

Remove the unnecessary 'CodePair' struct from a header, make the huge
keySymTab array const, and don't compile it for platforms that don't
use it, it's only used by wxX11
This commit is contained in:
Paul Cornett
2016-09-07 22:02:05 -07:00
parent a18fe083cc
commit 0bf38e11a3
2 changed files with 9 additions and 8 deletions

View File

@@ -30,13 +30,9 @@ typedef unsigned long WXKeySym;
int wxCharCodeXToWX(WXKeySym keySym); int wxCharCodeXToWX(WXKeySym keySym);
WXKeySym wxCharCodeWXToX(int id); WXKeySym wxCharCodeWXToX(int id);
#ifdef __WXX11__
int wxUnicodeCharXToWX(WXKeySym keySym); int wxUnicodeCharXToWX(WXKeySym keySym);
#endif
// Xlib keysym-unicode charactor pair
struct CodePair {
unsigned int keySym;
int uniChar;
};
class wxIconBundle; class wxIconBundle;

View File

@@ -808,12 +808,16 @@ WXKeySym wxCharCodeWXToX(int id)
return keySym; return keySym;
} }
#ifdef __WXX11__
// all Xlib keysym-unicode charactor pair that could // all Xlib keysym-unicode charactor pair that could
// type from keyboard directly under variety layout // type from keyboard directly under variety layout
// Credits: This tab just modified around a public domain keysym dataset // Credits: This tab just modified around a public domain keysym dataset
// write by Markus G. Kuhn. See the link below. // write by Markus G. Kuhn. See the link below.
// http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt // http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt
CodePair keySymTab[] = { static const struct {
unsigned keySym;
int uniChar;
} keySymTab[] = {
{0x0020, 0x0020}, // space {0x0020, 0x0020}, // space
{0x0021, 0x0021}, // exclam {0x0021, 0x0021}, // exclam
{0x0022, 0x0022}, // quotedbl {0x0022, 0x0022}, // quotedbl
@@ -2507,7 +2511,7 @@ int wxUnicodeCharXToWX(WXKeySym keySym)
return id; return id;
int min = 0; int min = 0;
int max = sizeof(keySymTab) / sizeof(CodePair) - 1; int max = int(WXSIZEOF(keySymTab) - 1);
int mid; int mid;
/* also check for directly encoded 24-bit UCS characters */ /* also check for directly encoded 24-bit UCS characters */
@@ -2530,6 +2534,7 @@ int wxUnicodeCharXToWX(WXKeySym keySym)
// no matching keycode value found // no matching keycode value found
return WXK_NONE; return WXK_NONE;
} }
#endif // __WXX11__
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// check current state of a key // check current state of a key