Skip to content

Fix X11 build against FLTK 1.4.5 (explicit platform/X11 includes)#95

Closed
wbniv wants to merge 2 commits into
Rangi42:masterfrom
wbniv:fix-fltk145-x11-includes
Closed

Fix X11 build against FLTK 1.4.5 (explicit platform/X11 includes)#95
wbniv wants to merge 2 commits into
Rangi42:masterfrom
wbniv:fix-fltk145-x11-includes

Conversation

@wbniv

@wbniv wbniv commented Jun 13, 2026

Copy link
Copy Markdown

Problem

Building the Linux (X11) target against FLTK 1.4.5 fails:

src/main-window.cpp: error: 'fl_display' was not declared in this scope
src/main-window.cpp: error: 'XA_CARDINAL' was not declared in this scope
src/main-window.h:  error: 'Pixmap' does not name a type

main-window.{cpp,h}, modal-dialog.cpp and option-dialogs.cpp use fl_display,
fl_xid, Pixmap and XA_CARDINAL under #ifndef _WIN32, but only <X11/xpm.h> is
included. The missing includes were introduced in
ea112f0
("Save and restore maximized window state in Linux (Xlib)") in 2021 — they were masked by
FLTK ≤ 1.4.4, which leaked these symbols transitively. FLTK 1.4.5 cleaned up its platform headers and stopped
leaking them, so the omission now causes a hard build failure.

Fix

Add the X11 / FLTK-platform includes to the shared src/utils.h (guarded #ifndef _WIN32),
so every translation unit that needs them gets them.

Build environment

Ubuntu 26.04, GCC 15, FLTK 1.4.5 built X11-only (FLTK_BACKEND_WAYLAND=0). Found while
packaging Tilemap Studio for Foundry Linux.

wbniv added 2 commits June 13, 2026 15:57
main-window, modal-dialog and option-dialogs use fl_display, fl_xid, Pixmap
and XA_CARDINAL under #ifndef _WIN32 but only included <X11/xpm.h>. These
resolved transitively on FLTK <= 1.4.4 but not on FLTK 1.4.5's cleaned-up
headers, so the X11 build fails with 'fl_display'/'XA_CARDINAL' not declared.
Add the includes to the shared utils.h. Built on Ubuntu 26.04, GCC 15,
FLTK 1.4.5.
main-window, modal-dialog and option-dialogs use fl_display, fl_xid,
Pixmap and XA_CARDINAL, which are declared in FL/x11.H. On FLTK <= 1.4.4
these came in transitively; FLTK 1.4.5 cleaned up its headers.

Add an explicit include guarded by FLTK_USE_X11 (defined in fl_config.h,
already pulled in via FL/fl_types.h) so the fix works for both X11-only
and hybrid Wayland+X11 builds. FL/x11.H itself includes X11/Xlib.h,
X11/Xutil.h, and X11/Xatom.h, so no separate X11 includes are needed.

Built on Ubuntu 26.04, GCC 15, FLTK 1.4.5 X11-only and Wayland+X11.
@wbniv

wbniv commented Jun 13, 2026

Copy link
Copy Markdown
Author

more changes required for WAYLAND and/or X
bbs

@wbniv wbniv closed this Jun 13, 2026
@wbniv

wbniv commented Jun 13, 2026

Copy link
Copy Markdown
Author

Closing this — the fix is already in upstream master.

The exact same change (#include <FL/platform.H> in main-window.h) was added by the maintainer in commit ffcce44 ("Update FLTK to 1.4.4", #87, 2025-09-12). That commit landed after the v4.0.1 tag, so anyone packaging the release tarball against FLTK 1.4.5 hits the build failure — but the fix is already in master, not here.

This PR was derived independently while packaging Tilemap Studio for Foundry Linux and happens to be the same single-line fix. No need to merge it.

For anyone packaging v4.0.1 against FLTK 1.4.5 and hitting this: cherry-pick ffcce44 or apply the patch manually — src/main-window.h, add #include <FL/platform.H> after the Fl_Native_File_Chooser.H line.

wbniv added a commit to foundry-linux/foundrylinux.org that referenced this pull request Jun 13, 2026
…tches

0001-x11-platform-includes: sent upstream as Rangi42/tilemap-studio#95.
0002-cstring-in-preferences: already fixed in upstream master (244378b);
carried until next release. Bump to 4.0.1-2foundry1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant