summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2025-03-07 11:06:24 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2025-03-07 11:06:24 +0100
commit7f60f019d77697c5e4e3a46f9571e1a25328b4b3 (patch)
treea15af546ffa837e02e8f3e306c55e3fb427d6a5f /src
parent6acda521ccaa448eeb26f81a2432da586bed9b30 (diff)
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".
Diffstat (limited to 'src')
-rw-r--r--src/Fl_x.cxx41
-rw-r--r--src/drivers/X11/Fl_X11_Gl_Window_Driver.H4
-rw-r--r--src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx10
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.H6
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.cxx24
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.H10
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx6
-rw-r--r--src/drivers/X11/fl_X11_platform_init.cxx4
-rw-r--r--src/drivers/Xlib/Fl_Font.H4
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx8
-rw-r--r--src/fl_dnd_x.cxx8
-rw-r--r--src/xutf8/lcUniConv/cp936ext.h14
12 files changed, 67 insertions, 72 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 3193024ce..69db31b8c 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -327,7 +327,10 @@ extern "C" {
}
}
+
+#if !(USE_XFT || FLTK_USE_CAIRO)
extern char *fl_get_font_xfld(int fnum, int size);
+#endif
void Fl_X11_Screen_Driver::new_ic()
{
@@ -343,7 +346,7 @@ void Fl_X11_Screen_Driver::new_ic()
int sarea = 0;
XIMStyles* xim_styles = NULL;
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
#if defined(__GNUC__)
// FIXME: warning XFT support here
@@ -662,7 +665,7 @@ int Fl_X11_Screen_Driver::get_mouse_unscaled(int &mx, int &my) {
Window root = RootWindow(fl_display, fl_screen);
Window c; int cx,cy; unsigned int mask;
XQueryPointer(fl_display, root, &root, &c, &mx, &my, &cx, &cy, &mask);
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
int screen = screen_num_unscaled(mx, my);
return screen >= 0 ? screen : 0;
#else
@@ -1012,7 +1015,7 @@ static void set_event_xy(Fl_Window *win) {
send_motion = 0;
# endif
float s = 1;
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
s = Fl::screen_driver()->scale(Fl_Window_Driver::driver(win)->screen_num());
#endif
Fl::e_x_root = fl_xevent->xbutton.x_root/s;
@@ -1206,7 +1209,7 @@ static KeySym fl_KeycodeToKeysym(Display *d, KeyCode k, unsigned i) {
#if USE_XRANDR
static void react_to_screen_reconfiguration() {
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
// memorize previous screen sizes and scales
int old_count = Fl::screen_count();
int (*sizes)[4] = new int[old_count][4];
@@ -1215,9 +1218,9 @@ static void react_to_screen_reconfiguration() {
Fl::screen_xywh(sizes[screen][0], sizes[screen][1], sizes[screen][2], sizes[screen][3], screen);
scales[screen] = Fl::screen_scale(screen);
}
-#endif // USE_XFT
+#endif // USE_XFT || FLTK_USE_CAIRO
Fl::call_screen_init(); // compute new screen sizes
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
// detect whether screen sizes were unchanged
bool nochange = (old_count == Fl::screen_count());
if (nochange) {
@@ -1248,11 +1251,11 @@ static void react_to_screen_reconfiguration() {
}
}
delete[] scales;
-#endif // USE_XFT
+#endif // USE_XFT || FLTK_USE_CAIRO
}
#endif // USE_XRANDR
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
static void after_display_rescale(float *p_current_xft_dpi) {
Display *new_dpy = XOpenDisplay(XDisplayString(fl_display));
if (!new_dpy) return;
@@ -1269,7 +1272,7 @@ static void after_display_rescale(float *p_current_xft_dpi) {
}
XCloseDisplay(new_dpy);
}
-#endif // USE_XFT
+#endif // USE_XFT || FLTK_USE_CAIRO
static Window *xid_vector = NULL; // list of FLTK-created xid's (see issue #935)
@@ -1347,9 +1350,9 @@ int fl_handle(const XEvent& thisevent)
if (xevent.type == PropertyNotify && xevent.xproperty.atom == fl_NET_WORKAREA) {
Fl_X11_Screen_Driver *d = (Fl_X11_Screen_Driver*)Fl::screen_driver();
d->init_workarea();
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
after_display_rescale(&(d->current_xft_dpi));
-#endif // USE_XFT
+#endif // USE_XFT || FLTK_USE_CAIRO
}
switch (xevent.type) {
@@ -1713,7 +1716,7 @@ int fl_handle(const XEvent& thisevent)
in_a_window = true;
fl_dnd_source_window = data[0];
float s = 1;
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
if (window) s = Fl::screen_driver()->scale(Fl_Window_Driver::driver(window)->screen_num());
#endif
Fl::e_x_root = (data[2]>>16)/s;
@@ -1788,7 +1791,7 @@ int fl_handle(const XEvent& thisevent)
case GraphicsExpose:
{
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
int ns = Fl_Window_Driver::driver(window)->screen_num();
float s = Fl::screen_driver()->scale(ns);
window->damage(FL_DAMAGE_EXPOSE, xevent.xexpose.x/s, xevent.xexpose.y/s,
@@ -2208,7 +2211,7 @@ int fl_handle(const XEvent& thisevent)
Window cr; int X, Y, W = actual.width, H = actual.height;
XTranslateCoordinates(fl_display, fl_xid(window), actual.root,
0, 0, &X, &Y, &cr);
-#if USE_XFT // detect when window centre changes screen
+#if USE_XFT || FLTK_USE_CAIRO // detect when window centre changes screen
Fl_X11_Screen_Driver *d = (Fl_X11_Screen_Driver*)Fl::screen_driver();
Fl_X11_Window_Driver *wd = Fl_X11_Window_Driver::driver(window);
int olds = wd->screen_num();
@@ -2230,13 +2233,13 @@ int fl_handle(const XEvent& thisevent)
Fl::remove_timeout(Fl_X11_Window_Driver::resize_after_screen_change, window);
Fl_X11_Window_Driver::data_for_resize_window_between_screens_.busy = false;
}
-#else // ! USE_XFT
+#else // ! (USE_XFT || FLTK_USE_CAIRO)
Fl_Window_Driver::driver(window)->screen_num( Fl::screen_num(X, Y, W, H) );
-#endif // USE_XFT
+#endif // USE_XFT || FLTK_USE_CAIRO
// tell Fl_Window about it and set flag to prevent echoing:
resize_bug_fix = window;
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
if (!Fl_X11_Window_Driver::data_for_resize_window_between_screens_.busy &&
( ceil(W/s) != window->w() || ceil(H/s) != window->h() ) ) {
window->resize(rint(X/s), rint(Y/s), ceil(W/s), ceil(H/s));
@@ -2267,7 +2270,7 @@ int fl_handle(const XEvent& thisevent)
// tell Fl_Window about it and set flag to prevent echoing:
if ( !wasXExceptionRaised() ) {
resize_bug_fix = window;
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
int ns = Fl_Window_Driver::driver(window)->screen_num();
float s = Fl::screen_driver()->scale(ns);
#else
@@ -2659,7 +2662,7 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
#endif // (ENABLE_BOXCHEAT)
float s = 1;
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
//compute adequate screen where to put the window
int nscreen = 0;
if (win->parent()) {
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 <GL/glx.h>
-#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
diff --git a/src/drivers/Xlib/Fl_Font.H b/src/drivers/Xlib/Fl_Font.H
index 9a5e40a93..e1680df4f 100644
--- a/src/drivers/Xlib/Fl_Font.H
+++ b/src/drivers/Xlib/Fl_Font.H
@@ -1,7 +1,7 @@
//
// Font definitions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2018 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
@@ -32,7 +32,7 @@ typedef struct _XftFont XftFont;
class Fl_Xlib_Font_Descriptor : public Fl_Font_Descriptor {
public:
-# if USE_XFT
+# if USE_XFT || FLTK_USE_CAIRO
# if USE_PANGO
int descent_;
int height_;
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
index 4c7b64a4c..336e4b429 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
@@ -1,7 +1,7 @@
//
// Rectangle drawing routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2022 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
@@ -24,10 +24,6 @@
#include <string.h>
#include <stdlib.h>
-#if !USE_XFT
-extern char *fl_get_font_xfld(int fnum, int size);
-#endif
-
GC Fl_Xlib_Graphics_Driver::gc_ = NULL;
int Fl_Xlib_Graphics_Driver::fl_overlay = 0;
@@ -62,7 +58,7 @@ void Fl_Xlib_Graphics_Driver::gc(void *value) {
}
void Fl_Xlib_Graphics_Driver::scale(float f) {
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
if (f != scale()) {
size_ = 0;
Fl_Graphics_Driver::scale(f);
diff --git a/src/fl_dnd_x.cxx b/src/fl_dnd_x.cxx
index f48ac599e..be5d18557 100644
--- a/src/fl_dnd_x.cxx
+++ b/src/fl_dnd_x.cxx
@@ -1,7 +1,7 @@
//
// Drag & Drop code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2023 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
@@ -106,7 +106,7 @@ int Fl_X11_Screen_Driver::dnd(int unused) {
if ((new_local_window = fl_find(child))) break;
if ((new_version = dnd_aware(new_window))) break;
}
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
if (new_local_window) {
float s = Fl::screen_driver()->scale(Fl_Window_Driver::driver(new_local_window)->screen_num());
Fl::e_x_root /= s;
@@ -158,7 +158,7 @@ int Fl_X11_Screen_Driver::dnd(int unused) {
local_handle(FL_DND_DRAG, local_window);
} else if (dndversion) {
int exroot = Fl::e_x_root, eyroot = Fl::e_y_root;
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
Fl_Window *target = fl_find(target_window);
if (target) {
float s = Fl::screen_driver()->scale(Fl_Window_Driver::driver(target)->screen_num());
@@ -189,7 +189,7 @@ int Fl_X11_Screen_Driver::dnd(int unused) {
msg.x = dest_x;
msg.y = dest_y;
float s = 1;
-#if USE_XFT
+#if USE_XFT || FLTK_USE_CAIRO
Fl_Window *target = fl_find(target_window);
if (target) s = Fl::screen_driver()->scale(Fl_Window_Driver::driver(target)->screen_num());
#endif
diff --git a/src/xutf8/lcUniConv/cp936ext.h b/src/xutf8/lcUniConv/cp936ext.h
index a01df9641..1d72abb15 100644
--- a/src/xutf8/lcUniConv/cp936ext.h
+++ b/src/xutf8/lcUniConv/cp936ext.h
@@ -1,7 +1,7 @@
/*
* Character encoding support for the Fast Light Tool Kit (FLTK).
*
- * Copyright 1998-2018 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
@@ -13,12 +13,8 @@
*
* https://www.fltk.org/bugs.php
*/
-
-#if defined(_WIN32) || defined(__APPLE__) /* PORTME: is this really needed? It's huge! */
-
- /* not needed */
-
-#else
+#include <FL/fl_config.h>
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(FLTK_USE_X11))
#ifndef CP936
#ifdef NEED_TOWC
@@ -38,7 +34,7 @@ cp936ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
}
#endif /* NEED_TOMB */
-#else
+#else /* CP936 */
/*
* CP936EXT
*/
@@ -6246,4 +6242,4 @@ cp936ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
#endif /* CP936 */
-#endif /* _WIN32 || __APPLE__ */ /* PORTME: Unicode stuff */
+#endif /* _WIN32 || __APPLE__ */