Imported GNU Classpath 0.90
Imported GNU Classpath 0.90
* scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale.
* sources.am: Regenerated.
* gcj/javaprims.h: Regenerated.
* Makefile.in: Regenerated.
* gcj/Makefile.in: Regenerated.
* include/Makefile.in: Regenerated.
* testsuite/Makefile.in: Regenerated.
* gnu/java/lang/VMInstrumentationImpl.java: New override.
* gnu/java/net/local/LocalSocketImpl.java: Likewise.
* gnu/classpath/jdwp/VMMethod.java: Likewise.
* gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest
interface.
* java/lang/Thread.java: Add UncaughtExceptionHandler.
* java/lang/reflect/Method.java: Implements GenericDeclaration and
isSynthetic(),
* java/lang/reflect/Field.java: Likewise.
* java/lang/reflect/Constructor.java
* java/lang/Class.java: Implements Type, GenericDeclaration,
getSimpleName() and getEnclosing*() methods.
* java/lang/Class.h: Add new public methods.
* java/lang/Math.java: Add signum(), ulp() and log10().
* java/lang/natMath.cc (log10): New function.
* java/security/VMSecureRandom.java: New override.
* java/util/logging/Logger.java: Updated to latest classpath
version.
* java/util/logging/LogManager.java: New override.
From-SVN: r113887
This commit is contained in:
@@ -110,14 +110,12 @@ class LightweightDispatcher
|
||||
*/
|
||||
public boolean dispatchEvent(AWTEvent event)
|
||||
{
|
||||
boolean dispatched = false;
|
||||
if (event instanceof MouseEvent && event.getSource() instanceof Window)
|
||||
{
|
||||
MouseEvent mouseEvent = (MouseEvent) event;
|
||||
handleMouseEvent(mouseEvent);
|
||||
dispatched = true;
|
||||
return handleMouseEvent(mouseEvent);
|
||||
}
|
||||
return dispatched;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,12 +123,14 @@ class LightweightDispatcher
|
||||
* (Window instances) and dispatches them to the correct lightweight child.
|
||||
*
|
||||
* @param ev the mouse event
|
||||
* @return whether or not we found a lightweight that handled the event.
|
||||
*/
|
||||
private void handleMouseEvent(MouseEvent ev)
|
||||
private boolean handleMouseEvent(MouseEvent ev)
|
||||
{
|
||||
Window window = (Window) ev.getSource();
|
||||
Component target = window.findComponentAt(ev.getX(), ev.getY());
|
||||
if (target != null && target.isLightweight())
|
||||
target = findTarget(target);
|
||||
if (target == null || target.isLightweight())
|
||||
{
|
||||
// Dispatch additional MOUSE_EXITED and MOUSE_ENTERED if event target
|
||||
// is different from the last event target.
|
||||
@@ -146,13 +146,16 @@ class LightweightDispatcher
|
||||
ev.getClickCount(), ev.isPopupTrigger());
|
||||
lastTarget.dispatchEvent(mouseExited);
|
||||
}
|
||||
Point p = AWTUtilities.convertPoint(window, ev.getX(), ev.getY(),
|
||||
target);
|
||||
MouseEvent mouseEntered =
|
||||
new MouseEvent(target, MouseEvent.MOUSE_ENTERED, ev.getWhen(),
|
||||
ev.getModifiers(), p.x, p.y, ev.getClickCount(),
|
||||
ev.isPopupTrigger());
|
||||
target.dispatchEvent(mouseEntered);
|
||||
if (target != null)
|
||||
{
|
||||
Point p = AWTUtilities.convertPoint(window, ev.getX(), ev.getY(),
|
||||
target);
|
||||
MouseEvent mouseEntered =
|
||||
new MouseEvent(target, MouseEvent.MOUSE_ENTERED, ev.getWhen(),
|
||||
ev.getModifiers(), p.x, p.y, ev.getClickCount(),
|
||||
ev.isPopupTrigger());
|
||||
target.dispatchEvent(mouseEntered);
|
||||
}
|
||||
}
|
||||
|
||||
switch (ev.getID())
|
||||
@@ -183,18 +186,43 @@ class LightweightDispatcher
|
||||
|
||||
lastTarget = target;
|
||||
|
||||
Point targetCoordinates =
|
||||
AWTUtilities.convertPoint(window, ev.getX(), ev.getY(), target);
|
||||
int dx = targetCoordinates.x - ev.getX();
|
||||
int dy = targetCoordinates.y - ev.getY();
|
||||
ev.translatePoint(dx, dy);
|
||||
ev.setSource(target);
|
||||
target.dispatchEvent(ev);
|
||||
if (target != null)
|
||||
{
|
||||
Point targetCoordinates =
|
||||
AWTUtilities.convertPoint(window, ev.getX(), ev.getY(), target);
|
||||
int dx = targetCoordinates.x - ev.getX();
|
||||
int dy = targetCoordinates.y - ev.getY();
|
||||
ev.translatePoint(dx, dy);
|
||||
ev.setSource(target);
|
||||
target.dispatchEvent(ev);
|
||||
// We reset the event, so that the normal event dispatching is not
|
||||
// influenced by this modified event.
|
||||
ev.setSource(window);
|
||||
ev.translatePoint(-dx, -dy);
|
||||
}
|
||||
|
||||
// We reset the event, so that the normal event dispatching is not
|
||||
// influenced by this modified event.
|
||||
ev.setSource(window);
|
||||
ev.translatePoint(-dx, -dy);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the actual target for a mouseevent, starting at <code>c</code>.
|
||||
* This searches upwards the component hierarchy until it finds a component
|
||||
* that has a mouselistener attached.
|
||||
*
|
||||
* @param c the component to start searching from
|
||||
*
|
||||
* @return the actual receiver of the mouse event
|
||||
*/
|
||||
private Component findTarget(Component c)
|
||||
{
|
||||
Component target = c;
|
||||
while (target != null && target.getMouseListeners().length == 0)
|
||||
{
|
||||
target = target.getParent();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user