<AWT Dev> Please review changes in regression test /java/awt/TestArea/UsingWithMouse.java (second version of patch)

Pavel Tisnovsky ptisnovs at redhat.com
Tue Jan 26 04:49:19 PST 2010

Artem Ananiev wrote:
> On 1/26/2010 2:57 PM, Pavel Tisnovsky wrote:
>> Artem Ananiev wrote:
>>>> I've added synchronization of scrolling using method
>>>> SunToolkit.realSync(), it seems to works perfectly on RHEL x86_64 +
>>>> Gnome and Fedora 10 i386 + Gnome. Thanks Anthony Petrov for his tip!
>>> the problem looks really, really strange... Util.waitForIdle() is
>>> implemented exactly the same way: as a call to realSync() - while you
>>> wrote that calling waitForIdle() didn't help.
>>> Please, postpone your fix (don't integrate into AWT gate repository)
>>> and check if Util.waitForIdle() does the job. realSync() is a
>>> low-level and private Sun's API, so I'd prefer having it in a single
>>> place (in Util) so we can change it easily, if necessary (e.g. when
>>> realSync() becomes public).
>> Yes, you are right, Util.waitForIdle() simply calls realSync(). It is
>> interesting - without this sync (waifForIdle/realSync, does not matter
>> which I use) this test always fails on my machine (i.e. it does not
>> selects all lines of TextArea), with sync included it fails "only" in
>> circa 1/10 of its run. At this time, I don't plan to push this patch as
>> it isn't 100% correct.
> realSync() only deals with events - native and Java - but it doesn't 
> cover things like native animations (e.g. on Vista/Seven with Aero 
> enabled, a window is not minimized instantly, but can be animated, and 
> realSync() couldn't be used to track this animation is over or in 
> progress). That's why sometimes, in rare cases, a simple Thread.sleep() 
> is a way to go.

Hmm, I see, the same problem can occur on Gnome+Compiz, for example. So 
do I have to just add Thread.sleep() after each mouse move + 
waitForIdle(), at least in this case? I tried that solution - whole text 
in TextArea are selected during only 2-3 mouse moves due to autoscroll 
feature (which is correct for this test case, IMHO).

> Thanks,
> Artem
>>> Thanks,
>>> Artem
>>>> This patch can be applied to OpenJDK7 too.
>>>> Thanks in advance
>>>> Pavel Tisnovsky
>>>> Red Hat QA

More information about the awt-dev mailing list