Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fltk/fltk/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
FLTK 1.4 and later support the Wayland display protocol as an alternative to X11. Wayland provides a modern display server architecture with improved security and performance.Supported Platforms
- Linux - Debian, Ubuntu, Fedora, and other distributions
- FreeBSD - Version 13.1 and later
Tested Compositors
- Mutter - GNOME’s Wayland compositor
- Weston - Reference Wayland compositor
- KWin - KDE Plasma’s compositor
- Sway - i3-compatible Wayland compositor
Runtime Backend Selection
FLTK automatically selects the best available display backend at runtime:- Wayland if a compositor is available
- X11 as fallback if Wayland is unavailable
Environment Variable Control
UseFLTK_BACKEND to control backend selection:
Build Configuration
Default Build
By default, CMake builds a hybrid Wayland/X11 library when all required packages are available:Wayland-Only Build
To build without X11 support (useful for pure Wayland systems):This is useful when cross-compiling for systems without X11 headers and libraries.
X11-Only Build
To disable Wayland support and build for X11 only:Disabling Wayland in Your Application
For applications using X11-specific APIs, disable Wayland at compile time:- GCC/Clang
- CMake
Platform-Specific Setup
Debian/Ubuntu/Mint/Raspberry Pi OS
Requires Debian 11 (Bullseye) or Ubuntu 20.04 (Focal Fossa) or later.
GNOME-Wayland Desktop
KDE Plasma-Wayland Desktop
Fedora
Wayland support requires Fedora 35 or later.
FreeBSD
Tested on FreeBSD 13.1 with the Sway compositor.
Window Decorations (libdecor)
FLTK uses libdecor to handle window decorations (titlebars, borders).Using System libdecor
Recent distributions provide libdecor packages:FLTK requires libdecor version 0.2.0 or later.
Bundled libdecor
If system libdecor is unavailable or too old, FLTK uses a bundled version automatically.Decoration Modes
libdecor supports two decoration modes:- CSD (Client-Side Decorations) - Application draws its own titlebar
- Used by: Mutter (GNOME), Weston
- SSD (Server-Side Decorations) - Compositor draws the titlebar
- Used by: KWin (KDE), Sway
Graphics and Text Rendering
When using Wayland, FLTK renders with:- Cairo - Vector graphics and 2D drawing
- Pango - Text rendering and layout
- EGL - OpenGL integration
- Cairo - Vector graphics (same as Wayland)
- Pango - Text rendering (same as Wayland)
- Xlib - Window management
Known Limitations
Window Positioning
Wayland prevents applications from knowing or controlling their exact screen position. Popup windows (menus, tooltips) can be positioned relative to other windows and work correctly.Window State
- Cannot detect if a window is minimized
- Cannot programmatically unminimize a window
Fl_Window::show()has no effect on minimized windows
Clipboard
The clipboard API works, but:Fl::add_clipboard_notify()has no effect (cannot detect clipboard changes)- Copy operations work best when the application has focus
- Copy operations after losing focus only work if the data type (text/image) matches the last type copied while focused
Titlebar Width
Narrow windows are forced to be wide enough for the titlebar to display buttons and title text.OpenGL on Raspberry Pi
OpenGL inside Wayland windows may not work on Raspberry Pi hardware, though it works with X11 on the same hardware.Drag-and-Drop on KDE
Drag-and-drop from subwindows doesn’t work under KDE/Plasma (likely a KWin bug). See FLTK issue #997 for a workaround.Testing Your Setup
Verify Wayland is working:Debugging
Enable Wayland debugging:Migration from X11
Most FLTK code works unchanged with Wayland. Exceptions:Platform-Specific Code
- Before (X11-only)
- After (Wayland/X11)
Window Positioning
Replace absolute positioning with relative positioning:- Before
- After