aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/awt/event
diff options
context:
space:
mode:
authorMatthias Klose <doko@gcc.gnu.org>2007-08-04 10:53:49 +0000
committerMatthias Klose <doko@gcc.gnu.org>2007-08-04 10:53:49 +0000
commitf06a83c0b2f7761510836194a6c9a8a72000937c (patch)
tree871b70a606d87369d5aa9d6f621baedc13b49eba /libjava/classpath/java/awt/event
parent2c3de459b647a72fc35d66adeda274ba0f14347b (diff)
downloadgcc-f06a83c0b2f7761510836194a6c9a8a72000937c.zip
gcc-f06a83c0b2f7761510836194a6c9a8a72000937c.tar.gz
gcc-f06a83c0b2f7761510836194a6c9a8a72000937c.tar.bz2
Import GNU Classpath (libgcj-import-20070727).
libjava/ 2007-08-04 Matthias Klose <doko@ubuntu.com> Import GNU Classpath (libgcj-import-20070727). * Regenerate class and header files. * Regenerate auto* files. * include/jvm.h: * jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type. * jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise. * jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA, _Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA, _Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA, _Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify jvalue parameter. * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise. * java/lang/VMFloat.java (toString, parseFloat): New. * gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported, isModalExclusionTypeSupported): New (stub only). * gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise. * gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages, updateFocusableWindowState, setModalBlocked, getBoundsPrivate, setAlwaysOnTop): Likewise. * gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature. * scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer, ignore javax.sound.sampled.spi.MixerProvider, ignore .in files. * HACKING: Mention --enable-gstreamer-peer, removal of generated files. libjava/classpath/ 2007-08-04 Matthias Klose <doko@ubuntu.com> * java/util/EnumMap.java (clone): Add cast. From-SVN: r127204
Diffstat (limited to 'libjava/classpath/java/awt/event')
-rw-r--r--libjava/classpath/java/awt/event/MouseEvent.java95
1 files changed, 95 insertions, 0 deletions
diff --git a/libjava/classpath/java/awt/event/MouseEvent.java b/libjava/classpath/java/awt/event/MouseEvent.java
index f2bcfbc..ad777e8 100644
--- a/libjava/classpath/java/awt/event/MouseEvent.java
+++ b/libjava/classpath/java/awt/event/MouseEvent.java
@@ -164,6 +164,16 @@ public class MouseEvent extends InputEvent
private int y;
/**
+ * The screen position of that mouse event, X coordinate.
+ */
+ private int absX;
+
+ /**
+ * The screen position of that mouse event, Y coordinate.
+ */
+ private int absY;
+
+ /**
* The number of clicks that took place. For MOUSE_CLICKED, MOUSE_PRESSED,
* and MOUSE_RELEASED, this will be at least 1; otherwise it is 0.
*
@@ -212,6 +222,7 @@ public class MouseEvent extends InputEvent
int button)
{
super(source, id, when, modifiers);
+
this.x = x;
this.y = y;
this.clickCount = clickCount;
@@ -234,6 +245,13 @@ public class MouseEvent extends InputEvent
this.modifiersEx &= ~(BUTTON1_DOWN_MASK
| BUTTON2_DOWN_MASK
| BUTTON3_DOWN_MASK);
+
+ if (source != null)
+ {
+ Point screenLoc = source.getLocationOnScreen();
+ absX = screenLoc.x + x;
+ absY = screenLoc.y + y;
+ }
}
/**
@@ -258,6 +276,59 @@ public class MouseEvent extends InputEvent
}
/**
+ * Creates a new MouseEvent. This is like the other constructors and adds
+ * specific absolute coordinates.
+ *
+ * @param source the source of the event
+ * @param id the event id
+ * @param when the timestamp of when the event occurred
+ * @param modifiers the modifier keys during the event, in old or new style
+ * @param x the X coordinate of the mouse point
+ * @param y the Y coordinate of the mouse point
+ * @param absX the absolute X screen coordinate of this event
+ * @param absY the absolute Y screen coordinate of this event
+ * @param clickCount the number of mouse clicks for this event
+ * @param popupTrigger true if this event triggers a popup menu
+ * @param button the most recent mouse button to change state
+ *
+ * @throws IllegalArgumentException if source is null or button is invalid
+ *
+ * @since 1.6
+ */
+ public MouseEvent(Component source, int id, long when, int modifiers,
+ int x, int y, int absX, int absY, int clickCount,
+ boolean popupTrigger, int button)
+ {
+ super(source, id, when, modifiers);
+
+ this.x = x;
+ this.y = y;
+ this.clickCount = clickCount;
+ this.popupTrigger = popupTrigger;
+ this.button = button;
+ if (button < NOBUTTON || button > BUTTON3)
+ throw new IllegalArgumentException();
+ if ((modifiers & EventModifier.OLD_MASK) != 0)
+ {
+ if ((modifiers & BUTTON1_MASK) != 0)
+ this.button = BUTTON1;
+ else if ((modifiers & BUTTON2_MASK) != 0)
+ this.button = BUTTON2;
+ 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);
+
+ this.absX = absX;
+ this.absY = absY;
+ }
+
+ /**
* This method returns the X coordinate of the mouse position. This is
* relative to the source component.
*
@@ -280,6 +351,30 @@ public class MouseEvent extends InputEvent
}
/**
+ * @since 1.6
+ */
+ public Point getLocationOnScreen()
+ {
+ return new Point(absX, absY);
+ }
+
+ /**
+ * @since 1.6
+ */
+ public int getXOnScreen()
+ {
+ return absX;
+ }
+
+ /**
+ * @since 1.6
+ */
+ public int getYOnScreen()
+ {
+ return absY;
+ }
+
+ /**
* This method returns a <code>Point</code> for the x,y position of
* the mouse pointer. This is relative to the source component.
*