commit | d994a179b5197567e616b241148afa1b93369c55 | [log] [tgz] |
---|---|---|
author | gwt.team.scottb <gwt.team.scottb@8db76d5a-ed1c-0410-87a9-c151d255dfc7> | Sat May 19 00:25:52 2007 +0000 |
committer | gwt.team.scottb <gwt.team.scottb@8db76d5a-ed1c-0410-87a9-c151d255dfc7> | Sat May 19 00:25:52 2007 +0000 |
tree | a6679c076c6a493bd30a6f7e9c3dd85e801765d2 | |
parent | fd149deeef2a860ad28cce9880f8a7aeb2eeab18 [diff] |
Fix for issue #208; adds support for determining if the meta key is pressed. Suggested by: dave.rodgman Review by: knorton git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1055 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/DOM.java b/user/src/com/google/gwt/user/client/DOM.java index cdbb821..1e01ddb 100644 --- a/user/src/com/google/gwt/user/client/DOM.java +++ b/user/src/com/google/gwt/user/client/DOM.java
@@ -436,6 +436,16 @@ } /** + * Gets whether the META key was depressed when the given event occurred. + * + * @param evt the event to be tested + * @return <code>true</code> if META was depressed when the event occurred + */ + public static boolean eventGetMetaKey(Event evt) { + return impl.eventGetMetaKey(evt); + } + + /** * Gets the velocity of the mouse wheel associated with the event along the * Y axis. * <p>
diff --git a/user/src/com/google/gwt/user/client/impl/DOMImpl.java b/user/src/com/google/gwt/user/client/impl/DOMImpl.java index a1831ba..b8f0d73 100644 --- a/user/src/com/google/gwt/user/client/impl/DOMImpl.java +++ b/user/src/com/google/gwt/user/client/impl/DOMImpl.java
@@ -83,6 +83,10 @@ return evt.which || evt.keyCode; }-*/; + public native boolean eventGetMetaKey(Event evt) /*-{ + return !!evt.getMetaKey; + }-*/; + public abstract int eventGetMouseWheelVelocityY(Event evt); public native boolean eventGetRepeat(Event evt) /*-{
diff --git a/user/src/com/google/gwt/user/client/ui/KeyboardListener.java b/user/src/com/google/gwt/user/client/ui/KeyboardListener.java index 68410dc..cecb5f5 100644 --- a/user/src/com/google/gwt/user/client/ui/KeyboardListener.java +++ b/user/src/com/google/gwt/user/client/ui/KeyboardListener.java
@@ -41,6 +41,7 @@ public static final int MODIFIER_ALT = 4; public static final int MODIFIER_CTRL = 2; + public static final int MODIFIER_META = 8; public static final int MODIFIER_SHIFT = 1; /**
diff --git a/user/src/com/google/gwt/user/client/ui/KeyboardListenerCollection.java b/user/src/com/google/gwt/user/client/ui/KeyboardListenerCollection.java index 703dfda..751e4f2 100644 --- a/user/src/com/google/gwt/user/client/ui/KeyboardListenerCollection.java +++ b/user/src/com/google/gwt/user/client/ui/KeyboardListenerCollection.java
@@ -36,6 +36,7 @@ */ public static int getKeyboardModifiers(Event event) { return (DOM.eventGetShiftKey(event) ? KeyboardListener.MODIFIER_SHIFT : 0) + | (DOM.eventGetMetaKey(event) ? KeyboardListener.MODIFIER_META : 0) | (DOM.eventGetCtrlKey(event) ? KeyboardListener.MODIFIER_CTRL : 0) | (DOM.eventGetAltKey(event) ? KeyboardListener.MODIFIER_ALT : 0); }