FILE COMPARISON
Produced: 2/18/2011 1:54:16 AM
   
Mode:  All Lines  
Left base folder: C:\Documents and Settings\krollins\My Documents\Admin\OpenSource\eRCP\eSWT\eSWT-1.2.orig  
Right base folder: C:\Documents and Settings\krollins\My Documents\Admin\OpenSource\eRCP\eSWT\eSWT-1.2.today  
   
File: org.eclipse.ercp.swt.core.win\win-native\include\KeyUtils.h  
1 /******************************************************************************* = 1 /*******************************************************************************
2 * Copyright (c) 2000, 2005 IBM Corporation and others.   2 * Copyright (c) 2000, 2005 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials   3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0   4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at   5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html   6 * http://www.eclipse.org/legal/epl-v10.html
7 *   7 *
8 * Contributors:   8 * Contributors:
9 *     IBM Corporation - initial API and implementation   9 *     IBM Corporation - initial API and implementation
10 *******************************************************************************/   10 *******************************************************************************/
    <> 11  
      12 /*******************************************************************************
      13 * Additions/modifications to this source file by Oracle America, Inc. 2011
      14 *******************************************************************************/
      15  
11 #ifndef __KEYUTILS_H__ = 16 #ifndef __KEYUTILS_H__
12 #define __KEYUTILS_H__   17 #define __KEYUTILS_H__
13     18  
14 #include <windows.h>   19 #include <windows.h>
15 #include "UGL_Constants.h"   20 #include "UGL_Constants.h"
16     21  
17 /*   22 /*
18 * This KeyTable makes it possible to translate control keys to their   23 * This KeyTable makes it possible to translate control keys to their
19 * appropriate UGL mappings.   24 * appropriate UGL mappings.
20 * I'm not sure that this is the best place for this, but I can't think of   25 * I'm not sure that this is the best place for this, but I can't think of
21 * anywhere better. I also don't know if any memory management issues are   26 * anywhere better. I also don't know if any memory management issues are
22 * presented by this declaration.   27 * presented by this declaration.
23 */   28 */
24 static const int KeyTableSize = 54;   29 static const int KeyTableSize = 54;
25 static const int KeyTable[][2] = {   30 static const int KeyTable[][2] = {
26       31    
27     /* Keyboard and Mouse Masks */   32     /* Keyboard and Mouse Masks */
28     { VK_MENU,      UGL_KEYCODE_ALT },   33     { VK_MENU,      UGL_KEYCODE_ALT },
29     { VK_SHIFT,     UGL_KEYCODE_SHIFT },   34     { VK_SHIFT,     UGL_KEYCODE_SHIFT },
30     { VK_CONTROL,   UGL_KEYCODE_CONTROL },   35     { VK_CONTROL,   UGL_KEYCODE_CONTROL },
31 //  { VK_????,      UGL_KEYCODE_COMMAND },   36 //  { VK_????,      UGL_KEYCODE_COMMAND },
32     37  
33     /* Coppied from SWT but not currently used by us or them */   38     /* Coppied from SWT but not currently used by us or them */
34 //  { VK_LBUTTON,   UGL_KEYCODE_BUTTON1 },   39 //  { VK_LBUTTON,   UGL_KEYCODE_BUTTON1 },
35 //  { VK_MBUTTON,   UGL_KEYCODE_BUTTON3 },   40 //  { VK_MBUTTON,   UGL_KEYCODE_BUTTON3 },
36 //  { VK_RBUTTON,   UGL_KEYCODE_BUTTON2 },   41 //  { VK_RBUTTON,   UGL_KEYCODE_BUTTON2 },
37     42  
38       43    
39     /* Non-Numeric Keypad Keys */   44     /* Non-Numeric Keypad Keys */
40     { VK_UP,        UGL_KEYCODE_ARROW_UP },   45     { VK_UP,        UGL_KEYCODE_ARROW_UP },
41     { VK_DOWN,      UGL_KEYCODE_ARROW_DOWN },   46     { VK_DOWN,      UGL_KEYCODE_ARROW_DOWN },
42     { VK_LEFT,      UGL_KEYCODE_ARROW_LEFT },   47     { VK_LEFT,      UGL_KEYCODE_ARROW_LEFT },
43     { VK_RIGHT,     UGL_KEYCODE_ARROW_RIGHT },   48     { VK_RIGHT,     UGL_KEYCODE_ARROW_RIGHT },
44     { VK_PRIOR,     UGL_KEYCODE_PAGE_UP },   49     { VK_PRIOR,     UGL_KEYCODE_PAGE_UP },
45     { VK_NEXT,      UGL_KEYCODE_PAGE_DOWN },   50     { VK_NEXT,      UGL_KEYCODE_PAGE_DOWN },
46     { VK_HOME,      UGL_KEYCODE_HOME },   51     { VK_HOME,      UGL_KEYCODE_HOME },
47     { VK_END,       UGL_KEYCODE_END },   52     { VK_END,       UGL_KEYCODE_END },
48     { VK_INSERT,    UGL_KEYCODE_INSERT },   53     { VK_INSERT,    UGL_KEYCODE_INSERT },
49     54  
50     /* Virtual and ASCII Keys */   55     /* Virtual and ASCII Keys */
51     { VK_BACK,      UGL_KEYCODE_BACKSPACE },   56     { VK_BACK,      UGL_KEYCODE_BACKSPACE },
52 //  { VK_RETURN,    UGL_KEYCODE_CR }, //we don't have a CR, I think this might be ENTER   57 //  { VK_RETURN,    UGL_KEYCODE_CR }, //we don't have a CR, I think this might be ENTER
53     { VK_RETURN,    UGL_KEYCODE_ENTER }, //just a guess   58     { VK_RETURN,    UGL_KEYCODE_ENTER }, //just a guess
54     { VK_DELETE,    UGL_KEYCODE_DELETE },   59     { VK_DELETE,    UGL_KEYCODE_DELETE },
55     { VK_ESCAPE,    UGL_KEYCODE_ESCAPE },   60     { VK_ESCAPE,    UGL_KEYCODE_ESCAPE },
56 //  { VK_RETURN,    UGL_KEYCODE_LF }, //we don't have a LF....   61 //  { VK_RETURN,    UGL_KEYCODE_LF }, //we don't have a LF....
57     { VK_TAB,       UGL_KEYCODE_TAB },   62     { VK_TAB,       UGL_KEYCODE_TAB },
58     63  
59     /* Function Keys */   64     /* Function Keys */
60     { VK_F1,        UGL_KEYCODE_F1 },   65     { VK_F1,        UGL_KEYCODE_F1 },
61     { VK_F2,        UGL_KEYCODE_F2 },   66     { VK_F2,        UGL_KEYCODE_F2 },
62     { VK_F3,        UGL_KEYCODE_F3 },   67     { VK_F3,        UGL_KEYCODE_F3 },
63     { VK_F4,        UGL_KEYCODE_F4 },   68     { VK_F4,        UGL_KEYCODE_F4 },
64     { VK_F5,        UGL_KEYCODE_F5 },   69     { VK_F5,        UGL_KEYCODE_F5 },
65     { VK_F6,        UGL_KEYCODE_F6 },   70     { VK_F6,        UGL_KEYCODE_F6 },
66     { VK_F7,        UGL_KEYCODE_F7 },   71     { VK_F7,        UGL_KEYCODE_F7 },
67     { VK_F8,        UGL_KEYCODE_F8 },   72     { VK_F8,        UGL_KEYCODE_F8 },
68     { VK_F9,        UGL_KEYCODE_F9 },   73     { VK_F9,        UGL_KEYCODE_F9 },
69     { VK_F10,       UGL_KEYCODE_F10 },   74     { VK_F10,       UGL_KEYCODE_F10 },
70     { VK_F11,       UGL_KEYCODE_F11 },   75     { VK_F11,       UGL_KEYCODE_F11 },
71     { VK_F12,       UGL_KEYCODE_F12 },   76     { VK_F12,       UGL_KEYCODE_F12 },
72     { VK_F13,       UGL_KEYCODE_F13 },   77     { VK_F13,       UGL_KEYCODE_F13 },
73     { VK_F14,       UGL_KEYCODE_F14 },   78     { VK_F14,       UGL_KEYCODE_F14 },
74     { VK_F15,       UGL_KEYCODE_F15 },   79     { VK_F15,       UGL_KEYCODE_F15 },
75       80    
76     /* Numeric Keypad Keys */   81     /* Numeric Keypad Keys */
77     { VK_MULTIPLY,  UGL_KEYCODE_KEYPAD_MULTIPLY },   82     { VK_MULTIPLY,  UGL_KEYCODE_KEYPAD_MULTIPLY },
78     { VK_ADD,       UGL_KEYCODE_KEYPAD_ADD },   83     { VK_ADD,       UGL_KEYCODE_KEYPAD_ADD },
79     { VK_RETURN,    UGL_KEYCODE_KEYPAD_ENTER }, //SWT maps to SWT.KEYPAD_CR   84     { VK_RETURN,    UGL_KEYCODE_KEYPAD_ENTER }, //SWT maps to SWT.KEYPAD_CR
80     { VK_SUBTRACT,  UGL_KEYCODE_KEYPAD_SUBTRACT },   85     { VK_SUBTRACT,  UGL_KEYCODE_KEYPAD_SUBTRACT },
81     { VK_DECIMAL,   UGL_KEYCODE_KEYPAD_DECIMAL },   86     { VK_DECIMAL,   UGL_KEYCODE_KEYPAD_DECIMAL },
82     { VK_DIVIDE,    UGL_KEYCODE_KEYPAD_DIVIDE },   87     { VK_DIVIDE,    UGL_KEYCODE_KEYPAD_DIVIDE },
83     { VK_NUMPAD0,   UGL_KEYCODE_KEYPAD_0 },   88     { VK_NUMPAD0,   UGL_KEYCODE_KEYPAD_0 },
84     { VK_NUMPAD1,   UGL_KEYCODE_KEYPAD_1 },   89     { VK_NUMPAD1,   UGL_KEYCODE_KEYPAD_1 },
85     { VK_NUMPAD2,   UGL_KEYCODE_KEYPAD_2 },   90     { VK_NUMPAD2,   UGL_KEYCODE_KEYPAD_2 },
86     { VK_NUMPAD3,   UGL_KEYCODE_KEYPAD_3 },   91     { VK_NUMPAD3,   UGL_KEYCODE_KEYPAD_3 },
87     { VK_NUMPAD4,   UGL_KEYCODE_KEYPAD_4 },   92     { VK_NUMPAD4,   UGL_KEYCODE_KEYPAD_4 },
88     { VK_NUMPAD5,   UGL_KEYCODE_KEYPAD_5 },   93     { VK_NUMPAD5,   UGL_KEYCODE_KEYPAD_5 },
89     { VK_NUMPAD6,   UGL_KEYCODE_KEYPAD_6 },   94     { VK_NUMPAD6,   UGL_KEYCODE_KEYPAD_6 },
90     { VK_NUMPAD7,   UGL_KEYCODE_KEYPAD_7 },   95     { VK_NUMPAD7,   UGL_KEYCODE_KEYPAD_7 },
91     { VK_NUMPAD8,   UGL_KEYCODE_KEYPAD_8 },   96     { VK_NUMPAD8,   UGL_KEYCODE_KEYPAD_8 },
92     { VK_NUMPAD9,   UGL_KEYCODE_KEYPAD_9 },   97     { VK_NUMPAD9,   UGL_KEYCODE_KEYPAD_9 },
93 //  { VK_????,      UGL_KEYPAD_EQUAL }, //Coppied over from SWT just for reference   98 //  { VK_????,      UGL_KEYPAD_EQUAL }, //Coppied over from SWT just for reference
94       99    
95     /* Other Keys */   100     /* Other Keys */
96     { VK_CAPITAL,   UGL_KEYCODE_LOCK_CAPS },   101     { VK_CAPITAL,   UGL_KEYCODE_LOCK_CAPS },
97     { VK_NUMLOCK,   UGL_KEYCODE_LOCK_NUM },   102     { VK_NUMLOCK,   UGL_KEYCODE_LOCK_NUM },
98     { VK_SCROLL,    UGL_KEYCODE_LOCK_SCROLL },   103     { VK_SCROLL,    UGL_KEYCODE_LOCK_SCROLL },
99     { VK_PAUSE,     UGL_KEYCODE_PAUSE },   104     { VK_PAUSE,     UGL_KEYCODE_PAUSE },
100     { VK_CANCEL,    UGL_KEYCODE_END }, //SWT uses SWT.BREAK here   105     { VK_CANCEL,    UGL_KEYCODE_END }, //SWT uses SWT.BREAK here
101     { VK_SNAPSHOT,  UGL_KEYCODE_PRINTSCREEN },   106     { VK_SNAPSHOT,  UGL_KEYCODE_PRINTSCREEN },
102 //  { VK_????,      UGL_KEYCODE_HELP }, //Coppied over from SWT just for reference   107 //  { VK_????,      UGL_KEYCODE_HELP }, //Coppied over from SWT just for reference
103 };   108 };
104     109  
    <> 110 #ifndef _WIN32_WCE
      111     // no need for extra fixup
      112 #else
      113 /*
      114 * Taken from http://msdn.microsoft.com/en-us/library/bb431750.aspx
      115 */
      116 #define VK_SHIFT 0x10
      117 #define VK_CTRL 0x11
      118 #define VK_ALT 0x12
      119 #define VK_UP 0x26
      120 #define VK_DOWN 0x28
      121 #define VK_TAB 0x09
      122 #define VK_OEM_1 0xBA
      123 #define VK_ESCAPE 0x1B
      124 #define VK_OEM_PLUS 0xBB
      125 #define VK_OEM_COMMA 0xBC
      126 #define VK_OEM_MINUS 0xBD
      127 #define VK_OEM_PERIOD 0xBE
      128 #define VK_OEM_2 0xBF
      129 #define VK_OEM_3 0xC0
      130 #define VK_OEM_4 0xDB
      131 #define VK_OEM_5 0xDC
      132 #define VK_OEM_6 0xDD
      133 #define VK_OEM_7 0xDE
      134 #define VK_OEM_8 0xDF
      135 #define VK_OEM_102 0xE2
      136  
      137 static const int WMKeyTableSize = 12;
      138 static const int WMKeyTable[][2] = {   
      139     { VK_OEM_1, ';' },
      140     { VK_OEM_PLUS, '+' },
      141     { VK_OEM_PLUS, '=' },
      142     { VK_OEM_COMMA , ',' },
      143     { VK_OEM_MINUS, '-' },
      144     { VK_OEM_PERIOD, '.' },
      145     { VK_OEM_2, '/' },
      146     { VK_OEM_3, '`' },
      147     { VK_OEM_4, '[' },
      148     { VK_OEM_5, '\\' },
      149     { VK_OEM_6, ']' },
      150     { VK_OEM_7, '\'' },
      151 };
      152 #endif // #ifndef _WIN32_WCE
      153  
105 /** = 154 /**
106 * This method converts the incomming UGL keycode to be a native   155 * This method converts the incomming UGL keycode to be a native
107 * VK_* keycode.   156 * VK_* keycode.
108 */   157 */
109 int KeyUtils_ConvertToNativeKeycode(int keycode);   158 int KeyUtils_ConvertToNativeKeycode(int keycode);
110     159  
111 #endif /* __KEYUTILS_H__ */   160 #endif /* __KEYUTILS_H__ */