Le mardi 29 mars 2022 à 21:29:31 UTC+2, Albrecht Schlosser a écrit :
I'm picking only a few statements where I have questions or
annotations for my comment(s) below. Everything else looks good and
clear so far from reading.
Functions fl_<platform>_find() are put in files
scr/drivers/<platform>/fl_<platform>_platform_init.cxx.
For the hybrid Wayland/X11 library, both fl_wl_find() and
fl_x11_find() functions are
in file src/drivers/Wayland/fl_wayland_platform_init.cxx
I'm wondering why these functions are not in separate, i.e. their
own per-platform files. However, I did not look at the code yet...
That's right. I've now moved a bunch of such functions to per-platform driver files.
Platform-specific code in FLTK 1.3 app that did, for
example
#include <FL/platform.H>
#if FLTK_USE_X11
Window xwin = fl_window;
X11_function_with_Window_typed_argument(xwin);
#endif
remains possible.
In FLTK 1.3 we didn't have FLTK_USE_X11 yet. As I described before
user code would very likely handle the X11 platform in the #else
clause which has been a big problem of FLTK up to 1.3.x (IIRC Bill
wrote that this was solved for 2.0 as well).
So, what we need to have would be that code like the following would
still work:
#if defined(_WIN32)
... windows code
#elif defined (__APPLE__)
... macOS code
#else
... X11 specific code
#endif
Such "legacy programs" would presumably need to call
fl_disable_wayland() which would definitely be a (minor) source code
change, but then ... would they work w/o other changes if
they only used X11 specific code like in 1.3 in the #else clause?
This would be a great achievement for migration from 1.3 to 1.4
while still being able to use a hybrid FLTK library.
I've just been lazy to write the full series of #if defined() directives.
The new code is intended to support the old writing without FLTK_USE_X11, because the new wayland.H includes X11/xlib.h.
Pre-existing 1.3 source code should run without change with the hybrid library, activate Wayland if it's present,
but loose in that situation the effects of any X11-specific source code they would contain.
With the single addition of a call to fl_disable_wayland(), it should run just as with an FLTK 1.3 library, but acquire HighDPI support,
as you had planed. That would also be possible without the fl_disable_wayland() call, setting FLTK_BACKEND=x11.