diff options
author | Felipe Heidrich <fheidric> | 2009-09-30 16:32:38 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2009-09-30 16:32:38 +0000 |
commit | 25418dc67d2f435b168d2aa817edfebdd004bfee (patch) | |
tree | d20733afb4168a92edf0a8370d7875f37cce3552 | |
parent | cc2f95700abbd562a809bcea8ecb2bfd3eb3b0db (diff) | |
download | eclipse.platform.swt-25418dc67d2f435b168d2aa817edfebdd004bfee.tar.gz eclipse.platform.swt-25418dc67d2f435b168d2aa817edfebdd004bfee.tar.xz eclipse.platform.swt-25418dc67d2f435b168d2aa817edfebdd004bfee.zip |
Bug 143911 - differentiate left and right modifier keys in keyPressed event
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java | 40 | ||||
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java | 5 |
2 files changed, 45 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java index 64dfb90ad8..be71c17daf 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java @@ -2052,6 +2052,45 @@ public class SWT { public static final int BUTTON_MASK; /** + * Keyboard event mask indicating the key event was generated by a key + * on the right side of the keyboard. (value is 1<<1). + * + * @since 3.6 + */ + public static final int LOCATION_RIGHT = 1 << 1; + + /** + * Keyboard event mask indicating the key event was generated by a key + * on the left side of the keyboard. (value is 1<<2). + * + * @since 3.6 + */ + public static final int LOCATION_LEFT = 1 << 2; + + /** + * Keyboard event mask indicating the key event was generated by a key + * on the keypad. (value is 1<<3). + * + * @since 3.6 + */ + public static final int LOCATION_KEYPAD = 1 << 3; + + /** + * Keyboard event mask indicating all possible key locations. + * + * To allow for the future, this mask is intended to be used + * in place of code that references each individual location mask. + * For example, the following expression will determine whether + * the key location is set and will continue to work as new location + * masks are added. + * + * <code>(stateMask & SWT.LOCATION_MASK) != 0</code>. + * + * @since 3.6 + */ + public static final int LOCATION_MASK; + + /** * Keyboard and/or mouse event mask indicating that the MOD1 key * was pushed on the keyboard when the event was generated. * @@ -3999,6 +4038,7 @@ static { */ BUTTON_MASK = BUTTON1 | BUTTON2 | BUTTON3 | BUTTON4 | BUTTON5; MODIFIER_MASK = ALT | SHIFT | CTRL | COMMAND; + LOCATION_MASK = LOCATION_LEFT | LOCATION_RIGHT | LOCATION_KEYPAD; /* * These values can be different on different platforms. diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java index 76cee32637..6fc606c6e5 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java @@ -159,6 +159,11 @@ public class Event { /** * depending on the event, the state of the keyboard modifier * keys and mouse masks at the time the event was generated. + * The stateMask can also contain a location mask. + * The location mask is set when the same key event can be + * generated by different keys in the keyboard. For example, + * a key down event with the keyCode equals to SWT.SHIFT can + * be generated by left and right shift keys in the keyboard. * * @see org.eclipse.swt.SWT */ |