Fellow FLTK developers: please vote about addition of class Fl_Native_Input to FLTK 1.5.
New class Fl_Native_Input, located below Fl_Group in the widget tree, gives FLTK support
of right-to-left text input and edition. Its derived class Fl_Native_Multiline_Input handles
multiple-line text with scrollers and optional word wrapping of long lines.
Without these classes, FLTK draws correctly right-to-left text but is terribly
buggy when attempting to input, edit or select such text.
FLTK client programs can be adapted very easily to use the new class because its API is
the same as that of Fl_Input and Fl_Input_.
The idea is to arrange for FLTK to use an input widget each platform has in place
natively that is able to handle all scripts, right-to-left included. This way, FLTK
doesn't need to re-implement the tasks of text edition and line wrapping control that
become very complex to support all scripts. FLTK just inherits such features from the
platform software.
The proposed code supports all current FLTK platforms with the restriction under X11-only
that the FLTK_GRAPHICS_CAIRO build option need be ON. Noticeably, today's default FLTK
library under Linux/Unix which is the Wayland/X11 hybrid library fully supports the new widgets.
A fallback implementation of Fl_Native_Input is available for extant or future platforms
without native text input widget.
The new widget is available in branch "text_widget" of my FLTK fork
https://github.com/ManoloFLTK/fltkThe new code includes an example of use of Fl_Native_Input and Fl_Native_Multiline_Input
available with CMake option FLTK_BUILD_EXAMPLES=1 and typing
make native-input
@MoAlyousef tested the new widget and reported it handles Arabic text input OK.
New CMake option FLTK_OPTION_NATIVE_INPUT controls inclusion of both new widgets in
the FLTK library. It's ON by default.
The modified branch contains only additions to FLTK master except a 2-line change
of src/Fl_cocoa.mm necessary to handle a situation that could not occur previously
with the FLTK API. Therefore, the new code cannot break any extant FLTK client program.
More implementation details are available at
https://github.com/fltk/fltk/discussions/1174My vote is +1
Manolo