summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/java/awt/event
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/awt/event')
-rw-r--r--libjava/classpath/java/awt/event/InputEvent.java41
-rw-r--r--libjava/classpath/java/awt/event/InvocationEvent.java25
-rw-r--r--libjava/classpath/java/awt/event/KeyEvent.java2
-rw-r--r--libjava/classpath/java/awt/event/MouseEvent.java23
4 files changed, 64 insertions, 27 deletions
diff --git a/libjava/classpath/java/awt/event/InputEvent.java b/libjava/classpath/java/awt/event/InputEvent.java
index 8f9aed611f8..28cd9018599 100644
--- a/libjava/classpath/java/awt/event/InputEvent.java
+++ b/libjava/classpath/java/awt/event/InputEvent.java
@@ -197,17 +197,28 @@ public abstract class InputEvent extends ComponentEvent
private final long when;
/**
- * The modifiers in effect for this event. Package visible for use by
- * subclasses. The old style (bitmask 0x3f) should not be mixed with the
- * new style (bitmasks 0xffffffc0).
+ * The old-style modifiers in effect for this event. Package visible
+ * for use by subclasses. The old style (bitmask 0x3f) should not be
+ * mixed with the new style (bitmasks 0xffffffc0).
*
* @see #getModifiers()
* @see MouseEvent
- * @serial the modifier state, stored in the new style
+ * @serial the modifier state, stored in the old style
*/
int modifiers;
/**
+ * The new-style modifiers in effect for this event. Package visible
+ * for use by subclasses. The old style (bitmask 0x3f) should not be
+ * mixed with the new style (bitmasks 0xffffffc0).
+ *
+ * @see #getModifiersEx()
+ * @see MouseEvent
+ * @serial the modifier state, stored in the new style
+ */
+ int modifiersEx;
+
+ /**
* Initializes a new instance of <code>InputEvent</code> with the specified
* source, id, timestamp, and modifiers. Note that an invalid id leads to
* unspecified results.
@@ -222,7 +233,8 @@ public abstract class InputEvent extends ComponentEvent
{
super(source, id);
this.when = when;
- this.modifiers = EventModifier.extend(modifiers);
+ this.modifiers = modifiers & EventModifier.OLD_MASK;
+ this.modifiersEx = modifiers & EventModifier.NEW_MASK;
}
/**
@@ -232,7 +244,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isShiftDown()
{
- return (modifiers & SHIFT_DOWN_MASK) != 0;
+ return ((modifiers & SHIFT_MASK) != 0)
+ || ((modifiersEx & SHIFT_DOWN_MASK) != 0);
}
/**
@@ -243,7 +256,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isControlDown()
{
- return (modifiers & CTRL_DOWN_MASK) != 0;
+ return ((modifiers & CTRL_MASK) != 0)
+ || ((modifiersEx & CTRL_DOWN_MASK) != 0);
}
/**
@@ -253,7 +267,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isMetaDown()
{
- return (modifiers & META_DOWN_MASK) != 0;
+ return ((modifiers & META_MASK) != 0)
+ || ((modifiersEx & META_DOWN_MASK) != 0);
}
/**
@@ -263,7 +278,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isAltDown()
{
- return (modifiers & ALT_DOWN_MASK) != 0;
+ return ((modifiers & ALT_MASK) != 0)
+ || ((modifiersEx & ALT_DOWN_MASK) != 0);
}
/**
@@ -274,7 +290,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isAltGraphDown()
{
- return (modifiers & ALT_GRAPH_DOWN_MASK) != 0;
+ return ((modifiers & ALT_GRAPH_MASK) != 0)
+ || ((modifiersEx & ALT_GRAPH_DOWN_MASK) != 0);
}
/**
@@ -300,7 +317,7 @@ public abstract class InputEvent extends ComponentEvent
*/
public int getModifiers()
{
- return EventModifier.revert(modifiers);
+ return modifiers;
}
/**
@@ -321,7 +338,7 @@ public abstract class InputEvent extends ComponentEvent
*/
public int getModifiersEx()
{
- return modifiers;
+ return modifiersEx;
}
/**
diff --git a/libjava/classpath/java/awt/event/InvocationEvent.java b/libjava/classpath/java/awt/event/InvocationEvent.java
index 75feb62bd94..6f39d6b9130 100644
--- a/libjava/classpath/java/awt/event/InvocationEvent.java
+++ b/libjava/classpath/java/awt/event/InvocationEvent.java
@@ -107,6 +107,13 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
private Exception exception;
/**
+ * This is the caught Throwable thrown in the <code>run()</code> method.
+ * It is null if throwables are ignored, the run method hasn't completed,
+ * or there were no throwables thrown.
+ */
+ private Throwable throwable;
+
+ /**
* The timestamp when this event was created.
*
* @see #getWhen()
@@ -183,9 +190,11 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
{
runnable.run();
}
- catch (Exception e)
+ catch (Throwable t)
{
- exception = e;
+ throwable = t;
+ if (t instanceof Exception)
+ exception = (Exception)t;
}
else
runnable.run();
@@ -211,6 +220,18 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
}
/**
+ * Returns a throwable caught while executing the Runnable's run() method.
+ * Null if none was thrown or if this InvocationEvent doesn't catch
+ * throwables.
+ * @return the caught Throwable
+ * @since 1.5
+ */
+ public Throwable getThrowable()
+ {
+ return throwable;
+ }
+
+ /**
* Gets the timestamp of when this event was created.
*
* @return the timestamp of this event
diff --git a/libjava/classpath/java/awt/event/KeyEvent.java b/libjava/classpath/java/awt/event/KeyEvent.java
index a40a8e15c04..d4b93ba3e0b 100644
--- a/libjava/classpath/java/awt/event/KeyEvent.java
+++ b/libjava/classpath/java/awt/event/KeyEvent.java
@@ -1735,6 +1735,6 @@ public class KeyEvent extends InputEvent
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
- modifiers = EventModifier.extend(modifiers);
+ modifiersEx = EventModifier.extend(modifiers) & EventModifier.NEW_MASK;
}
} // class KeyEvent
diff --git a/libjava/classpath/java/awt/event/MouseEvent.java b/libjava/classpath/java/awt/event/MouseEvent.java
index 249c3d112e4..3e0fecacf94 100644
--- a/libjava/classpath/java/awt/event/MouseEvent.java
+++ b/libjava/classpath/java/awt/event/MouseEvent.java
@@ -42,6 +42,7 @@ import gnu.java.awt.EventModifier;
import java.awt.Component;
import java.awt.Point;
+import java.awt.PopupMenu;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -227,6 +228,12 @@ public class MouseEvent extends InputEvent
else if ((modifiers & BUTTON3_MASK) != 0)
this.button = BUTTON3;
}
+ // clear the mouse button modifier masks if this is a button
+ // release event.
+ if (id == MOUSE_RELEASED)
+ this.modifiersEx &= ~(BUTTON1_DOWN_MASK
+ | BUTTON2_DOWN_MASK
+ | BUTTON3_DOWN_MASK);
}
/**
@@ -392,17 +399,9 @@ public class MouseEvent extends InputEvent
s.append("unknown type,(");
}
s.append(x).append(',').append(y).append("),button=").append(button);
- if ((modifiers & EventModifier.NEW_MASK) != 0)
- {
- int mod = modifiers;
- if ((mod & (ALT_DOWN_MASK | BUTTON2_DOWN_MASK)) != 0)
- mod |= ALT_DOWN_MASK | BUTTON2_DOWN_MASK;
- if ((mod & (META_DOWN_MASK | BUTTON3_DOWN_MASK)) != 0)
- mod |= META_DOWN_MASK | BUTTON3_DOWN_MASK;
- s.append(",modifiers=").append(getModifiersExText(mod));
- }
- if (modifiers != 0)
- s.append(",extModifiers=").append(getModifiersExText(modifiers));
+ // FIXME: need a mauve test for this method
+ if (modifiersEx != 0)
+ s.append(",extModifiers=").append(getModifiersExText(modifiersEx));
return s.append(",clickCount=").append(clickCount).toString();
}
@@ -426,7 +425,7 @@ public class MouseEvent extends InputEvent
button = BUTTON2;
else if ((modifiers & BUTTON3_MASK) != 0)
button = BUTTON3;
- modifiers = EventModifier.extend(modifiers);
+ modifiersEx = EventModifier.extend(modifiers) & EventModifier.NEW_MASK;
}
}
} // class MouseEvent
OpenPOWER on IntegriCloud