2022-10-21 20:04:03 +03:00
|
|
|
README.Wayland.txt - Wayland Platform Support for FLTK
|
2022-03-04 17:40:29 +03:00
|
|
|
------------------------------------------------------
|
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Contents
|
2022-03-04 17:40:29 +03:00
|
|
|
========
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
1 Introduction
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2 Wayland Support for FLTK
|
2022-03-04 17:40:29 +03:00
|
|
|
2.1 Configuration
|
2022-03-15 08:42:06 +03:00
|
|
|
2.2 Known Limitations
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3 Preparing Platform Specific Code for the Wayland Platform
|
|
|
|
3.1 Handling X11 specific Source Code
|
|
|
|
3.2 Handling X11 and Wayland Specific Source Code in the Same App
|
|
|
|
3.3 Forcing an FLTK App to Always Use the X11 Backend
|
2022-03-15 08:42:06 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
4 Platform Specific Notes
|
2022-03-15 08:42:06 +03:00
|
|
|
4.1 Debian and Derivatives (like Ubuntu)
|
|
|
|
4.2 Fedora
|
|
|
|
4.3 FreeBSD
|
2022-03-04 17:40:29 +03:00
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
1 Introduction
|
2022-03-04 17:40:29 +03:00
|
|
|
==============
|
|
|
|
|
|
|
|
Version 1.4 of the FLTK library introduces support of the public FLTK API on
|
2022-05-19 18:18:53 +03:00
|
|
|
the Wayland platform. It requires a Wayland-equipped OS, namely Linux or FreeBSD.
|
2022-03-04 17:40:29 +03:00
|
|
|
Pre-existing platform-independent source code for FLTK 1.3.x should build and
|
|
|
|
run unchanged with FLTK 1.4 and the Wayland platform.
|
2022-12-13 17:22:24 +03:00
|
|
|
The code has been tested on Debian, Ubuntu, RaspberryPiOS and Fedora with
|
|
|
|
3 distinct Wayland compositors: mutter (Gnome's compositor), weston, and KDE.
|
2022-05-24 12:41:00 +03:00
|
|
|
The code has also been tested under FreeBSD and the sway wayland compositor.
|
2022-03-04 17:40:29 +03:00
|
|
|
CJK text-input methods, as well as dead and compose keys are supported.
|
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2 Wayland Support for FLTK
|
2022-03-04 17:40:29 +03:00
|
|
|
==========================
|
|
|
|
|
2022-11-18 11:10:22 +03:00
|
|
|
On Linux and FreeBSD systems, the FLTK library is by default configured so FLTK apps
|
2022-10-08 18:59:06 +03:00
|
|
|
do all their windowing through the Wayland protocol, all their graphics with
|
|
|
|
Cairo or EGL, and all text-drawing with Pango. If no Wayland compositor is
|
|
|
|
available at run-time, FLTK apps fall back to using X11 for windowing.
|
|
|
|
Cairo and Pango remain used for graphics and text, respectively.
|
2022-03-15 08:42:06 +03:00
|
|
|
|
|
|
|
Environment variable FLTK_BACKEND can be used to control whether Wayland or
|
|
|
|
X11 is used at run time as follows:
|
|
|
|
- if FLTK_BACKEND is not defined, Wayland is used when possible, otherwise
|
|
|
|
X11 is used;
|
2022-10-08 18:59:06 +03:00
|
|
|
- if $FLTK_BACKEND equals "wayland", the library stops with error if no
|
2022-03-15 08:42:06 +03:00
|
|
|
Wayland compositor is available;
|
2022-10-08 18:59:06 +03:00
|
|
|
- if $FLTK_BACKEND equals "x11", the library uses X11 even if a Wayland
|
2022-03-15 08:42:06 +03:00
|
|
|
compositor is available;
|
2022-10-08 18:59:06 +03:00
|
|
|
- if $FLTK_BACKEND has another value, the library stops with error.
|
|
|
|
|
|
|
|
See also 3.3 below for another way to control whether Wayland or X11 is used.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-09-10 08:44:23 +03:00
|
|
|
On pure Wayland systems without the X11 headers and libraries, FLTK can be built
|
|
|
|
with its Wayland backend only (see below).
|
|
|
|
|
2022-03-04 17:40:29 +03:00
|
|
|
2.1 Configuration
|
2022-03-15 08:42:06 +03:00
|
|
|
------------------
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-11-18 11:10:22 +03:00
|
|
|
On Linux and FreeBSD systems equipped with the adequate software packages
|
|
|
|
(see section 4 below), the default building procedure produces a Wayland/X11
|
|
|
|
hybrid library. On systems lacking all or part of Wayland-required packages,
|
|
|
|
the default building procedure produces a X11-based library.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-11-18 11:10:22 +03:00
|
|
|
Use -DOPTION_USE_WAYLAND=OFF with CMake or "configure --disable-wayland" to build
|
|
|
|
FLTK for the X11 library when the default would build for Wayland.
|
2022-03-31 17:00:11 +03:00
|
|
|
|
2022-11-18 11:10:22 +03:00
|
|
|
CMake OPTION_WAYLAND_ONLY or "--disable-x11" configure argument can
|
|
|
|
be used to produce a Wayland-only library which can be useful, e.g., when
|
|
|
|
cross-compiling for systems that lack X11 headers and libraries.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
The FLTK Wayland platform uses a library called libdecor which handles window decorations
|
2022-03-04 17:40:29 +03:00
|
|
|
(i.e., titlebars, shade). Libdecor is bundled in the FLTK source code and FLTK uses by default
|
2022-11-18 11:10:22 +03:00
|
|
|
this form of libdecor. CMake OPTION_USE_SYSTEM_LIBDECOR can be turned on to have FLTK
|
2022-03-04 17:40:29 +03:00
|
|
|
use the system's version of libdecor which is available on recent Linux distributions (e.g.,
|
2022-03-15 08:42:06 +03:00
|
|
|
Debian Bookworm or more recent in packages libdecor-0-0 and libdecor-0-plugin-1-cairo).
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
2.2 Known Limitations
|
|
|
|
----------------------
|
2022-03-04 17:40:29 +03:00
|
|
|
|
|
|
|
* A deliberate design trait of Wayland makes application windows ignorant of their exact
|
2022-03-14 09:52:13 +03:00
|
|
|
placement on screen. It's possible, though, to position a popup window relatively to
|
|
|
|
another window. This allows FLTK to properly position menu and tooltip windows. But
|
|
|
|
Fl_Window::position() has no effect on other top-level windows.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
|
|
|
* With Wayland, there is no way to know if a window is currently minimized, nor is there any
|
|
|
|
way to programmatically unset minimization of a window. Consequently, Fl_Window::show() of
|
|
|
|
a minimized window has no effect.
|
|
|
|
|
2022-09-10 08:44:23 +03:00
|
|
|
* Although the FLTK API to read from and write to the system clipboard is fully functional,
|
|
|
|
it's currently not possible for an app to be notified of changes to the content of
|
|
|
|
the system clipboard, that is, Fl::add_clipboard_notify() has no effect.
|
2022-03-14 09:52:13 +03:00
|
|
|
|
2022-06-08 17:41:08 +03:00
|
|
|
* With GTK-style window titlebars, narrow windows are silently forced to be wide enough
|
|
|
|
for the titlebar to display window buttons and a few letters of the title.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
|
|
|
* The library should support multi-display configurations in principle, but has not been
|
|
|
|
tested in that situation.
|
|
|
|
|
|
|
|
* Text input methods have been tested without any understanding of the writing systems,
|
|
|
|
so feedback on this subject would be helpful.
|
|
|
|
|
2022-12-13 17:22:24 +03:00
|
|
|
* Using OpenGL inside Wayland windows doesn't seem to work on RaspberryPi hardware,
|
|
|
|
although it works inside X11 windows on the same hardware.
|
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3 Preparing Platform Specific Code for the Wayland Platform
|
2022-03-15 08:42:06 +03:00
|
|
|
===========================================================
|
|
|
|
|
|
|
|
While platform-independent source code prepared for FLTK 1.3 is expected
|
|
|
|
to be compatible with no change with FLTK 1.4 and the Wayland platform,
|
2022-10-08 18:59:06 +03:00
|
|
|
X11-specific source code may require some attention.
|
2022-03-15 08:42:06 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3.1 Handling X11 specific Source Code
|
2022-03-15 08:42:06 +03:00
|
|
|
-------------------------------------
|
|
|
|
|
|
|
|
If an FLTK 1.4 application contains X11-specific code, execution of this code
|
|
|
|
in the context of an active Wayland session can produce malfunctions or program crashes.
|
|
|
|
To ensure that X11-specific code gets called only when an X11 connection is active,
|
|
|
|
check that function fl_x11_display() returns non-NULL before using any X11-specific
|
|
|
|
function or variable.
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3.2 Handling X11 and Wayland Specific Source Code in the Same App
|
|
|
|
-----------------------------------------------------------------
|
2022-03-15 08:42:06 +03:00
|
|
|
|
|
|
|
The recommended way to prepare and use platform-specific code that would contain
|
2022-11-18 11:10:22 +03:00
|
|
|
X11-specific and possibly Wayland-specific parts is as follows :
|
2022-03-15 08:42:06 +03:00
|
|
|
|
|
|
|
a) Organize platform-specific code as follows :
|
|
|
|
|
|
|
|
#include <FL/platform.H>
|
|
|
|
|
2022-03-04 17:40:29 +03:00
|
|
|
#ifdef __APPLE__
|
|
|
|
*** macOS-specific code ***
|
|
|
|
#elif defined(_WIN32)
|
|
|
|
*** Windows-specific code ***
|
|
|
|
#else
|
2022-11-18 11:10:22 +03:00
|
|
|
# ifdef FLTK_USE_X11
|
2022-10-08 18:59:06 +03:00
|
|
|
*** X11-specific code ***
|
2022-11-18 11:10:22 +03:00
|
|
|
# endif
|
|
|
|
# ifdef FLTK_USE_WAYLAND
|
2022-10-08 18:59:06 +03:00
|
|
|
*** Wayland-specific code ***
|
2022-11-18 11:10:22 +03:00
|
|
|
# endif
|
2022-03-04 17:40:29 +03:00
|
|
|
#endif
|
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
b) Make sure to use distinct names for global variables and functions
|
|
|
|
in the X11- and the Wayland-specific sections.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
c) Check that function fl_x11_display() returns non-NULL before using any X11-specific
|
|
|
|
function or variable, and that fl_wl_display() returns non-NULL before using any
|
|
|
|
Wayland-specific function or variable. Make sure that fl_open_display() was called
|
|
|
|
directly or indirectly before using any such symbol.
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3.3 Forcing an FLTK App to Always Use the X11 Backend
|
2022-09-10 08:44:23 +03:00
|
|
|
-----------------------------------------------------
|
2022-03-15 08:42:06 +03:00
|
|
|
|
2022-10-08 18:59:06 +03:00
|
|
|
Alternatively, it is possible to force a program linked to a Wayland-enabled
|
|
|
|
FLTK library to use X11 in all situations by putting this declaration somewhere
|
|
|
|
in the source code :
|
|
|
|
FL_EXPORT bool fl_disable_wayland = true;
|
|
|
|
FLTK source code and also X11-specific source code conceived for FLTK 1.3
|
|
|
|
should run with a Wayland-enabled, FLTK 1.4 library with that single change only.
|
2022-03-15 08:42:06 +03:00
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
4 Platform Specific Notes
|
2022-03-04 17:40:29 +03:00
|
|
|
=========================
|
|
|
|
|
|
|
|
The following are notes about building FLTK for the Wayland platform
|
2022-03-15 08:42:06 +03:00
|
|
|
on the various supported Linux distributions/OS.
|
|
|
|
|
2022-12-13 17:22:24 +03:00
|
|
|
4.1 Debian and Derivatives (like Ubuntu, RaspberryPiOS)
|
|
|
|
-------------------------------------------------------
|
2022-03-04 17:40:29 +03:00
|
|
|
|
|
|
|
Under Debian, the Wayland platform requires version 11 (a.k.a. Bullseye) or more recent.
|
2022-03-15 08:42:06 +03:00
|
|
|
Under Ubuntu, the Wayland platform is known to work with version 20.04 (focal fossa) or
|
|
|
|
more recent.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-11-24 14:14:30 +03:00
|
|
|
These packages are necessary to build the FLTK library, in addition to those listed
|
|
|
|
in section 2.1 of file README.Unix.txt :
|
2022-03-04 17:40:29 +03:00
|
|
|
- make
|
|
|
|
- libpango1.0-dev
|
|
|
|
- libwayland-dev
|
|
|
|
- wayland-protocols
|
|
|
|
- libdbus-1-dev
|
|
|
|
- libxkbcommon-dev
|
2022-12-12 19:31:06 +03:00
|
|
|
- libxinerama-dev
|
2022-11-24 14:14:30 +03:00
|
|
|
- libgtk-3-dev <== highly recommended, gives windows a GTK-style titlebar
|
2022-03-04 17:40:29 +03:00
|
|
|
- libglew-dev <== necessary to use OpenGL version 3 or above
|
|
|
|
- cmake <== if you plan to build with CMake
|
|
|
|
- cmake-qt-gui <== if you plan to use the GUI of CMake
|
|
|
|
|
2022-04-07 18:14:47 +03:00
|
|
|
This package is necessary to run FLTK apps under the Gnome-Wayland desktop:
|
2022-11-24 14:14:30 +03:00
|
|
|
- gnome-core
|
2022-03-04 17:40:29 +03:00
|
|
|
|
|
|
|
These packages allow to run FLTK apps under the KDE/Plasma-Wayland desktop:
|
|
|
|
- kde-plasma-desktop
|
|
|
|
- plasma-workspace-wayland
|
2022-03-22 10:16:42 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Package installation command: sudo apt-get install <package-name ...>
|
|
|
|
|
2022-03-22 10:16:42 +03:00
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
4.2 Fedora
|
|
|
|
----------
|
2022-03-22 10:16:42 +03:00
|
|
|
|
|
|
|
The Wayland platform is known to work with Fedora version 35.
|
|
|
|
|
2022-11-24 14:14:30 +03:00
|
|
|
These packages are necessary to build the FLTK library, in addition to
|
|
|
|
package groups listed in section 2.2 of file README.Unix.txt :
|
2022-03-22 18:24:26 +03:00
|
|
|
- autoconf
|
2022-03-22 10:16:42 +03:00
|
|
|
- wayland-devel
|
|
|
|
- wayland-protocols-devel
|
|
|
|
- cairo-devel
|
|
|
|
- libxkbcommon-devel
|
|
|
|
- pango-devel
|
|
|
|
- dbus-devel
|
|
|
|
- mesa-libGLU-devel
|
2022-11-24 14:14:30 +03:00
|
|
|
- gtk3-devel <== highly recommended, gives windows a GTK-style titlebar
|
2022-03-22 10:16:42 +03:00
|
|
|
- glew-devel <== necessary to use OpenGL version 3 or above
|
|
|
|
- cmake <== if you plan to build with CMake
|
|
|
|
- cmake-gui <== if you plan to use the GUI of CMake
|
|
|
|
|
|
|
|
Package installation command: sudo yum install <package-name ...>
|
2022-05-19 18:18:53 +03:00
|
|
|
|
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
4.3 FreeBSD
|
|
|
|
-----------
|
2022-05-19 18:18:53 +03:00
|
|
|
|
2022-05-22 21:10:16 +03:00
|
|
|
The Wayland platform is known to work with FreeBSD version 13.1 and the sway compositor.
|
2022-05-19 18:18:53 +03:00
|
|
|
|
|
|
|
These packages are necessary to build the FLTK library and the sway compositor:
|
2022-11-24 14:14:30 +03:00
|
|
|
git autoconf pkgconf xorg urwfonts gnome glew seatd sway dmenu-wayland dmenu evdev-proto
|
|
|
|
|
|
|
|
Package installation command: sudo pkg install <package-name ...>
|
2022-05-19 18:18:53 +03:00
|
|
|
|
2022-11-18 11:10:22 +03:00
|
|
|
If FLTK is built using the configure/make procedure, include argument "--enable-localzlib"
|
|
|
|
in the "configure" command.
|