From 7f60f019d77697c5e4e3a46f9571e1a25328b4b3 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 7 Mar 2025 11:06:24 +0100 Subject: Fix "fltk autotools build does not link against libXft" (#1202) libXft was erroneously present in the link command when using Pango and Cairo. This is fixed by disconnecting the GUI scaling code from use of Xft. This commit also makes sure that when Wayland is used, pkg-config is available on the build machine. This allows to remove from file CMake/options.cmake code that was labelled with "FIXME". --- src/drivers/X11/Fl_X11_Gl_Window_Driver.H | 4 ++-- src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx | 10 +++++----- src/drivers/X11/Fl_X11_Screen_Driver.H | 6 +++--- src/drivers/X11/Fl_X11_Screen_Driver.cxx | 24 ++++++++++++------------ src/drivers/X11/Fl_X11_Window_Driver.H | 10 +++++----- src/drivers/X11/Fl_X11_Window_Driver.cxx | 6 +++--- src/drivers/X11/fl_X11_platform_init.cxx | 4 ++-- 7 files changed, 32 insertions(+), 32 deletions(-) (limited to 'src/drivers/X11') diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.H b/src/drivers/X11/Fl_X11_Gl_Window_Driver.H index 1f4c71053..a833e0c44 100644 --- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.H @@ -1,7 +1,7 @@ // // Class Fl_X11_Gl_Window_Driver for the Fast Light Tool Kit (FLTK). // -// Copyright 2022 by Bill Spitzak and others. +// Copyright 2022-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -47,7 +47,7 @@ class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver { void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize) FL_OVERRIDE; void get_list(Fl_Font_Descriptor *fd, int r) FL_OVERRIDE; int genlistsize() FL_OVERRIDE; -#if !USE_XFT +#if !(USE_XFT || FLTK_USE_CAIRO) virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum) FL_OVERRIDE; #endif //static GLContext create_gl_context(XVisualInfo* vis); diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx index 3a3f80c28..938c61a7b 100644 --- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx @@ -1,7 +1,7 @@ // // Class Fl_X11_Gl_Window_Driver for the Fast Light Tool Kit (FLTK). // -// Copyright 2021-2024 by Bill Spitzak and others. +// Copyright 2021-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -21,7 +21,7 @@ #include "../../Fl_Screen_Driver.H" #include "Fl_X11_Gl_Window_Driver.H" #include -#if ! USE_XFT +#if ! (USE_XFT || FLTK_USE_CAIRO) # include "../Xlib/Fl_Font.H" #endif @@ -51,7 +51,7 @@ void Fl_X11_Gl_Window_Driver::draw_string_legacy(const char* str, int n) { } int Fl_X11_Gl_Window_Driver::genlistsize() { -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO return 256; #else return 0x10000; @@ -86,7 +86,7 @@ void Fl_X11_Gl_Window_Driver::gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize) { void Fl_X11_Gl_Window_Driver::get_list(Fl_Font_Descriptor *fd, int r) { -# if USE_XFT +# if USE_XFT || FLTK_USE_CAIRO /* We hope not to come here: We hope that any system using XFT will also * have sufficient GL capability to support our font texture pile mechansim, * allowing XFT to render the face directly. */ @@ -107,7 +107,7 @@ void Fl_X11_Gl_Window_Driver::get_list(Fl_Font_Descriptor *fd, int r) { # endif } -#if !USE_XFT +#if !(USE_XFT || FLTK_USE_CAIRO) Fl_Font_Descriptor** Fl_X11_Gl_Window_Driver::fontnum_to_fontdescriptor(int fnum) { Fl_Xlib_Fontdesc *s = ((Fl_Xlib_Fontdesc*)fl_fonts) + fnum; return &(s->first); diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.H b/src/drivers/X11/Fl_X11_Screen_Driver.H index 17826a94d..a22e38096 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.H +++ b/src/drivers/X11/Fl_X11_Screen_Driver.H @@ -2,7 +2,7 @@ // Definition of X11 Screen interface // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2022 by Bill Spitzak and others. +// Copyright 2010-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -40,7 +40,7 @@ protected: short y_org; short width; short height; -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO float scale; #endif } FLScreenInfo; @@ -49,7 +49,7 @@ protected: int get_mouse_unscaled(int &xx, int &yy); public: -#if USE_XFT // scaling does not work without Xft +#if USE_XFT || FLTK_USE_CAIRO // scaling does not work without Xft float current_xft_dpi; // current value of the Xft.dpi X resource APP_SCALING_CAPABILITY rescalable() FL_OVERRIDE { return PER_SCREEN_APP_SCALING; } float scale(int n) FL_OVERRIDE {return screens[n].scale;} diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index 50a7260a8..f9cff395d 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -1,7 +1,7 @@ // // Definition of X11 Screen interface // -// Copyright 1998-2024 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -54,7 +54,7 @@ extern const char *fl_bg; extern const char *fl_bg2; // end of extern additions workaround -#if !USE_XFT +#if !(USE_XFT || FLTK_USE_CAIRO) extern char *fl_get_font_xfld(int fnum, int size); #endif @@ -239,7 +239,7 @@ void Fl_X11_Screen_Driver::init_workarea() int Fl_X11_Screen_Driver::x() { if (!fl_display) open_display(); return fl_workarea_xywh[0] -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO / screens[0].scale #endif ; @@ -248,7 +248,7 @@ int Fl_X11_Screen_Driver::x() { int Fl_X11_Screen_Driver::y() { if (!fl_display) open_display(); return fl_workarea_xywh[1] -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO / screens[0].scale #endif ; @@ -257,7 +257,7 @@ int Fl_X11_Screen_Driver::y() { int Fl_X11_Screen_Driver::w() { if (!fl_display) open_display(); return fl_workarea_xywh[2] -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO / screens[0].scale #endif ; @@ -266,7 +266,7 @@ int Fl_X11_Screen_Driver::w() { int Fl_X11_Screen_Driver::h() { if (!fl_display) open_display(); return fl_workarea_xywh[3] -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO / screens[0].scale #endif ; @@ -349,7 +349,7 @@ void Fl_X11_Screen_Driver::init() { screens[i].y_org = 0; screens[i].width = DisplayWidth(fl_display, i); screens[i].height = DisplayHeight(fl_display, i); -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO screens[i].scale = 1; #endif if (dpi_by_randr) { @@ -390,7 +390,7 @@ void Fl_X11_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H, int n) n = 0; if (num_screens > 0) { -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO float s = screens[n].scale; #else float s = 1; @@ -597,7 +597,7 @@ void Fl_X11_Screen_Driver::compose_reset() } int Fl_X11_Screen_Driver::text_display_can_leak() const { -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO return 1; #else return 0; @@ -1131,7 +1131,7 @@ void Fl_X11_Screen_Driver::set_spot(int font, int size, int X, int Y, int W, int if (fs) { XFreeFontSet(fl_display, fs); } -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO fnt = NULL; // FIXME: missing XFT support here #else fnt = fl_get_font_xfld(font, size); @@ -1163,7 +1163,7 @@ void Fl_X11_Screen_Driver::set_spot(int font, int size, int X, int Y, int W, int } -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO //NOTICE: returns -1 if x,y is not in any screen int Fl_X11_Screen_Driver::screen_num_unscaled(int x, int y) { @@ -1198,4 +1198,4 @@ void Fl_X11_Screen_Driver::desktop_scale_factor() } } -#endif // USE_XFT +#endif // USE_XFT || FLTK_USE_CAIRO diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index c0efb30e9..50b7a1bd3 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Window_Driver.H @@ -2,7 +2,7 @@ // Definition of X11 window driver // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2024 by Bill Spitzak and others. +// Copyright 2010-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -66,14 +66,14 @@ private: Fl_Image* shape_; ///< shape image Fl_Bitmap *effective_bitmap_; ///< auxiliary bitmap image } *shape_data_; -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO // --- support for screen-specific scaling factors struct type_for_resize_window_between_screens { int screen; bool busy; }; static type_for_resize_window_between_screens data_for_resize_window_between_screens_; -#endif // USE_XFT +#endif // USE_XFT || FLTK_USE_CAIRO #if FLTK_USE_CAIRO cairo_t *cairo_; #endif // FLTK_USE_CAIRO @@ -89,9 +89,9 @@ public: Fl_X11_Window_Driver(Fl_Window*); ~Fl_X11_Window_Driver() FL_OVERRIDE; static inline Fl_X11_Window_Driver* driver(const Fl_Window *w) {return (Fl_X11_Window_Driver*)Fl_Window_Driver::driver(w);} -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO static void resize_after_screen_change(void *data); -#endif // USE_XFT +#endif // USE_XFT || FLTK_USE_CAIRO // --- window data int decorated_w() FL_OVERRIDE; diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 4af030f49..b7e5da1ee 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -1,7 +1,7 @@ // // Definition of X11 window driver. // -// Copyright 1998-2024 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -561,7 +561,7 @@ Window fl_x11_xid(const Fl_Window *win) { } -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO Fl_X11_Window_Driver::type_for_resize_window_between_screens Fl_X11_Window_Driver::data_for_resize_window_between_screens_ = {0, false}; @@ -572,7 +572,7 @@ void Fl_X11_Window_Driver::resize_after_screen_change(void *data) { data_for_resize_window_between_screens_.busy = false; } -#endif // USE_XFT +#endif // USE_XFT || FLTK_USE_CAIRO fl_uintptr_t Fl_X11_Window_Driver::os_id() { return fl_xid(pWindow); diff --git a/src/drivers/X11/fl_X11_platform_init.cxx b/src/drivers/X11/fl_X11_platform_init.cxx index 33ea43bee..e9d40dbc3 100644 --- a/src/drivers/X11/fl_X11_platform_init.cxx +++ b/src/drivers/X11/fl_X11_platform_init.cxx @@ -1,7 +1,7 @@ // // X11-specific code to initialize wayland support. // -// Copyright 2022-2023 by Bill Spitzak and others. +// Copyright 2022-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -47,7 +47,7 @@ Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() { Fl_X11_Screen_Driver *d = new Fl_X11_Screen_Driver(); -#if USE_XFT +#if USE_XFT || FLTK_USE_CAIRO for (int i = 0; i < MAX_SCREENS; i++) d->screens[i].scale = 1; d->current_xft_dpi = 0.; // means the value of the Xft.dpi resource is still unknown #else -- cgit v1.2.3