From 0bf38e11a33005e289e30c8bc7c67563eae061be Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Wed, 7 Sep 2016 22:02:05 -0700 Subject: [PATCH] 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 --- include/wx/unix/utilsx11.h | 8 ++------ src/unix/utilsx11.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/wx/unix/utilsx11.h b/include/wx/unix/utilsx11.h index 498b22f061..d242a2e13b 100644 --- a/include/wx/unix/utilsx11.h +++ b/include/wx/unix/utilsx11.h @@ -30,13 +30,9 @@ typedef unsigned long WXKeySym; int wxCharCodeXToWX(WXKeySym keySym); WXKeySym wxCharCodeWXToX(int id); +#ifdef __WXX11__ int wxUnicodeCharXToWX(WXKeySym keySym); - -// Xlib keysym-unicode charactor pair -struct CodePair { - unsigned int keySym; - int uniChar; -}; +#endif class wxIconBundle; diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp index 3fb74fc9e3..cb2f04344a 100644 --- a/src/unix/utilsx11.cpp +++ b/src/unix/utilsx11.cpp @@ -808,12 +808,16 @@ WXKeySym wxCharCodeWXToX(int id) return keySym; } +#ifdef __WXX11__ // all Xlib keysym-unicode charactor pair that could // type from keyboard directly under variety layout // Credits: This tab just modified around a public domain keysym dataset // write by Markus G. Kuhn. See the link below. // http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt -CodePair keySymTab[] = { +static const struct { + unsigned keySym; + int uniChar; +} keySymTab[] = { {0x0020, 0x0020}, // space {0x0021, 0x0021}, // exclam {0x0022, 0x0022}, // quotedbl @@ -2507,7 +2511,7 @@ int wxUnicodeCharXToWX(WXKeySym keySym) return id; int min = 0; - int max = sizeof(keySymTab) / sizeof(CodePair) - 1; + int max = int(WXSIZEOF(keySymTab) - 1); int mid; /* also check for directly encoded 24-bit UCS characters */ @@ -2530,6 +2534,7 @@ int wxUnicodeCharXToWX(WXKeySym keySym) // no matching keycode value found return WXK_NONE; } +#endif // __WXX11__ // ---------------------------------------------------------------------------- // check current state of a key