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
|
2023-12-21 21:13:49 +03:00
|
|
|
2.1 Disabling Wayland for Backwards Compatibility
|
|
|
|
2.2 Configuration
|
|
|
|
2.3 Known Limitations
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2023-03-21 12:43:53 +03:00
|
|
|
3 Platform Specific Notes
|
2023-04-04 10:59:28 +03:00
|
|
|
3.1 Debian and Derivatives (like Ubuntu, Mint, RaspberryPiOS)
|
2023-03-21 12:43:53 +03:00
|
|
|
3.2 Fedora
|
|
|
|
3.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
|
2023-07-28 16:27:38 +03:00
|
|
|
3 distinct Wayland compositors: Mutter (Gnome's compositor), Weston, and KWin.
|
2023-03-21 12:43:53 +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.
|
|
|
|
|
2023-12-21 21:13:49 +03:00
|
|
|
On pure Wayland systems without the X11 headers and libraries, FLTK can be built
|
|
|
|
with its Wayland backend only (see below).
|
|
|
|
|
|
|
|
|
|
|
|
2.1 Disabling Wayland for Backwards Compatibility
|
|
|
|
---------------------------------------------------
|
|
|
|
|
|
|
|
Programs using X11 specific functions may need to disable the automatic
|
|
|
|
detection of Wayland at runtime so they fall back to X11 only.
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
2023-03-21 12:43:53 +03:00
|
|
|
FL_EXPORT bool fl_disable_wayland = true;
|
2023-12-21 21:13:49 +03:00
|
|
|
|
2023-03-21 12:43:53 +03:00
|
|
|
FLTK source code and also X11-specific source code conceived for FLTK 1.3
|
2023-12-21 21:13:49 +03:00
|
|
|
should run with a Wayland-enabled FLTK 1.4 library with this single change.
|
|
|
|
|
|
|
|
|
|
|
|
Caveat: when building a user project with the requirement to use CMake
|
|
|
|
version 3.4 or higher, i.e. using
|
|
|
|
|
|
|
|
cmake_minimum_required (VERSION 3.4)
|
|
|
|
|
|
|
|
or any higher (minimum) CMake version users need to use at least one of
|
|
|
|
the following options:
|
|
|
|
|
|
|
|
Option 1: Set target property 'ENABLE_EXPORTS' on all executable
|
|
|
|
targets that require it to disable the Wayland backend.
|
|
|
|
This is the preferred solution.
|
|
|
|
|
|
|
|
CMake example:
|
|
|
|
|
|
|
|
set_target_properties(prog PROPERTIES ENABLE_EXPORTS TRUE)
|
|
|
|
|
|
|
|
Option 2: Set CMake policy CMP0065 to 'OLD' (to pre-3.4 behavior)
|
|
|
|
This is a quick solution but discouraged because setting
|
|
|
|
CMake policies to 'OLD' is deprecated by definition.
|
|
|
|
|
|
|
|
CMake code:
|
|
|
|
|
|
|
|
cmake_policy(SET CMP0065 OLD)
|
|
|
|
|
|
|
|
Option 3: Set CMake variable 'CMAKE_ENABLE_EXPORTS' to 'TRUE'.
|
|
|
|
Note: use this to be compatible with CMake < 3.27.
|
|
|
|
|
|
|
|
Option 4: Set CMake variable 'CMAKE_EXECUTABLE_ENABLE_EXPORTS' to 'TRUE'.
|
|
|
|
Note: new in CMake 3.27, ignored in older versions.
|
|
|
|
|
|
|
|
Options 3 and 4 can be used as quick solutions like option 2 but these
|
|
|
|
options affect all targets that are created while the CMake variable is
|
|
|
|
set. As said above, option 1 should be preferred.
|
|
|
|
|
|
|
|
This applies to the FLTK test and demo programs as well, hence we use
|
|
|
|
option 1 in our build system.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2022-09-10 08:44:23 +03:00
|
|
|
|
2023-12-21 21:13:49 +03:00
|
|
|
2.2 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
|
2023-03-21 12:43:53 +03:00
|
|
|
(see section 3 below), the default building procedure produces a Wayland/X11
|
2022-11-18 11:10:22 +03:00
|
|
|
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
|
|
|
|
2024-03-13 19:31:06 +03:00
|
|
|
Use "-D FLTK_BACKEND_WAYLAND=OFF" with CMake or "configure --disable-wayland"
|
2024-02-07 20:30:11 +03:00
|
|
|
to build FLTK for the X11 library when the default would build for Wayland.
|
2022-03-31 17:00:11 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
CMake option FLTK_BACKEND_X11=OFF or configure argument "--disable-x11" can
|
2022-11-18 11:10:22 +03:00
|
|
|
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
|
2023-12-01 16:43:32 +03:00
|
|
|
(i.e., titlebars, shade). On very recent Linux distributions (e.g., Debian trixie)
|
|
|
|
libdecor is available as Linux packages (libdecor-0-dev and libdecor-0-plugin-1-gtk).
|
2024-04-18 20:32:47 +03:00
|
|
|
FLTK requires version 0.2.0 or more recent of these packages.
|
|
|
|
When libdecor is not available or not recent enough, FLTK uses a copy of libdecor
|
|
|
|
bundled in the FLTK source code.
|
2023-07-23 18:08:40 +03:00
|
|
|
FLTK equipped with libdecor supports both the client-side decoration mode (CSD) and the
|
|
|
|
server-side decoration mode (SSD) as determined by the active Wayland compositor.
|
|
|
|
Mutter (gnome's Wayland compositor) and Weston use CSD mode, KWin and Sway use SSD mode.
|
|
|
|
Furthermore, setting environment variable LIBDECOR_FORCE_CSD to 1 will make FLTK use CSD
|
|
|
|
mode even if the compositor would have selected SSD mode.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2023-12-21 21:13:49 +03:00
|
|
|
2.3 Known Limitations
|
2022-03-15 08:42:06 +03:00
|
|
|
----------------------
|
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
|
|
|
|
2023-03-24 18:56:25 +03:00
|
|
|
* Copying data to the clipboard is best done when the app has focus. Any copy operation
|
2023-04-04 10:59:28 +03:00
|
|
|
performed when the app did not get the focus yet does not change the clipboard. A copy
|
|
|
|
operation performed when the app has lost the focus is successful only if the type of
|
|
|
|
the copied data, that is, text or image, is the same as the last data type copied when
|
|
|
|
the app had the focus.
|
2023-03-24 18:56:25 +03:00
|
|
|
|
2023-03-13 12:38:28 +03:00
|
|
|
* Narrow windows with a titlebar are silently forced to be wide enough
|
2022-06-08 17:41:08 +03:00
|
|
|
for the titlebar to display window buttons and a few letters of the title.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2024-04-27 08:27:57 +03:00
|
|
|
* Text input methods are known to work well for Chinese and Japanese.
|
|
|
|
Feedback for other writing systems would be helpful.
|
2022-03-04 17:40:29 +03:00
|
|
|
|
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
|
|
|
|
2023-03-21 12:43:53 +03:00
|
|
|
3 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.
|
|
|
|
|
2023-04-04 10:59:28 +03:00
|
|
|
3.1 Debian and Derivatives (like Ubuntu, Mint, RaspberryPiOS)
|
|
|
|
-------------------------------------------------------------
|
2022-03-04 17:40:29 +03:00
|
|
|
|
|
|
|
Under Debian, the Wayland platform requires version 11 (a.k.a. Bullseye) or more recent.
|
2023-04-02 17:15:58 +03:00
|
|
|
Under Ubuntu, the Wayland platform requires 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
|
|
|
|
- libxkbcommon-dev
|
2024-03-13 19:31:06 +03:00
|
|
|
- libxinerama-dev <== except if option FLTK_BACKEND_X11=off is used
|
2024-05-09 12:54:22 +03:00
|
|
|
- libdbus-1-dev <== recommended to query current cursor theme
|
|
|
|
- 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
|
|
|
|
- libdecor-0-dev <== recommended if available and if in version ≥ 0.2.0
|
|
|
|
- libgtk-3-dev <== highly recommended if libdecor-0-dev is not installed
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2023-04-04 10:59:28 +03:00
|
|
|
These packages allow to run FLTK apps under the Gnome-Wayland desktop:
|
2022-11-24 14:14:30 +03:00
|
|
|
- gnome-core
|
2024-05-09 12:54:22 +03:00
|
|
|
- libdecor-0-plugin-1-gtk <== install if libdecor-0-dev is installed
|
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
|
|
|
|
2023-03-21 12:43:53 +03:00
|
|
|
3.2 Fedora
|
2022-03-15 08:42:06 +03:00
|
|
|
----------
|
2022-03-22 10:16:42 +03:00
|
|
|
|
2023-04-02 17:15:58 +03:00
|
|
|
The Wayland platform is known to work with Fedora version 35 or more recent.
|
2022-03-22 10:16:42 +03:00
|
|
|
|
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
|
|
|
|
- mesa-libGLU-devel
|
2024-05-09 12:54:22 +03:00
|
|
|
- dbus-devel <== recommended to query current cursor theme
|
|
|
|
- libdecor-devel <== recommended, draws window titlebars
|
|
|
|
- gtk3-devel <== highly recommended if libdecor-devel is not installed
|
|
|
|
- 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
|
2022-03-22 10:16:42 +03:00
|
|
|
|
|
|
|
Package installation command: sudo yum install <package-name ...>
|
2022-05-19 18:18:53 +03:00
|
|
|
|
|
|
|
|
2023-03-21 12:43:53 +03:00
|
|
|
3.3 FreeBSD
|
2022-03-15 08:42:06 +03:00
|
|
|
-----------
|
2022-05-19 18:18:53 +03:00
|
|
|
|
2023-03-21 12:43:53 +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
|
|
|
|
2023-03-21 12:43:53 +03:00
|
|
|
These packages are necessary to build the FLTK library and use 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 ...>
|