On Fri, 14 May 2021 15:55:48 GMT, Johan Vos <j...@openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/MouseState.java
>>  line 94:
>> 
>>> 92:      */
>>> 93:     MonocleWindow getWindow(boolean recalculateCache, MonocleWindow 
>>> fallback) {
>>> 94:         if (recalculateCache) {
>> 
>> Two questions:
>> 
>> 1. It looks like `fallback` is effectively unused (always null). Did you add 
>> this for a future use case?
>> 2. Unless I'm missing something, the only behavioral change is that it no 
>> longer executes the `if` block when the window is null if `recalculateCache` 
>> is false.
>
> true to both questions.
> The reason for this change is that this is now doing the same as what is done 
> in `monocle.TouchState` and `monocle.TouchInput`. 
> TBH, I would prefer a different approach, where no fallback is passed, and 
> the `if` block is only executed when `recalculateCache` is set to `true`. The 
> only case where this `getWindow` method is invoked, is from `MouseInput` and 
> it is only used to detect if the "old" window is different from the current 
> window. Hence, it all seems a bit overkill to me, but for some reason, I 
> thought keeping things consistent (mouseState versus TouchState) would make 
> sense.
> If you are ok with it, I can simply rewrite this without looking at the 
> TouchState case?

Either is fine with me. As long as this fixes your problem, go ahead with the 
fix. Or if you prefer, go ahead and rewrite it.

-------------

PR: https://git.openjdk.java.net/jfx/pull/502

Reply via email to