Hello all,
The case raised by Yann is in fact very interesting. It is difficult to know
when a type of event is being suppressed or added as we play with mask bits
(the same method is called in sink and unsink).
DOMImplMozilla has been coded this way :
@Override
public void sinkEvents(Element elem, int bits) {
super.sinkEvents(elem, bits);
sinkEventsMozilla(elem, bits);
}
the call of sinkEvents(elem, bits) is a kind of "hack" as you have to add
this fancy firefox specific 'DOMMouseScroll' listener. The existing code
works pretty well when we add events (even in this case, it's sounds strange
to systematically add a new eventListener - the listener could already
exists). But when we want to remove an existing one, there is no choice
except what Yann proposes.
btw this "else" solution would be bad in terms of performance since 99% of
calls to sinkEvent() would fall back in the "else" and raise a probably
heavy removeListener(...). (maybe test "undefined" listener?)
Would be very interested to know what you propose for this bug
Sami
2009/1/14 Freeland Abbott <[email protected]>
> Actually, given Yann is pulling GWT source code up, and in impl classes at
> that, I'm not sure he's in the wrong place... (Although it's true that if
> Yann had gone all the way and written up your change into a patch, that'd be
> more typical of this forum.)
>
> However, I can't personally say whether there's an existing way to do the
> supression he's proposing (other than, say, putting a GlassPanel over the
> subarea so that it gets the events instead), in which case the patch would
> have been rejected during the discussion, or it's an actual bug as Yann
> suggests.
>
>
>
> On Wed, Jan 14, 2009 at 10:16 AM, Arthur Kalmenson
> <[email protected]>wrote:
>
>>
>> Hi Yann,
>>
>> You found the wrong forum (Google Group). The GWT Contributors Google
>> Group is specifically to discuss development in GWT, not for support
>> questions. You'll have better luck on the regular GWT Group:
>> http://groups.google.com/group/Google-Web-Toolkit
>>
>> --
>> Arthur Kalmenson
>>
>>
>>
>> On Tue, Jan 13, 2009 at 11:36 AM, Yann <[email protected]>
>> wrote:
>> >
>> > Hi,
>> >
>> > This is my first post on the GWT forums, so I wanted to start with
>> > thanking Google and all of the contributors for this great tool! It's
>> > very impressive and very pleasant to use.
>> >
>> > To prevent usage of the mousewheel on a sub area of an application, I
>> > have been calling these two lines:
>> >
>> > FocusPanel focusPanel = new FocusPanel();
>> > focusPanel.unsinkEvents(Event.ONMOUSEWHEEL);
>> >
>> > This works pretty well in IE6 but not in Firefox. So I started nailing
>> > down the issue and I found what I believe is a bug in:
>> >
>> > com.google.gwt.user.client.impl.DOMImplMozilla.sinkEventsMozilla
>> >
>> > It says:
>> >
>> > if (bits & 0x20000) {
>> > elem.addEventListener(.....);
>> > }
>> >
>> > while I *presume* there should be an else clause with a remove
>> > counterpart.
>> >
>> > Should I raise a bug report?
>> >
>> >
>> > Note: a temporary workaround I found was to redefine the behavior in
>> > the following manner:
>> >
>> > public class MyDOMImplMozilla extends DOMImplMozillaOld
>> > {
>> > @Override
>> > public native void sinkEventsMozilla(Element elem, int bits) /*-{
>> > if (bits & 0x20000) {
>> > elem.addEventListener('DOMMouseScroll',
>> > @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent,
>> > false);
>> > }
>> > else {
>> > elem.removeEventListener('DOMMouseScroll',
>> > @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent,
>> > false);
>> > }
>> > }-*/;
>> > }
>> >
>> > and
>> >
>> > <replace-with class="MyDOMImplMozilla">
>> > <when-type-is
>> class="com.google.gwt.user.client.impl.DOMImpl"/>
>> > <when-property-is name="user.agent" value="gecko1_8"/>
>> > </replace-with>
>> >
>> >
>> > Many thanks in advance
>> > Best regards
>> >
>> > >
>> >
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---