XQuartz: Blacklist some oddball legacy Mac keycodes that break wine
http://xquartz.macosforge.org/trac/ticket/295
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Kevin Van Vechten <kvv@apple.com>
(cherry picked from commit d6f160510a
)
This commit is contained in:
parent
501c0ee635
commit
af86a25009
|
@ -39,6 +39,7 @@
|
|||
|
||||
#define HACK_MISSING 1
|
||||
#define HACK_KEYPAD 1
|
||||
#define HACK_BLACKLIST 1
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
@ -83,6 +84,7 @@ enum {
|
|||
|
||||
#define UKEYSYM(u) ((u) | 0x01000000)
|
||||
|
||||
#if HACK_MISSING
|
||||
/* Table of keycode->keysym mappings we use to fallback on for important
|
||||
keys that are often not in the Unicode mapping. */
|
||||
|
||||
|
@ -117,7 +119,9 @@ const static struct {
|
|||
{107, XK_F14},
|
||||
{113, XK_F15},
|
||||
};
|
||||
#endif
|
||||
|
||||
#if HACK_KEYPAD
|
||||
/* Table of keycode->old,new-keysym mappings we use to fixup the numeric
|
||||
keypad entries. */
|
||||
|
||||
|
@ -143,6 +147,17 @@ const static struct {
|
|||
{91, XK_8, XK_KP_8},
|
||||
{92, XK_9, XK_KP_9},
|
||||
};
|
||||
#endif
|
||||
|
||||
#if HACK_BLACKLIST
|
||||
/* <rdar://problem/7824370> wine notepad produces wrong characters on shift+arrow
|
||||
* http://xquartz.macosforge.org/trac/ticket/295
|
||||
* http://developer.apple.com/legacy/mac/library/documentation/mac/Text/Text-579.html
|
||||
*
|
||||
* legacy Mac keycodes for arrow keys that shift-modify to math symbols
|
||||
*/
|
||||
const static unsigned short keycode_blacklist[] = {66, 70, 72, 77};
|
||||
#endif
|
||||
|
||||
/* Table mapping normal keysyms to their dead equivalents.
|
||||
FIXME: all the unicode keysyms (apart from circumflex) were guessed. */
|
||||
|
@ -772,32 +787,38 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
|
|||
if (k[3] == k[2]) k[3] = NoSymbol;
|
||||
if (k[1] == k[0]) k[1] = NoSymbol;
|
||||
if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
|
||||
if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol;
|
||||
}
|
||||
|
||||
#if HACK_MISSING
|
||||
/* Fix up some things that are normally missing.. */
|
||||
|
||||
if (HACK_MISSING) {
|
||||
for (i = 0; i < sizeof (known_keys) / sizeof (known_keys[0]); i++) {
|
||||
k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY;
|
||||
|
||||
if (k[0] == NoSymbol && k[1] == NoSymbol
|
||||
&& k[2] == NoSymbol && k[3] == NoSymbol)
|
||||
k[0] = known_keys[i].keysym;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof (known_keys) / sizeof (known_keys[0]); i++) {
|
||||
k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY;
|
||||
|
||||
if ( k[0] == NoSymbol && k[1] == NoSymbol
|
||||
&& k[2] == NoSymbol && k[3] == NoSymbol)
|
||||
k[0] = known_keys[i].keysym;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if HACK_KEYPAD
|
||||
/* And some more things. We find the right symbols for the numeric
|
||||
keypad, but not the KP_ keysyms. So try to convert known keycodes. */
|
||||
|
||||
if (HACK_KEYPAD) {
|
||||
for (i = 0; i < sizeof (known_numeric_keys)
|
||||
/ sizeof (known_numeric_keys[0]); i++) {
|
||||
k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
|
||||
|
||||
if (k[0] == known_numeric_keys[i].normal)
|
||||
k[0] = known_numeric_keys[i].keypad;
|
||||
}
|
||||
keypad, but not the KP_ keysyms. So try to convert known keycodes. */
|
||||
for (i = 0; i < sizeof (known_numeric_keys) / sizeof (known_numeric_keys[0]); i++) {
|
||||
k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
|
||||
|
||||
if (k[0] == known_numeric_keys[i].normal)
|
||||
k[0] = known_numeric_keys[i].keypad;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HACK_BLACKLIST
|
||||
for (i = 0; i < sizeof (keycode_blacklist) / sizeof (keycode_blacklist[0]); i++) {
|
||||
k = info->keyMap + keycode_blacklist[i] * GLYPHS_PER_KEY;
|
||||
k[0] = k[1] = k[2] = k[3] = NoSymbol;
|
||||
}
|
||||
#endif
|
||||
|
||||
DarwinBuildModifierMaps(info);
|
||||
|
||||
|
|
Loading…
Reference in New Issue