Re: [OpenJDK 2D-Dev] RFR: 8262446: DragAndDrop hangs on Windows [v2]

2021-03-05 Thread Dmitry Markov
On Fri, 5 Mar 2021 17:01:41 GMT, Alexey Ivanov  wrote:

>> Dmitry Markov has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   reuse isInDoDragDropLoop
>
> src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp line 228:
> 
>> 226: HRESULT __stdcall AwtDropTarget::DragOver(DWORD grfKeyState, POINTL pt, 
>> DWORD __RPC_FAR *pdwEffect) {
>> 227: TRY;
>> 228: AwtToolkit::GetInstance().isInDoDragDropLoop = TRUE;
> 
> This is a new addition. Did you miss this function in previous iteration?

Good catch! Actually that line is harmless but it is really unnecessary. I will 
update PR

-

PR: https://git.openjdk.java.net/jdk/pull/2825


Re: [OpenJDK 2D-Dev] RFR: 8262446: DragAndDrop hangs on Windows [v2]

2021-03-05 Thread Alexey Ivanov
On Fri, 5 Mar 2021 16:06:04 GMT, Dmitry Markov  wrote:

>> The IME functions and the DND operation must be executed on the toolkit 
>> thread. If the DND operation is in progress, the IME API is invoked via 
>> SendMessage() call inside InvokeInputMethodFunction() to avoid a hang. The 
>> flag isInDoDragDropLoop indicates whether the DND takes place or not. The 
>> flag works properly if the DND is performed between two Java windows. 
>> However if anything is dragged from native app, (e.g. Windows FileExplorer) 
>> to Java the flag is NOT set. That’s the root cause of the hang.
>> 
>> Fix:
>> Introduce a new flag to indicate DND operation between Java and native app. 
>> 
>> Testing:
>> mach5 green
>
> Dmitry Markov has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   reuse isInDoDragDropLoop

Marked as reviewed by aivanov (Reviewer).

src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp line 228:

> 226: HRESULT __stdcall AwtDropTarget::DragOver(DWORD grfKeyState, POINTL pt, 
> DWORD __RPC_FAR *pdwEffect) {
> 227: TRY;
> 228: AwtToolkit::GetInstance().isInDoDragDropLoop = TRUE;

This is a new addition. Did you miss this function in previous iteration?

-

PR: https://git.openjdk.java.net/jdk/pull/2825


Re: [OpenJDK 2D-Dev] RFR: 8262446: DragAndDrop hangs on Windows [v2]

2021-03-05 Thread Dmitry Markov
On Fri, 5 Mar 2021 12:51:15 GMT, Dmitry Markov  wrote:

>> Why we cannot reuse the old flag? "isInDoDragDropLoop"? I think the 
>> Robot.waitForIdle() will hang if isInDoDragDropLoop is not set to true while 
>> dragging something from the native app.
>
>> Why we cannot reuse the old flag? "isInDoDragDropLoop"? I think the 
>> Robot.waitForIdle() will hang if isInDoDragDropLoop is not set to true while 
>> dragging something from the native app.
> 
> Initially I didn’t want to touch that flag but after a closer look to 
> “isInDoDragDropLoop” I think it is OK to reuse the flag. I will update PR 
> shortly.

> @dmarkov20
> I'd like to confirm this issue was not fixed by 
> [JDK-8261231](https://bugs.openjdk.java.net/browse/JDK-8261231) #2448 ?

That's right. This one and JDK-8261231 are two different issues. It is expected 
that the changes for JDK-8261231 do not fix this.

-

PR: https://git.openjdk.java.net/jdk/pull/2825


Re: [OpenJDK 2D-Dev] RFR: 8262446: DragAndDrop hangs on Windows [v2]

2021-03-05 Thread Dmitry Markov
On Fri, 5 Mar 2021 12:53:00 GMT, Dmitry Markov  wrote:

>>> Why we cannot reuse the old flag? "isInDoDragDropLoop"? I think the 
>>> Robot.waitForIdle() will hang if isInDoDragDropLoop is not set to true 
>>> while dragging something from the native app.
>> 
>> Initially I didn’t want to touch that flag but after a closer look to 
>> “isInDoDragDropLoop” I think it is OK to reuse the flag. I will update PR 
>> shortly.
>
>> @dmarkov20
>> I'd like to confirm this issue was not fixed by 
>> [JDK-8261231](https://bugs.openjdk.java.net/browse/JDK-8261231) #2448 ?
> 
> That's right. This one and JDK-8261231 are two different issues. It is 
> expected that the changes for JDK-8261231 do not fix this.

I have update the fix: reuse isInDoDragDropLoop flag instead of introducing a 
new one.
@mrserb @aivanov-jdk 
Could you take a look, please?

-

PR: https://git.openjdk.java.net/jdk/pull/2825


Re: [OpenJDK 2D-Dev] RFR: 8262446: DragAndDrop hangs on Windows [v2]

2021-03-05 Thread Dmitry Markov
> The IME functions and the DND operation must be executed on the toolkit 
> thread. If the DND operation is in progress, the IME API is invoked via 
> SendMessage() call inside InvokeInputMethodFunction() to avoid a hang. The 
> flag isInDoDragDropLoop indicates whether the DND takes place or not. The 
> flag works properly if the DND is performed between two Java windows. However 
> if anything is dragged from native app, (e.g. Windows FileExplorer) to Java 
> the flag is NOT set. That’s the root cause of the hang.
> 
> Fix:
> Introduce a new flag to indicate DND operation between Java and native app. 
> 
> Testing:
> mach5 green

Dmitry Markov has updated the pull request incrementally with one additional 
commit since the last revision:

  reuse isInDoDragDropLoop

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2825/files
  - new: https://git.openjdk.java.net/jdk/pull/2825/files/6d7502a4..d9af9879

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=2825=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=2825=00-01

  Stats: 11 lines in 3 files changed: 1 ins; 2 del; 8 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2825.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2825/head:pull/2825

PR: https://git.openjdk.java.net/jdk/pull/2825


Re: [OpenJDK 2D-Dev] RFR: 8262446: DragAndDrop hangs on Windows [v2]

2021-03-05 Thread Dmitry Markov
On Fri, 5 Mar 2021 01:34:04 GMT, Sergey Bylokhov  wrote:

> Why we cannot reuse the old flag? "isInDoDragDropLoop"? I think the 
> Robot.waitForIdle() will hang if isInDoDragDropLoop is not set to true while 
> dragging something from the native app.

Initially I didn’t want to touch that flag but after a closer look to 
“isInDoDragDropLoop” I think it is OK to reuse the flag. I will update PR 
shortly.

-

PR: https://git.openjdk.java.net/jdk/pull/2825