New configure setting "--enable-wayland --disable-x11" to build pure Wayland platform.

This commit is contained in:
ManoloFLTK 2022-09-10 07:44:23 +02:00
parent 203e7b7098
commit b37576aa55
6 changed files with 45 additions and 22 deletions

View File

@ -124,7 +124,11 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2022
New Configuration Options (ABI Version) New Configuration Options (ABI Version)
- Configure option --enable-wayland allows to build the FLTK library for - Configure option --enable-wayland allows to build the FLTK library for
the new Wayland platform. The corresponding CMake option is OPTION_USE_WAYLAND. the new Wayland platform while remaining compatible with X11. The
corresponding CMake option is OPTION_USE_WAYLAND.
- Configure options --enable-wayland --disable-x11 used together allow to
build FLTK for the Wayland backend only (no x11 backend). Under CMake, the
equivalent is to set both OPTION_USE_WAYLAND and OPTION_WAYLAND_ONLY.
- The new configure option --disable-gdiplus removes the possibility to draw - The new configure option --disable-gdiplus removes the possibility to draw
antialiased lines and curves on the Windows platform. The corresponding CMake antialiased lines and curves on the Windows platform. The corresponding CMake
option is OPTION_USE_GDIPLUS. option is OPTION_USE_GDIPLUS.

View File

@ -55,20 +55,24 @@ X11 is used at run time as follows:
compositor is available; compositor is available;
- if FLTK_BACKEND has another value, the library stops with error. - if FLTK_BACKEND has another value, the library stops with error.
On pure Wayland systems without the X11 headers and libraries, FLTK can be built
with its Wayland backend only (see below).
2.1 Configuration 2.1 Configuration
------------------ ------------------
* Configure-based build can be performed as follows: 2.1.1 Configure-based build can be performed as follows:
Once after "git clone", create the configure file : Once after "git clone", create the configure file :
autoconf -f autoconf -f
Prepare build with : Prepare build with :
./configure --enable-wayland [--enable-shared] ./configure --enable-wayland
Add --disable-x11 to build FLTK for Wayland-only (no x11 backend).
Build with : Build with :
make make
* CMake-based build can be performed as follows: 2.1.2 CMake-based build can be performed as follows:
cmake -S <path-to-source> -B <path-to-build> -DCMAKE_BUILD_TYPE=Release -DOPTION_USE_WAYLAND=1 cmake -S <path-to-source> -B <path-to-build> -DCMAKE_BUILD_TYPE=Release -DOPTION_USE_WAYLAND=1
cd <path-to-build>; make cd <path-to-build>; make
@ -79,6 +83,8 @@ this form of libdecor. Optionally, OPTION_USE_SYSTEM_LIBDECOR can be turned on t
use the system's version of libdecor which is available on recent Linux distributions (e.g., use the system's version of libdecor which is available on recent Linux distributions (e.g.,
Debian Bookworm or more recent in packages libdecor-0-0 and libdecor-0-plugin-1-cairo). Debian Bookworm or more recent in packages libdecor-0-0 and libdecor-0-plugin-1-cairo).
Optionally, OPTION_WAYLAND_ONLY can be turned on to build FLTK for Wayland-only (no x11 backend).
2.2 Known Limitations 2.2 Known Limitations
---------------------- ----------------------
@ -91,9 +97,9 @@ Fl_Window::position() has no effect on other top-level windows.
way to programmatically unset minimization of a window. Consequently, Fl_Window::show() of way to programmatically unset minimization of a window. Consequently, Fl_Window::show() of
a minimized window has no effect. a minimized window has no effect.
* It's currently not possible for an app to be notified of changes to the content of * Although the FLTK API to read from and write to the system clipboard is fully functional,
the system clipboard, that is, Fl::add_clipboard_notify() has no effect. The FLTK API to it's currently not possible for an app to be notified of changes to the content of
read from and write to the system clipboard is fully functional, though. the system clipboard, that is, Fl::add_clipboard_notify() has no effect.
* With GTK-style window titlebars, narrow windows are silently forced to be wide enough * 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. for the titlebar to display window buttons and a few letters of the title.
@ -149,12 +155,12 @@ 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 Wayland-specific function or variable. Make sure that fl_open_display() was called
directly or indirectly before using any such symbol. directly or indirectly before using any such symbol.
3.3 Forcing an app to always use the X11 mechanism 3.3 Forcing an FLTK app to always use the X11 backend
-------------------------------------------------- -----------------------------------------------------
Alternatively, it's possible to force an FLTK app to use X11 in all Alternatively, it's possible to force an FLTK app to use X11 in all
situations by calling function fl_disable_wayland() early in main(), before situations by calling function fl_disable_wayland() early in main(), that is,
fl_open_display() runs. FLTK source code and also platform-specific before fl_open_display() runs. FLTK source code and also platform-specific
code conceived for FLTK 1.3 should run under 1.4 with that single change only. code conceived for FLTK 1.3 should run under 1.4 with that single change only.

