See my mail sent on Thu, Oct 18, 2018 at 4:35 PM.
Cheers,
Laurent
Le lun. 22 oct. 2018 à 18:08, Martin Balao <mba...@redhat.com
<mailto:mba...@redhat.com>> a écrit :
Hi Laurent,
Thanks for confirming this. I'm not surprised by the results you got: it's
pretty clear that there is something on the macOS windows subsystem that is
preventing this bug from easily showing there -but your 1st reproducer does not
depend on that-.
Kind regards,
Martin.-
On Thu, Oct 18, 2018 at 9:46 PM, Laurent Bourgès <bourges.laur...@gmail.com
<mailto:bourges.laur...@gmail.com>> wrote:
Martin & Sergey,
Here are my test results on macOS New Sierra:
$ uname -a
Darwin xxxx 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14
PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
$ source ~/Desktop/test-jdk11.sh
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
$ java TestWinEvent
java.lang.IllegalStateException: Total [0] != expected [400] !
$ java TestSeqEventsMultipleContexts
Total [400] - Expected [400]
Test PASSED
So I conclude my former test submitting SequencedEvent directly fails
in contrary to using the public Window toBack()/toFront() API on MacOS.
I suppose these last methods do not emit SequencedEvent on macOS
(native code) ?
Finally I am a bit annoyed that the TestSeqEventsMultipleContexts does
not fail on mac, but fails on other platforms Yes, so it is enough for me.
Sergey, should I test on windows too ?
To conclude, I tried adopting a more conservative approach in my last
hack, but I needed dispatching InvocationEvents to let swing.Timer continue to
work.
I do not know if it is better to select which events to accept (while
list) or to select which events not reject (black list): it depends on the
number of cases.
Best Regards,
Laurent
Le jeu. 18 oct. 2018 à 16:42, Martin Balao <mba...@redhat.com
<mailto:mba...@redhat.com>> a écrit :
Yes, your results are exactly what I was expecting.
On Thu, Oct 18, 2018 at 4:35 PM, Laurent Bourgès <bourges.laur...@gmail.com
<mailto:bourges.laur...@gmail.com>> wrote:
Hi Martin,
Here are my test outputs:
1/ First
$ java TestWinEvent
reject ID = 1200 :
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.RepaintManager$ProcessingRunnable@28985415,notifier=null,catchExceptions=false,when=1539872732255]
on sun.awt.X11.XToolkit@4645926f
reject ID = 1200 :
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.Timer$DoPostEvent@1a954cb5,notifier=null,catchExceptions=false,when=1539872733214]
on sun.awt.X11.XToolkit@4645926f
reject ID = 1200 :
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.RepaintManager$ProcessingRunnable@1208f81d,notifier=null,catchExceptions=false,when=1539872733286]
on sun.awt.X11.XToolkit@4645926f
reject ID = 1100 :
java.awt.event.InputMethodEvent[INPUT_METHOD_TEXT_CHANGED, no text, 0
characters committed, no caret, no visible position] on
javax.swing.JButton[,0,51,300x25,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@75806c8,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=TEST
2,defaultCapable=true]
reject ID = 1200 :
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.Timer$DoPostEvent@1a6b3cd6,notifier=null,catchExceptions=false,when=1539872733215]
on sun.awt.X11.XToolkit@4645926f
java.lang.IllegalStateException: Total [4] != expected [400] !
at TestWinEvent.main(TestWinEvent.java:53)
*java.lang.IllegalStateException: Total [4] != expected [400] !*
$ java TestSeqEventsMultipleContexts
java TestSeqEventsMultipleContexts
reject ID = 1200 :
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.RepaintManager$ProcessingRunnable@6d620f31,notifier=null,catchExceptions=false,when=1539872801695]
on sun.awt.X11.XToolkit@65746729
reject ID = 1200 :
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.Timer$DoPostEvent@2bfb82e8,notifier=null,catchExceptions=false,when=1539872801890]
on sun.awt.X11.XToolkit@65746729
reject ID = 1200 :
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.RepaintManager$ProcessingRunnable@754b4fe7,notifier=null,catchExceptions=false,when=1539872801894]
on sun.awt.X11.XToolkit@65746729
reject ID = 1100 :
java.awt.event.InputMethodEvent[INPUT_METHOD_TEXT_CHANGED, no text, 0
characters committed, no caret, no visible position] on
javax.swing.JButton[,0,51,300x25,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@51861d7a,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=TEST
4,defaultCapable=true]
reject ID = 1200 :
java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.Timer$DoPostEvent@e20778b,notifier=null,catchExceptions=false,when=1539872801893]
on sun.awt.X11.XToolkit@65746729
*Total [8] - Expected [400]
Test FAILED*
So the TestSeqEventsMultipleContexts is failing now:
InvocationEvent must be dispatched as the test uses a Timer()
to post 1 event at a time (and avoid polluting the event queue in contrary to
the initial TestWinEvent).
2/ Dispatch InvocationEvents:
$ java TestWinEvent
reject ID = 1100 :
java.awt.event.InputMethodEvent[INPUT_METHOD_TEXT_CHANGED, no text, 0
characters committed, no caret, no visible position] on
javax.swing.JButton[,0,51,300x25,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@25550fd7,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=TEST
45,defaultCapable=true]
reject ID = 103 :
java.awt.event.ComponentEvent[COMPONENT_HIDDEN] on frame0
$ java TestSeqEventsMultipleContexts
reject ID = 1100 :
java.awt.event.InputMethodEvent[INPUT_METHOD_TEXT_CHANGED, no text, 0
characters committed, no caret, no visible position] on
javax.swing.JButton[,0,51,300x25,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@70122df1,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=TEST
17,defaultCapable=true]
*Total [400] - Expected [400]
Test PASSED*
Here is my last hack:
private static final class SequencedEventsFilter
implements EventFilter {
private final SequencedEvent currentSequencedEvent;
private SequencedEventsFilter(SequencedEvent
currentSequencedEvent) {
this.currentSequencedEvent = currentSequencedEvent;
}
@Override
public FilterAction acceptEvent(AWTEvent ev) {
if (ev.getID() == ID) {
// Move forward dispatching only if the event
is previous
// in SequencedEvent.list. Otherwise, hold it
for reposting later.
synchronized (SequencedEvent.class) {
for (SequencedEvent iev : list) {
if (iev.equals(currentSequencedEvent))
{
break;
} else if (iev.equals(ev)) {
return FilterAction.ACCEPT;
}
}
}
currentSequencedEvent.pendingEvents.add(ev);
return FilterAction.REJECT;
*// LAURENT HACK <<
} else if (ev.getID() == SentEvent.ID
|| ev.getID() ==
java.awt.event.InvocationEvent.INVOCATION_DEFAULT) {
return FilterAction.ACCEPT;
}
System.out.println("reject ID = "+ ev.getID() + " : " +
ev.toString());
return FilterAction.REJECT;
// LAURENT HACK >>*
// return FilterAction.ACCEPT;
}
}
I will then test on Mac ...
Laurent