Changeset 4574 in vbox for trunk/src/VBox
- Timestamp:
- Sep 6, 2007 2:33:17 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 24198
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/linux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/linux/keyboard.c
r3976 r4574 23 23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 24 24 */ 25 /* our master define to make this module usable outside wine */ 26 25 26 /* our master define to make this module usable outside of Wine */ 27 27 #define OUTOFWINE 28 28 … … 136 136 /* a s d f g h j k l ; ' \ */ 137 137 0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x2B, 138 #ifndef OUTOFWINE 138 139 /* \ z x c v b n m , . / */ 139 140 0x5e,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35, 140 141 0x56, /* the 102nd key (actually to the right of l-shift) */ 141 }; 142 142 #else 143 /* innotek FIX */ 144 /* \ z x c v b n m , . / */ 145 0x56,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35, 146 0x73, /* the extra key on the Brazilian keyboard. */ 147 #endif 148 }; 149 150 #ifndef OUTOFWINE 151 /* innotek FIX - a dvorak keyboard uses standard scan codes. */ 143 152 static const WORD main_key_scan_dvorak[MAIN_LEN] = 144 153 { … … 153 162 0x56 /* the 102nd key (actually to the right of l-shift) */ 154 163 }; 155 164 #endif 165 166 #ifdef OUTOFWINE 167 /* What is this supposed to be? This is just the same as the qwerty layout, with one key 168 in a different place. */ 169 #endif 156 170 static const WORD main_key_scan_qwerty_jp106[MAIN_LEN] = 157 171 { … … 300 314 }; 301 315 316 #ifdef OUTOFWINE 317 /* innotek FIX */ 318 /*** United States keyboard layout (dvorak version with phantom key) */ 319 static const char main_key_US_dvorak_phantom[MAIN_LEN][4] = 320 { 321 "`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","[{","]}", 322 "'\"",",<",".>","pP","yY","fF","gG","cC","rR","lL","/?","=+", 323 "aA","oO","eE","uU","iI","dD","hH","tT","nN","sS","-_","\\|", 324 ";:","qQ","jJ","kK","xX","bB","mM","wW","vV","zZ", 325 "<>" /* the phantom key */ 326 }; 327 #endif 328 302 329 /*** British keyboard layout */ 303 330 static const char main_key_UK[MAIN_LEN][4] = … … 603 630 static const char main_key_BE[MAIN_LEN][4] = 604 631 { 632 #ifndef OUTOFWINE 605 633 "","&1|","é2@","\"3#","'4","(5","§6^","è7","!8","ç9{","à0}",")°","-_", 606 634 "aA","zZ","eE¤","rR","tT","yY","uU","iI","oO","pP","^¨[","$*]", … … 608 636 "wW","xX","cC","vV","bB","nN",",?",";.",":/","=+~", 609 637 "<>\\" 638 #else 639 /* innotek FIX */ 640 /* I wonder how much of this Wine code has been properly tested? There are many 641 seemingly duplicate layouts, and while many specify three or four keysyms per 642 key, the code choked on all keys in this layout containing more than two 643 keysyms. I suspect that many of these maps only work by luck. */ 644 "²³","&1","é2","\"3","'4","(5","§6","è7","!8","ç9","à0",")°","-_", 645 "aA","zZ","eE","rR","tT","yY","uU","iI","oO","pP","^¨","$*", 646 "qQ","sS","dD","fF","gG","hH","jJ","kK","lL","mM","ù%","µ£", 647 "wW","xX","cC","vV","bB","nN",",?",";.",":/","=+", 648 "<>" 649 #endif 610 650 }; 611 651 … … 718 758 }; 719 759 760 #ifndef OUTOFWINE 720 761 /*** US international keyboard layout (contributed by Gustavo Noronha ([email protected])) */ 721 762 static const char main_key_US_intl[MAIN_LEN][4] = … … 726 767 "zZ", "xX", "cC", "vV", "bB", "nN", "mM", ",<", ".>", "/?" 727 768 }; 769 #else 770 /* innotek FIX */ 771 /*** US international keyboard layout (contributed by Gustavo Noronha ([email protected])) */ 772 static const char main_key_US_intl[MAIN_LEN][4] = 773 { 774 "`~", "1!", "2@", "3#", "4$", "5%", "6^", "7&", "8*", "9(", "0)", "-_", "=+", 775 "qQ", "wW", "eE", "rR", "tT", "yY", "uU", "iI", "oO", "pP", "[{", "]}", 776 "aA", "sS", "dD", "fF", "gG", "hH", "jJ", "kK", "lL", ";:", "´¨", 777 "\\|", "zZ", "xX", "cC", "vV", "bB", "nN", "mM", ",<", ".>", "/?" 778 }; 779 780 /*** US international keyboard layout with phantom key (contributed by Gustavo Noronha ([email protected])) */ 781 static const char main_key_US_intl_phantom[MAIN_LEN][4] = 782 { 783 "`~", "1!", "2@", "3#", "4$", "5%", "6^", "7&", "8*", "9(", "0)", "-_", "=+", 784 "qQ", "wW", "eE", "rR", "tT", "yY", "uU", "iI", "oO", "pP", "[{", "]}", 785 "aA", "sS", "dD", "fF", "gG", "hH", "jJ", "kK", "lL", ";:", "´¨", 786 "\\|", "zZ", "xX", "cC", "vV", "bB", "nN", "mM", ",<", ".>", "/?", 787 "<>" /* the phantom key */ 788 }; 789 #endif 728 790 729 791 /*** Slovak keyboard layout (see cssk_ibm(sk_qwerty) in xkbsel) … … 923 985 {0x0409, "United States keyboard layout", &main_key_US, &main_key_scan_qwerty, &main_key_vkey_qwerty}, 924 986 {0x0409, "United States keyboard layout (phantom key version)", &main_key_US_phantom, &main_key_scan_qwerty, &main_key_vkey_qwerty}, 987 #ifndef OUTOFWINE 925 988 {0x0409, "United States keyboard layout (dvorak)", &main_key_US_dvorak, &main_key_scan_dvorak, &main_key_vkey_dvorak}, 926 989 {0x0409, "United States International keyboard layout", &main_key_US_intl, &main_key_scan_qwerty, &main_key_vkey_qwerty}, 990 #else 991 /* innotek FIX */ 992 {0x0409, "United States keyboard layout (dvorak)", &main_key_US_dvorak, &main_key_scan_qwerty, &main_key_vkey_dvorak}, 993 {0x0409, "United States keyboard layout (dvorak, phantom key version)", &main_key_US_dvorak_phantom, &main_key_scan_qwerty, &main_key_vkey_dvorak}, 994 {0x0409, "United States International keyboard layout", &main_key_US_intl, &main_key_scan_qwerty, &main_key_vkey_qwerty}, 995 {0x0409, "United States International keyboard layout (phantom key version)", &main_key_US_intl_phantom, &main_key_scan_qwerty, &main_key_vkey_qwerty}, 996 #endif 927 997 {0x0809, "British keyboard layout", &main_key_UK, &main_key_scan_qwerty, &main_key_vkey_qwerty}, 928 998 {0x0407, "German keyboard layout", &main_key_DE, &main_key_scan_qwerty, &main_key_vkey_qwertz}, … … 1070 1140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF58 */ 1071 1141 /* misc keys */ 1072 /*?*/ 0, 0x137, /*?*/ 0, 0x152, 0x00, 0x00, 0x00, 0x15D, /* FF60 */ 1142 #ifdef OUTOFWINE 1143 /* innotek FIX */ 1144 /*?*/ 0, 0x137, /*?*/ 0, 0x152, 0x00, 0x00, 0x00, 0x15D, /* FF60 */ 1145 #else 1146 /*?*/ 0, 0x137, /*?*/ 0, 0x152, 0x00, 0x00, 0x00, 0x00, /* FF60 */ 1147 #endif 1073 1148 /*?*/ 0, /*?*/ 0, 0x38, 0x146, 0x00, 0x00, 0x00, 0x00, /* FF68 */ 1074 1149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF70 */ … … 1080 1155 0x4D, 0x50, 0x49, 0x51, 0x4F, 0x4C, 0x52, 0x53, /* FF98 */ 1081 1156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFA0 */ 1157 #ifdef OUTOFWINE 1158 /* innotek FIX */ 1159 0x00, 0x00, 0x37, 0x4E, 0x53, 0x4A, 0x7e, 0x135, /* FFA8 */ 1160 #else 1082 1161 0x00, 0x00, 0x37, 0x4E, 0x53, 0x4A, 0x53, 0x135, /* FFA8 */ 1162 #endif 1083 1163 0x52, 0x4F, 0x50, 0x51, 0x4B, 0x4C, 0x4D, 0x47, /* FFB0 */ 1084 1164 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, /* FFB8 */ … … 1091 1171 /* modifier keys */ 1092 1172 0x00, 0x2A, 0x36, 0x1D, 0x11D, 0x3A, 0x00, 0x38, /* FFE0 */ 1093 0x138, 0x38, 0x138, 0x15B, 0x15C, 0x00, 0x00, 0x00, /* FFE8 */ 1173 #ifdef OUTOFWINE 1174 /* innotek FIX */ 1175 0x138, 0x38, 0x138, 0x15B, 0x15C, 0x00, 0x00, 0x00, /* FFE8 */ 1176 #else 1177 0x138, 0x38, 0x138, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFE8 */ 1178 #endif 1094 1179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFF0 */ 1095 1180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x153 /* FFF8 */ 1096 1181 }; 1097 1182 1183 #ifndef OUTOFWINE 1098 1184 static const WORD xfree86_vendor_key_vkey[256] = 1099 1185 { … … 1135 1221 0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */ 1136 1222 }; 1223 #else /* OUTOFWINE defined */ 1224 /* innotek FIX */ 1225 /* This list was put together using /usr/include/X11/XF86keysym.h and 1226 http://www.win.tue.nl/~aeb/linux/kbd/scancodes-6.html. It has not yet 1227 been extensively tested. The scancodes are those used by MicroSoft 1228 keyboards. */ 1229 static const WORD xfree86_vendor_key_scan[256] = 1230 { 1231 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF00 */ 1232 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF08 */ 1233 /* Vol- Mute Vol+ Play Stop Track- Track+ */ 1234 0, 0x12e, 0x120, 0x130, 0x122, 0x124, 0x110, 0x119, /* 1008FF10 */ 1235 /* Home E-mail Search */ 1236 0x132, 0x16c, 0, 0x165, 0, 0, 0, 0, /* 1008FF18 */ 1237 /* Calndr PwrDown Back Forward */ 1238 0x115, 0x15e, 0, 0, 0, 0, 0x16a, 0x169, /* 1008FF20 */ 1239 /* Stop Refresh Power Wake Sleep */ 1240 0x168, 0x167, 0x15e, 0x163, 0, 0, 0, 0x15f, /* 1008FF28 */ 1241 /* Favrts Pause Media MyComp */ 1242 0x166, 0x122, 0x16d, 0x16b, 0, 0, 0, 0, /* 1008FF30 */ 1243 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF38 */ 1244 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF40 */ 1245 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF48 */ 1246 /* AppL AppR Calc Close Copy */ 1247 0x109, 0x11e, 0, 0, 0x121, 0, 0x140, 0x118, /* 1008FF50 */ 1248 /* Cut Docmnts Excel */ 1249 0x117, 0, 0, 0x105, 0x114, 0, 0, 0, /* 1008FF58 */ 1250 /* LogOff */ 1251 0, 0x116, 0, 0, 0, 0, 0, 0, /* 1008FF60 */ 1252 /* OffcHm Open Paste */ 1253 0, 0, 0x13c, 0x13f, 0, 0x10a, 0, 0, /* 1008FF68 */ 1254 /* Reply Refresh Save */ 1255 0, 0, 0x141, 0x167, 0, 0, 0, 0x157, /* 1008FF70 */ 1256 /* ScrlUp ScrlDn Send Spell TaskPane */ 1257 0x10b, 0x18b, 0, 0x143, 0x123, 0, 0, 0x13d, /* 1008FF78 */ 1258 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF80 */ 1259 /* Word */ 1260 0, 0x113, 0, 0, 0, 0, 0, 0, /* 1008FF88 */ 1261 /* MailFwd MyPics MyMusic*/ 1262 0x142, 0x164, 0x13c, 0, 0, 0, 0, 0, /* 1008FF90 */ 1263 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF98 */ 1264 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFA0 */ 1265 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFA8 */ 1266 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFB0 */ 1267 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFB8 */ 1268 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFC0 */ 1269 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFC8 */ 1270 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFD0 */ 1271 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFD8 */ 1272 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFE0 */ 1273 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFE8 */ 1274 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFF0 */ 1275 0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */ 1276 }; 1277 #endif /* OUTOFWINE defined */ 1137 1278 1138 1279 #ifndef OUTOFWINE … … 1520 1661 int max_score = 0, ismatch = 0; 1521 1662 char ckey[256][4]; 1663 #ifdef OUTOFWINE 1664 /* innotek FIX */ 1665 /* The Wine algorithm is incapable of distinguishing the dvorak and the querty layout, 1666 which have the same keys in a different sequence. Based on the assumption that 1667 scan codes are laid out more or less sequentially, we keep a track of how many 1668 of our detected scan codes are out of order as an additional matching criterium. */ 1669 int misorder, last_match, least_misorder = 256; 1670 #endif 1522 1671 1523 1672 syms = keysyms_per_keycode; … … 1561 1710 lkey = main_key_tab[current].key; 1562 1711 pkey = -1; 1712 #ifdef OUTOFWINE 1713 /* innotek FIX - dvorak layout */ 1714 last_match = 0; 1715 misorder = 0; 1716 #endif 1563 1717 for (keyc = min_keycode; keyc <= max_keycode; keyc++) { 1564 1718 if (ckey[keyc][0]) { … … 1577 1731 if (ok > 0) { 1578 1732 score += ok; 1733 #ifdef OUTOFWINE 1734 /* innotek FIX - dvorak layout */ 1735 if (key < last_match) 1736 { 1737 ++misorder; 1738 } 1739 last_match = key; 1740 #endif 1579 1741 break; 1580 1742 } … … 1597 1759 } 1598 1760 } 1761 #ifndef OUTOFWINE 1599 1762 TRACE("matches=%d, mismatches=%d, seq=%d, score=%d\n", 1600 1763 match, mismatch, seq, score); 1601 1764 if ((score > max_score) || 1602 1765 ((score == max_score) && (seq > max_seq))) { 1766 #else 1767 /* innotek FIX - dvorak layout */ 1768 TRACE("matches=%d, mismatches=%d, seq=%d, score=%d, misorder = %d\n", 1769 match, mismatch, seq, score, misorder); 1770 if ((score > max_score) || 1771 ((score == max_score) && (seq > max_seq)) || 1772 ((score == max_score) && (seq == max_seq) && 1773 (misorder < least_misorder))) { 1774 #endif 1603 1775 /* best match so far */ 1604 1776 kbd_layout = current; … … 1606 1778 max_seq = seq; 1607 1779 ismatch = !mismatch; 1780 #ifdef OUTOFWINE 1781 /* innotek FIX - dvorak layout */ 1782 least_misorder = misorder; 1783 #endif 1608 1784 } 1609 1785 } … … 1728 1904 vkey |= 0x100; 1729 1905 #else 1730 /* @michael: this needs to be investigated and improved on. */ 1731 scan = 0x100; 1906 /* innotek FIX - multimedia/internet keys */ 1907 /* @michael: this needs to be tested and completed some day. */ 1908 scan = xfree86_vendor_key_scan[keysym & 0xff]; 1732 1909 #endif 1733 1910 } else if (keysym == 0x20) { /* Spacebar */ … … 1737 1914 scan = 0x39; 1738 1915 #ifdef OUTOFWINE 1916 /* innotek FIX - AltGr support */ 1739 1917 } else if (keysym == 0xFE03) { /* ISO level3 shift, aka AltGr */ 1740 1918 scan = 0x138; -
trunk/src/VBox/Frontends/VirtualBox/src/linux/keyboard_outofwine.h
r3948 r4574 70 70 71 71 /* debug macros */ 72 #if 0 73 # include <stdio.h> 74 # define noop printf 75 #else 72 76 inline static void noop(char *arg, ...) 73 77 { 74 78 } 79 #endif 75 80 76 81 #define TRACE noop
Note:
See TracChangeset
for help on using the changeset viewer.