Am 19.10.22 um 22:21 schrieb zbearicus96:
>
> 2. If I click on another application to set focus there, keyboard entry goes to the other application as expected.
>
> 3. I can then move the mouse over the fltk application for hours on end without any widget getting focus (good) and Fl::focus() reports 0 in the log.
>
> 4. But if I roll the mousewheel with the mouse over an Fl_Value_Slider, two things happen:
>
> a. The slider value changes (OK, but wish it didn't)
This behavior seems to be common in UI's and can be seen with other applications too e.g. you can scroll in a (not focused) terminal window with the mouse wheel.
I don't think there is an easy way to disable it generally in FLTK - except you can probably get rid of it in a derived custom widget that overrides the handle() method.
>
> b. fltk seems to re-initiate its 'give the focus to some widget' process, and a widget that can accept text input gets focus (I can tell this from log messages).
>
> 5. The log messages show that the widget has focus, but no keyboard events are delivered to it and text I enter continues to appear on the other application that from a title bar perspective really does have focus. The widget getting focus is an Fl_Float_Input.
>
> 6. To unscrew this situation (enable me to actually enter something into the Fl_Float_Input), I have to click in the Fl_Float_Input widget. At that point the widget REALLY has focus from a keyboard event delivery perspective.
>
>
I think you may have found a "bug" here in FLTK: A text input widget displaying the text cursor even when it does not have the X11 input focus is IMHO a misleading signal to the user.
But: this "bug" is a very old one - it can be found even in FLTK 1.1.10.
I have experimented a little with it and observed how to reproduce it easily:
- Use any of the FLTK test program with an input widget e.g. the `editor` or `input` programs.
- When the input widget has the text focus raise another window on your desktop (e.g. a terminal) so the cursor goes away from the input field
- Move the mouse over the test program somewhere and just scroll the mouse wheel
- Leave the window with the mouse and then re-enter it: the input cursor appears! But the input widget does not receive keyboard events
I have also found, that commenting out this line:
https://github.com/fltk/fltk/blob/master/src/Fl.cxx#L1457
seems to fix it, but of course there may be and probably will be side effects. Experts anyone?