FLTK logo

Re: [fltk.coredev] RFC: Fl::focus(Fl_Widget*) should be independent of Fl_Widget::visible_focus()

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: RFC: Fl::focus(Fl_Widget*) should be independent of Fl_Widget::visible_focus() Bill Spitzak Jan 11, 2022  
 
I would not worry about user code

On Tue, Jan 11, 2022 at 3:35 PM Albrecht Schlosser <AlbrechtS.fltk@online.de> wrote:
On 1/12/22 12:01 AM Bill Spitzak wrote:
Make sure nothing calling it is relying on that test failing (for instance maybe that is how navigation skips the widgets).

I'm in a process of checking this. However we can never know if user code was calling the wrong function. TAB navigation must find a widget that accepts the focus, i.e. it must already use take_focus() or check it before it calls Fl::focus() and thus we're safe here because otherwise it would not work at all.

I agree it should be unconditional and any such tests moved to the calling code.

Thanks for your comment, I appreciate this very much.


On Tue, Jan 11, 2022 at 5:03 AM Albrecht Schlosser <AlbrechtS.fltk@online.de> wrote:
All,

I filed issue #366 "Fl::focus(Fl_Widget*) should be independent of Fl_Widget::visible_focus()"
https://github.com/fltk/fltk/issues/366

Abstract:

"Setting the focus to a widget that has disabled keyboard navigation by calling Fl_Widget::clear_visible_focus() or Fl_Widget::visible_focus(0) fails because Fl::focus(Fl_Widget*) tests the Fl_Widget::visible_focus() attribute. This should not be done since Fl::focus(Fl_Widget*) should set the focus to the widget unconditionally."

For further information and links to documentation and code please see the GitHub issue (link above).

I suggest to remove the offending statement
(https://github.com/fltk/fltk/blob/42a93eb8dec6e3c637442e23e156b3f72c7f8ca7/src/Fl.cxx#L829)

if (o && !o->visible_focus()) return;

but I wanted to ask for comments and opinions first.

This check exists since the new VISIBLE_FOCUS flag had been introduced in 2002 but I believe that this is a bug.
https://github.com/fltk/fltk/blob/57cef6a4bde017e205e54271e769de0db596d893/src/Fl.cxx#L422

A related issue is
issue #365 "Make class Fl_Simple_Terminal refuse the focus"
https://github.com/fltk/fltk/issues/365

Comments, anybody?

Please use this thread for discussion or add a comment to the GitHub issue. Thanks.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/108e79aa-46aa-f98c-eebd-da9d13e3774c%40online.de.
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/CAL-8oAi2WjCapszXWJHqM_5gDP4vHTf5509m%2BX0Fskm5R4dEEg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/c3a17afb-2b50-9990-86ff-b094113d2fab%40online.de.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/CAL-8oAj%2BjrBWt-gRH9sk0WT0Jmf1YB6U3Wm1cFC9cyFwx551qQ%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.