summaryrefslogtreecommitdiff
path: root/gnu/java/awt/EventModifier.java
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2002-05-08 07:53:53 +0000
committerEric Blake <ebb9@byu.net>2002-05-08 07:53:53 +0000
commit2e0c343a9a38d616ee9d09dd07fc8b7c3e510168 (patch)
tree6d6d4b47d8a536e0dacbfefe02082ddd450fdebe /gnu/java/awt/EventModifier.java
parent0332bc01ef55cb8db0ec6f5f154230f3b3df6fcf (diff)
downloadclasspath-2e0c343a9a38d616ee9d09dd07fc8b7c3e510168.tar.gz
2002-05-08 Eric Blake <ebb9@email.byu.edu>
* configure.in: Add java/awt/dnd/peer, java/nio/charset/spi. * gnu/java/awt/EventModifier.java: New file (split from java.awt.event.InputEvent). * gnu/java/awt/Makefile.am: Add EventModifier. * gnu/java/awt/peer/gtk/GtkToolkit.java: Add missing methods. * java/nio/charset/Makefile.am (SUBDIRS): Visit spi. * java/nio/charset/spi/.cvsignore: New file. * java/nio/charset/spi/Makefile.am: New file. * java/nio/charset/spi/package.html: New file. * java/nio/charset/spi/CharsetProvider.java: New file. * java/awt/Toolkit.java: Add missing methods, some formatting. * java/awt/Window.java: Formatting. * java/awt/datatransfer/FlavorTable.java: New file. * java/awt/datatransfer/Makefile.am: Add FlavorTable. * java/awt/datatransfer/Transferable.java: Update to 1.4. * java/awt/dnd/DnDConstants.java: New file. * java/awt/dnd/DragGestureEvent.java: New file. * java/awt/dnd/DragGestureListener.java: New file. * java/awt/dnd/DragGestureRecognizer.java: New file. * java/awt/dnd/DragSource.java: New file. * java/awt/dnd/DragSourceAdapter.java: New file. * java/awt/dnd/DragSourceContext.java: New file. * java/awt/dnd/DragSourceDragEvent.java: New file. * java/awt/dnd/DragSourceEvent.java: New file. * java/awt/dnd/DragSourceListener.java: New file. * java/awt/dnd/DragSourceMotionListener.java: New file. * java/awt/dnd/InvalidDnDOperationException.java: New file. * java/awt/dnd/Makefile.am: Update for new files. * java/awt/dnd/peer/.cvsignore: New file. * java/awt/dnd/peer/DragSourceContextPeer.java: New file. * java/awt/dnd/peer/Makefile.am: New file. * java/awt/dnd/peer/package.html: New file. * java/awt/event/InputEvent.java: Update modifier handling to use gnu.java.awt.EventModifier. * java/awt/event/KeyEvent.java: Ditto. * java/awt/event/MouseEvent.java: Ditto. * java/util/Makefile.am (SUBDIRS): Alphabetize.
Diffstat (limited to 'gnu/java/awt/EventModifier.java')
-rw-r--r--gnu/java/awt/EventModifier.java107
1 files changed, 107 insertions, 0 deletions
diff --git a/gnu/java/awt/EventModifier.java b/gnu/java/awt/EventModifier.java
new file mode 100644
index 000000000..fe1a2782a
--- /dev/null
+++ b/gnu/java/awt/EventModifier.java
@@ -0,0 +1,107 @@
+/* EventModifier.java -- tool for converting modifier bits to 1.4 syle
+ Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt;
+
+import java.awt.event.InputEvent;
+
+public class EventModifier
+{
+ /** The mask for old events. */
+ public static final int OLD_MASK = 0x3f;
+
+ /** The mask for new events. */
+ public static final int NEW_MASK = 0x3fc0;
+
+ /**
+ * Non-instantiable.
+ */
+ private EventModifier()
+ {
+ throw new InternalError();
+ }
+
+ /**
+ * Converts the old style modifiers (0x3f) to the new style (0xffffffc0).
+ *
+ * @param mod the modifiers to convert
+ * @return the adjusted modifiers
+ */
+ public static int extend(int mod)
+ {
+ // Favor what we hope will be the common case.
+ if ((mod & OLD_MASK) == 0)
+ return mod;
+ if ((mod & InputEvent.SHIFT_MASK) != 0)
+ mod |= InputEvent.SHIFT_DOWN_MASK;
+ if ((mod & InputEvent.CTRL_MASK) != 0)
+ mod |= InputEvent.CTRL_DOWN_MASK;
+ if ((mod & InputEvent.META_MASK) != 0)
+ mod |= InputEvent.META_DOWN_MASK;
+ if ((mod & InputEvent.ALT_MASK) != 0)
+ mod |= InputEvent.ALT_DOWN_MASK;
+ if ((mod & InputEvent.BUTTON1_MASK) != 0)
+ mod |= InputEvent.BUTTON1_DOWN_MASK;
+ if ((mod & InputEvent.ALT_GRAPH_MASK) != 0)
+ mod |= InputEvent.ALT_GRAPH_DOWN_MASK;
+ return mod & ~OLD_MASK;
+ }
+
+ /**
+ * Converts the new style modifiers (0xffffffc0) to the old style (0x3f).
+ *
+ * @param mod the modifiers to convert
+ * @return the adjusted modifiers
+ */
+ public static int revert(int mod)
+ {
+ if ((mod & InputEvent.SHIFT_DOWN_MASK) != 0)
+ mod |= InputEvent.SHIFT_MASK;
+ if ((mod & InputEvent.CTRL_DOWN_MASK) != 0)
+ mod |= InputEvent.CTRL_MASK;
+ if ((mod & InputEvent.META_DOWN_MASK) != 0)
+ mod |= InputEvent.META_MASK;
+ if ((mod & InputEvent.ALT_DOWN_MASK) != 0)
+ mod |= InputEvent.ALT_MASK;
+ if ((mod & InputEvent.ALT_GRAPH_DOWN_MASK) != 0)
+ mod |= InputEvent.ALT_GRAPH_MASK;
+ if ((mod & InputEvent.BUTTON1_DOWN_MASK) != 0)
+ mod |= InputEvent.BUTTON1_MASK;
+ return mod & OLD_MASK;
+ }
+} // class EventModifier