// request focus in main window
InputManager.ensureKeyFocusInMainWindow();
// send a fake mouse event to generate an exit
final EmbeddedPeer targetEmbeddedPeer = lastWindow.getEmbeddedPeer();
lastWindow = null;
return new CoordinateHandler() {
public EmbeddedPeer getEmbeddedPeer() {
return targetEmbeddedPeer;
}
public Point2D transform(Point2D src, Point2D dst,
MouseEvent event)
{
if (dst == null) {
dst = new Point2D.Float();
}
dst.setLocation(-1, -1);
return dst;
}
};
} else {
return null;
}
}
logger.fine("WindowSwing hit");
logger.fine("Pick hit entity = " + ret.entity);
EntityComponent comp = ret.entity.getComponent(WindowSwing.WindowSwingViewReference.class);
assert comp != null;
final View2D view = ((WindowSwing.WindowSwingViewReference) comp).getView();
WindowSwing windowSwing = (WindowSwing) view.getWindow();
// Keep track of the last window we hit
if (lastWindow == null) {
logger.fine("Enter swing");
}
lastWindow = windowSwing;
// TODO: someday: I don't think we need to set this anymore for drag events. But it doesn't hurt.
final Vector3f intersectionPointWorld = ret.destPickDetails.getPosition();
logger.fine("intersectionPointWorld = " + intersectionPointWorld);
if (e.getID() == MouseEvent.MOUSE_PRESSED) {
lastPressPointScreen = new Point(e.getX(), e.getY());
lastPressEventHook = windowSwing.getEventHook();
if (lastPressEventHook != null) {
WindowSwing.EventHookInfo hookInfo = new WindowSwing.EventHookInfo(intersectionPointWorld,
e.getX(), e.getY());
lastPressEventHook.specifyHookInfoForEvent(e, hookInfo);
}
}
final EmbeddedPeer targetEmbeddedPeer = windowSwing.getEmbeddedPeer();
CoordinateHandler coordinateHandler = new CoordinateHandler() {
public EmbeddedPeer getEmbeddedPeer() {
return targetEmbeddedPeer;
}