Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8267160: Monocle mouse never get ENTERED state
Reviewed-by: kcr
  • Loading branch information
Johan Vos committed May 14, 2021
1 parent 9e8c617 commit 8ca7815
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Expand Up @@ -89,9 +89,9 @@ void setState(MouseState newState, boolean synthesized) {
newState.setY(y);
// Get the cached window for the old state and compute the window for
// the new state
MonocleWindow oldWindow = state.getWindow(false);
MonocleWindow oldWindow = state.getWindow(false, null);
boolean recalculateWindow = state.getButtonsPressed().isEmpty();
MonocleWindow window = newState.getWindow(recalculateWindow);
MonocleWindow window = newState.getWindow(recalculateWindow, null);
MonocleView view = (window == null) ? null : (MonocleView) window.getView();
// send exit event
if (oldWindow != window && oldWindow != null) {
Expand Down
Expand Up @@ -78,19 +78,26 @@ void releaseButton(int button) {
buttonsPressed.removeInt(button);
}

/** Returns the Glass window on which the coordinates of this state are located.
/**
* Returns the Glass window on which the coordinates of this state are located.
* @param recalculateCache true if the cached value for the target window
* should be recalculated; false if the cached
* value should be used to determine the result
* of this method.
* @param fallback if the original window is null, or if no window can
* be found, return the fallback window
* @return the MonocleWindow at the top of the stack at the coordinates
* described by this state object.
* described by this state object, or the fallback window in case the
* current window is null or no window can be found for the supplied coordinates.
*/
MonocleWindow getWindow(boolean recalculateCache) {
if (window == null || recalculateCache) {
MonocleWindow getWindow(boolean recalculateCache, MonocleWindow fallback) {
if (recalculateCache) {
window = (MonocleWindow)
MonocleWindowManager.getInstance().getWindowForLocation(x, y);
}
if (window == null) {
window = fallback;
}
return window;
}

Expand Down

1 comment on commit 8ca7815

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.