* Bug #4649 fixed - License issue in the xs2ppm help page fixed.
+* Bug #4677 fixed - xclick did not return correct mouse position on keyboard event.
+
* Bug #4965 fixed - Setting links property for a handle of type legend did not work.
* Bug #5016 fixed - condestsp could return different results when repeated calls were performed.
* @param figureUID Scilab ID of the figure where the even occurred
* @param isControlDown : is CTRL key modifier activated.
*/
- public static void filterKey(int keyPressed, Integer figureUID, boolean isControlDown) {
+ public static void filterKey(int keyPressed, Integer figureUID, boolean isControlDown, Component source) {
synchronized (ClickInfos.getInstance()) {
ClickInfos.getInstance().setMouseButtonNumber(SciTranslator.javaKey2Scilab(keyPressed, isControlDown));
ClickInfos.getInstance().setWindowID(figureUID);
- ClickInfos.getInstance().setXCoordinate(MouseInfo.getPointerInfo().getLocation().x);
- ClickInfos.getInstance().setYCoordinate(MouseInfo.getPointerInfo().getLocation().y);
+ ClickInfos.getInstance().setXCoordinate(MouseInfo.getPointerInfo().getLocation().x - source.getLocationOnScreen().getX());
+ ClickInfos.getInstance().setYCoordinate(MouseInfo.getPointerInfo().getLocation().y - source.getLocationOnScreen().getY());
ClickInfos.getInstance().notify();
}
}
);
ClickInfos.getInstance().setWindowID(axesUID);
try {
- ClickInfos.getInstance().setXCoordinate(mouseEvent.getX()
- + ((Component) mouseEvent.getSource()).getLocationOnScreen().getX()
- - ((Component) mouseEvent.getSource()).getLocationOnScreen().getX());
- ClickInfos.getInstance().setYCoordinate(mouseEvent.getY()
- + ((Component) mouseEvent.getSource()).getLocationOnScreen().getY()
- - ((Component) mouseEvent.getSource()).getLocationOnScreen().getY());
+ ClickInfos.getInstance().setXCoordinate(mouseEvent.getX());
+ ClickInfos.getInstance().setYCoordinate(mouseEvent.getY());
} catch (Exception e) {
- ClickInfos.getInstance().setXCoordinate(mouseEvent.getX()
- + ((Component) mouseEvent.getSource()).getX()
- - ((Component) mouseEvent.getSource()).getX());
- ClickInfos.getInstance().setYCoordinate(mouseEvent.getY()
- + ((Component) mouseEvent.getSource()).getY()
- - ((Component) mouseEvent.getSource()).getY());
+ ClickInfos.getInstance().setXCoordinate(mouseEvent.getX());
+ ClickInfos.getInstance().setYCoordinate(mouseEvent.getY());
} finally {
ClickInfos.getInstance().notify();
}
}
}
} else if (keyEvent.getID() == KeyEvent.KEY_TYPED) {
- if (keyEvent.getSource() != null
- && keyEvent.getSource() instanceof SwingScilabCanvas) {
- if (GlobalEventWatcher.isActivated()) {
- GlobalEventFilter.filterKey(keyChar, GlobalEventWatcher.getAxesUID(), keyEvent.isControlDown());
- }
+ if (keyEvent.getSource() instanceof SwingScilabCanvas && GlobalEventWatcher.isActivated()) {
+ GlobalEventFilter.filterKey(keyChar, GlobalEventWatcher.getAxesUID(), keyEvent.isControlDown(), (SwingScilabCanvas) keyEvent.getSource());
}
}
}
return ClickInfos.getInstance().getWindowID();
}
-
-
/**
* Manage xgetmouse behaviour for keyboard entry.
* 1 - Key has been pressed.
}
}
isControlDown = keyEvent.isControlDown();
- } else if (keyEvent.getSource() != null
- && keyEvent.getSource() instanceof SwingScilabCanvas) {
+ } else if (keyEvent.getSource() instanceof SwingScilabCanvas) {
/* Now we have have to be sure we are in a Canvas. */
/*
* If a RELEASED is seen use -keyChar
*/
if (keyEvent.getID() == KeyEvent.KEY_RELEASED) {
- GlobalEventFilter.filterKey(-keyChar, GlobalEventWatcher.getAxesUID(), isControlDown);
+ GlobalEventFilter.filterKey(-keyChar, GlobalEventWatcher.getAxesUID(), isControlDown, (SwingScilabCanvas) keyEvent.getSource());
} else if (keyEvent.getID() == KeyEvent.KEY_TYPED) {
/*
* Or If a TYPED is seen use keyChar
*/
- GlobalEventFilter.filterKey(keyChar, GlobalEventWatcher.getAxesUID(), isControlDown);
+ GlobalEventFilter.filterKey(keyChar, GlobalEventWatcher.getAxesUID(), isControlDown, (SwingScilabCanvas) keyEvent.getSource());
}
}
}
+
/**
* Manage xgetmouse behaviour for mouse entry.
*
GlobalEventFilter.filterMouse(mouseEvent, axesUID, scilabMouseAction, false);
}
}
-
-
}
-