diff --git a/documentation/src/wayland.dox b/documentation/src/wayland.dox index 3c0a20437..8cf470c3a 100644 --- a/documentation/src/wayland.dox +++ b/documentation/src/wayland.dox @@ -190,6 +190,13 @@ FL_EXPORT bool fl_disable_wayland = true; anywhere in the source code, for the app to run with 1.4, using the x11 leg of the hybrid platform, without any other change in the source code nor to the application's environment. +Function \c attempt_wayland() must be called before the very first platform-dependent operation FLTK +performs so that operation is done the Wayland or the X11 way, as appropriate. That's why +4 locations of the FLTK source code call \c attempt_wayland(): +Fl_Graphics_Driver::newMainGraphicsDriver(), Fl_Screen_Driver::newScreenDriver(), +Fl_Window_Driver::newWindowDriver(Fl_Window*), and +Fl_Image_Surface_Driver::newImageSurfaceDriver(). + In special situations, such as with embedded systems equipped with the Wayland software but lacking the X11 library, it's possible to build the FLTK library such as it contains only the Wayland backend. This is achieved building FLTK with cmake -DFLTK_BACKEND_X11=OFF or with @@ -257,13 +264,16 @@ socket name; Which socket is selected determines the compositor used by the client application: that at the other end of the socket. -Function \c Fl_Wayland_Screen_Driver::open_display_platform() establishes the connection to the -Wayland socket identified above calling \c wl_display_connect(NULL) which returns a +Establishing the connection begins with a call to wl_display_connect(const char *display_name) +. That call is done inside function \c attempt_wayland() mentioned before with a NULL argument, +or when a non default Wayland display name is specified as explained above. That call returns a struct wl_display pointer or NULL in case of failure. Such NULL return is the hint that allows the FLTK display opening procedure of the Wayland/X11 hybrid to recognize when Wayland -access is not possible and to fallback to X11. +access is not possible and to fallback to X11. If the call is successful, its non-NULL return +is assigned to class variable \c Fl_Wayland_Screen_Driver::wl_display. -Then, function \c wl_registry_add_listener() associates a 2-member listener, whose 1st member, +The rest of the work is done in function \c Fl_Wayland_Screen_Driver::open_display_platform(). +A call to \c wl_registry_add_listener() associates a 2-member listener, whose 1st member, \c registry_handle_global(), will be called by Wayland a number of times to indicate each time a protocol supported by the compositor or a system feature such as displays and keyboards. @@ -1291,9 +1301,12 @@ For example, \c Fl_Wayland_Window_Driver::flush() needs to call