FLTK logo

Re: [fltk.coredev] Exploration: FLTK platform compatible with both Wayland and X11

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: Exploration: FLTK platform compatible with both Wayland and X11 Albrecht Schlosser Mar 29, 2022  
 
On 3/29/22 19:27 Manolo wrote:
Here is a complete proposal for a hybrid Wayland/X11 FLTK library ready for  release with FLTK 1.4,
along the line sketched by Albrecht above.
It's available in branch wayland of

It contains support for an environment variable FLTK_BACKEND to pilot what is used at run-time:
- if FLTK_BACKEND is undefined, the library uses wayland if available and x11 otherwise;
- if FLTK_BACKEND = wayland, the library uses Wayland if possible and exits with error otherwise;
- if FLTK_BACKEND = x11, the library uses X11 even if Wayland is available;
- if FLTK_BACKEND has another value, the library exits with an error message.

It contains also function fl_disable_wayland(), to be called early in main(), to force an app to use
X11 without using the FLTK_BACKEND variable, as Albrecht suggested.

Here is a very detailed (and very long) description of changes, their reason, their impact,
for all platform-dependent types and global variables which are part of the FLTK 1.3 public API.
OLD means the public API of FLTK 1.3; NEW means the public API of FLTK 1.4.

Manolo, thank you very much for this great work and the informative description. I'll try to look into the details tomorrow (Wed) or on Thursday.

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...

...

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.


FL_SOCKET, fl_intptr_t and fl_uintptr_t   <=== no change needed

The definition of FL_SOCKET and its usage in the public API is a problem of its own, but this has nothing to do with the introduction of Wayland or the hybrid FLTK library, so yes, no change needed here (now).

Everything else looks really good (by reading your description). Great Job!

--
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/9ae3ffc8-f6fc-324a-810e-89dde3a1e72f%40online.de.
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'.