View File

@ -110,7 +110,7 @@ AC_ARG_ENABLE([localzlib], AS_HELP_STRING([--enable-localzlib], [use local ZLIB
AC_ARG_ENABLE([pango], AS_HELP_STRING([--enable-pango], [turn on Pango support])) AC_ARG_ENABLE([pango], AS_HELP_STRING([--enable-pango], [turn on Pango support]))
AC_ARG_ENABLE([wayland], AS_HELP_STRING([--enable-wayland], [turn on Wayland support])) AC_ARG_ENABLE([wayland], AS_HELP_STRING([--enable-wayland], [turn on hybrid Wayland/X11 support]))
AC_ARG_ENABLE([usecairo], AS_HELP_STRING([--enable-usecairo], [all drawing to X11 windows uses Cairo])) AC_ARG_ENABLE([usecairo], AS_HELP_STRING([--enable-usecairo], [all drawing to X11 windows uses Cairo]))
@ -993,11 +993,16 @@ AS_CASE([$host_os_gui], [cygwin* | mingw*], [
BUILD="WAYLAND" BUILD="WAYLAND"
AC_DEFINE([FLTK_USE_WAYLAND]) AC_DEFINE([FLTK_USE_WAYLAND])
AC_DEFINE([FLTK_USE_X11]) # to build a hybrid Wayland/X11 library graphics="Wayland"
AS_IF([test x$enable_x11 != xno], [
AC_DEFINE([FLTK_USE_X11]) # to build a hybrid Wayland/X11 library
BUILD="WAYLANDX11"
graphics="Wayland or X11 with cairo"
])
CFLAGS="$CFLAGS -DUSE_SYSTEM_LIBDECOR=0" CFLAGS="$CFLAGS -DUSE_SYSTEM_LIBDECOR=0"
CXXFLAGS="$CXXFLAGS -DUSE_SYSTEM_LIBDECOR=0" CXXFLAGS="$CXXFLAGS -DUSE_SYSTEM_LIBDECOR=0"
graphics="Wayland or X11 with cairo" LIBS="$LIBS $($PKGCONFIG --libs wayland-cursor) $($PKGCONFIG --libs wayland-client) $($PKGCONFIG --libs xkbcommon) $($PKGCONFIG --libs pangoxft) "
LIBS="$LIBS $($PKGCONFIG --libs wayland-cursor) $($PKGCONFIG --libs wayland-client) $($PKGCONFIG --libs xkbcommon) $($PKGCONFIG --libs pangoxft) $($PKGCONFIG --libs x11)" AS_IF([test x$enable_x11 != xno], [LIBS="$LIBS $($PKGCONFIG --libs x11)"] )
LIBS="$LIBS $($PKGCONFIG --libs dbus-1) -ldl" LIBS="$LIBS $($PKGCONFIG --libs dbus-1) -ldl"
CXXFLAGS="$CXXFLAGS -I../libdecor/src" CXXFLAGS="$CXXFLAGS -I../libdecor/src"
DSOFLAGS="$LIBS $DSOFLAGS" DSOFLAGS="$LIBS $DSOFLAGS"

View File

@ -50,6 +50,7 @@ CPPFILES_X11 = ExternalCodeEditor_UNIX.cxx
CPPFILES_XFT = ExternalCodeEditor_UNIX.cxx CPPFILES_XFT = ExternalCodeEditor_UNIX.cxx
CPPFILES_CAIRO = ExternalCodeEditor_UNIX.cxx CPPFILES_CAIRO = ExternalCodeEditor_UNIX.cxx
CPPFILES_WAYLAND = ExternalCodeEditor_UNIX.cxx CPPFILES_WAYLAND = ExternalCodeEditor_UNIX.cxx
CPPFILES_WAYLANDX11 = ExternalCodeEditor_UNIX.cxx
CPPFILES += $(CPPFILES_$(BUILD)) CPPFILES += $(CPPFILES_$(BUILD))

View File

@ -24,7 +24,7 @@ FL_ABI_VERSION = @FL_ABI_VERSION@
FLTK_VERSION = @FLTK_VERSION@ FLTK_VERSION = @FLTK_VERSION@
# FLTK configuration options: BUILD = { WIN | OSX | X11 | XFT | CAIROXLIB | WAYLAND } # FLTK configuration options: BUILD = { WIN | OSX | X11 | XFT | CAIROXLIB | WAYLANDX11 | WAYLAND }
BUILD = @BUILD@ BUILD = @BUILD@
UNAME = @UNAME@ UNAME = @UNAME@

View File

@ -211,8 +211,9 @@ GLCPPFILES_CAIRO = $(GLCPPFILES_X11)
GLCPPFILES_WIN = drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx \ GLCPPFILES_WIN = drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx \
drivers/WinAPI/fl_WinAPI_gl_platform_init.cxx drivers/WinAPI/fl_WinAPI_gl_platform_init.cxx
GLCPPFILES_WAYLAND = drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx \ GLCPPFILES_WAYLAND = drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx \
drivers/X11/Fl_X11_Gl_Window_Driver.cxx \
drivers/Wayland/fl_wayland_gl_platform_init.cxx drivers/Wayland/fl_wayland_gl_platform_init.cxx
GLCPPFILES_WAYLANDX11 = $(GLCPPFILES_WAYLAND) \
drivers/X11/Fl_X11_Gl_Window_Driver.cxx
GLCPPFILES += $(GLCPPFILES_$(BUILD)) GLCPPFILES += $(GLCPPFILES_$(BUILD))
@ -290,7 +291,7 @@ XLIBGDFILES = drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx \
drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx \ drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx \
drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx
# These C++ files are used under condition: BUILD_WAYLAND # These C++ files are used under conditions: BUILD_WAYLAND or BUILD_WAYLANDX11
WLCPPFILES = \ WLCPPFILES = \
drivers/Posix/Fl_Posix_Printer_Driver.cxx \ drivers/Posix/Fl_Posix_Printer_Driver.cxx \
Fl_Native_File_Chooser_FLTK.cxx \ Fl_Native_File_Chooser_FLTK.cxx \
@ -305,7 +306,10 @@ WLCPPFILES = \
drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx \ drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.cxx \
drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx \ drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx \
drivers/Wayland/fl_wayland_platform_init.cxx \ drivers/Wayland/fl_wayland_platform_init.cxx \
drivers/Wayland/fl_wayland_clipboard_dnd.cxx \ drivers/Wayland/fl_wayland_clipboard_dnd.cxx
# These C++ files are used under condition: BUILD_WAYLANDX11
WLX11CPPFILES = \
drivers/X11/Fl_X11_Screen_Driver.cxx \ drivers/X11/Fl_X11_Screen_Driver.cxx \
drivers/X11/Fl_X11_Window_Driver.cxx \ drivers/X11/Fl_X11_Window_Driver.cxx \
drivers/X11/Fl_X11_System_Driver.cxx \ drivers/X11/Fl_X11_System_Driver.cxx \
@ -343,7 +347,7 @@ WLCFILES = \
xutf8/keysym2Ucs.c \ xutf8/keysym2Ucs.c \
scandir_posix.c scandir_posix.c
# These C++ files are used under condition: BUILD_WAYLAND # These C++ files are used under conditions: BUILD_WAYLAND or BUILD_WAYLANDX11
WLXFTFILES = \ WLXFTFILES = \
drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
@ -382,7 +386,7 @@ FLTKFLAGS = -DFL_LIBRARY
include ../makeinclude include ../makeinclude
# makeinclude has set this variable: # makeinclude has set this variable:
# BUILD = {WIN|X11|XFT|CAIRO|OSX|WAYLAND} # BUILD = {WIN|X11|XFT|CAIRO|OSX|WAYLAND|WAYLANDX11}
MMFILES_OSX = $(OBJCPPFILES) MMFILES_OSX = $(OBJCPPFILES)
MMFILES = $(MMFILES_$(BUILD)) MMFILES = $(MMFILES_$(BUILD))
@ -395,6 +399,7 @@ CPPFILES_X11 = $(XLIBCPPFILES) $(XLIBGDFILES) $(XLIBFONTFILES)
CPPFILES_CAIRO = $(XLIBCPPFILES) $(CAIROGDFILES) CPPFILES_CAIRO = $(XLIBCPPFILES) $(CAIROGDFILES)
CPPFILES_WAYLAND = $(WLCPPFILES) $(WLXFTFILES) CPPFILES_WAYLAND = $(WLCPPFILES) $(WLXFTFILES)
CPPFILES_WAYLANDX11 = $(CPPFILES_WAYLAND) $(WLX11CPPFILES)
CPPFILES_WIN = $(GDICPPFILES) CPPFILES_WIN = $(GDICPPFILES)
@ -405,12 +410,14 @@ CFILES_X11 = $(XLIBCFILES) $(XLIBXCFILES)
CFILES_CAIRO = $(XLIBCFILES) CFILES_CAIRO = $(XLIBCFILES)
CFILES_XFT = $(XLIBCFILES) CFILES_XFT = $(XLIBCFILES)
CFILES_WAYLAND = $(WLCFILES) CFILES_WAYLANDX11 = $(WLCFILES)
EXTRA_OBJECTS_WAYLAND = ../libdecor/build/fl_libdecor.o ../libdecor/build/libdecor-cairo-blur.o \ EXTRA_OBJECTS_WAYLAND = ../libdecor/build/fl_libdecor.o ../libdecor/build/libdecor-cairo-blur.o \
../libdecor/build/fl_libdecor-plugins.o \ ../libdecor/build/fl_libdecor-plugins.o \
xdg-decoration-protocol.o xdg-shell-protocol.o text-input-protocol.o \ xdg-decoration-protocol.o xdg-shell-protocol.o text-input-protocol.o \
../libdecor/build/cursor-settings.o ../libdecor/build/os-compatibility.o ../libdecor/build/cursor-settings.o ../libdecor/build/os-compatibility.o
EXTRA_OBJECTS_WAYLANDX11 = $(EXTRA_OBJECTS_WAYLAND)
EXTRA_CXXFLAGS_WAYLAND = -I. EXTRA_CXXFLAGS_WAYLAND = -I.
EXTRA_CXXFLAGS_WAYLANDX11 = $(EXTRA_CXXFLAGS_WAYLAND)
CFILES_WIN = $(GDICFILES) CFILES_WIN = $(GDICFILES)