On 18.03.2011 11:10, MacArthur, Ian (SELEX GALILEO, UK) wrote:
>
>>>> I have no idea why my patch changed the behavior of take_focus()
>>>> in such a way, but I'll investigate this later - I'm really
>>>> curious. If anybody could tell me, I'd appreciate it...
>>>
>>> For the record: it turned out that something else changed the
>>> take_focus() behavior. This seems like a regression in fltk 1.3
>>> and should be investigated.
>>
>> I found the regression: it's in svn r7788, file FL/Fl_Widget.H:
>>
>> Index: FL/Fl_Widget.H
>> ===================================================================
>> --- FL/Fl_Widget.H      (revision 7787)
>> +++ FL/Fl_Widget.H      (revision 7788)
>> @@ -752,7 +752,9 @@
>>         &&  visible()) but is faster.
>>         \retval 0 if the widget takes no events
>>      */
>> -  unsigned int takesevents() const {return
>> !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
>> +  unsigned int takesevents() const {
>> +    return !output()&&  active_r()&&  visible_r();
>> +  }
>
> Well, I don't know what is going on there, but reading the comment in
> the source, it looks as if that would be expected to be OK, but clearly
> the behaviour has changed...
>
> The comment is perhaps now wrong - it says the takesevents() method is
> "faster" than explicitly doing the things that it now actually does... I
> guess the old method (that simply tested the flags) may well have been
> faster though!

Much faster (for some value of faster, according to current processor
speeds). The previous version did one bit check (avoiding the mentioned
three function calls that were all probably inlined), and the docs
said that this was faster. The new version does this also for all
parents recursively!

> It seems Matt has looked at this recently, and I think Manolo was too,
> so they maybe have a better grasp of what is going on (I hope! I know
> I'm lost here...)

Yep, it was Matt's patch that changed the focus behavior (STR #2420),
and we have two related STR's (#2574 and #2591) now. I'm still
investigating...

The point WRT STR #2591's changed focus behavior is that now (after
the fix for STR #2420) it is not possible anymore to call take_focus()
for a widget that is not yet shown (like it was done in fl_ask.cxx).
This is likely to break other users' code as well.

However, I believe that the key point is the "faster" argument you
mentioned in the docs, and that this was *intended*.

Hence the mentioned fix is questionable, because it makes event delivery
slower than before. I'll write more about this soon, when I can find
the time, hopefully tonight or at the weekend. I'm confident that there
is a better solution for STR #2420, and I'm working on this as well.

Albrecht
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to