1
Fork 0

Compare commits

...

10 Commits

10 changed files with 89 additions and 40 deletions

View File

@ -23,14 +23,14 @@ The nanosvg library is not affected.
\section bundled-status Current status
\code
Current versions of bundled libraries (as of May 2, 2023):
Current versions of bundled libraries (as of June 13, 2023):
Library Version/git commit Release date FLTK Version
--------------------------------------------------------------------------
jpeg jpeg-9e 2022-01-16 1.4.0
nanosvg abcd277ea4 [1] 2022-12-22 1.4.0
png libpng-1.6.39 2022-11-20 1.4.0
zlib zlib-1.2.13 2022-10-13 1.4.0
libdecor db4e5084 [2] 2023-05-01 1.4.0
libdecor 73260393 [2] 2023-06-06 1.4.0
--------------------------------------------------------------------------
Previous versions of bundled libraries (FLTK 1.3.x):

View File

@ -2,8 +2,7 @@
\page intro Introduction to FLTK
The Fast Light Tool Kit ("FLTK", pronounced
"fulltick") is a cross-platform C++ GUI toolkit for
The Fast Light Tool Kit ("FLTK") is a cross-platform C++ GUI toolkit for
UNIX®/Linux® (X11 or Wayland), Microsoft® Windows®, and
Apple® macOS®. FLTK provides modern GUI functionality without the
bloat and supports 3D graphics via OpenGL® and its built-in

View File

@ -7,8 +7,9 @@ version 1.4.0, a C++ Graphical User Interface
("GUI") toolkit for UNIX, Microsoft Windows and Apple OS X.
Version 1.4.0 introduces support for a new windowing system
under LINUX: Wayland. Thus, FLTK applications under LINUX can
now be built to use either X11 or Wayland as windowing system.
under Linux/Unix: Wayland. FLTK applications under Linux/Unix
run, unchanged, as Wayland or X11 clients depending on what's
available at run-time.
Each of the chapters in this manual is designed as a tutorial for
using FLTK, while the appendices provide a convenient reference

View File

@ -199,7 +199,9 @@ void Fluid_Image::write_static(Fd_Code_Writer& f, int compressed) {
size_t nData = write_static_binary(f, "PNG");
f.write_c(";\n");
write_initializer(f, "Fl_PNG_Image", "\"%s\", %s, %d", fl_filename_name(name()), idata_name, nData);
} else if (fl_ascii_strcasecmp(fl_filename_ext(name()), ".svg")==0 || fl_ascii_strcasecmp(fl_filename_ext(name()), ".svgz")==0) {
}
#ifdef FLTK_USE_SVG
else if (fl_ascii_strcasecmp(fl_filename_ext(name()), ".svg")==0 || fl_ascii_strcasecmp(fl_filename_ext(name()), ".svgz")==0) {
bool gzipped = (strcmp(fl_filename_ext(name()), ".svgz") == 0);
// Write svg image data...
if (compressed) {
@ -232,7 +234,9 @@ void Fluid_Image::write_static(Fd_Code_Writer& f, int compressed) {
write_file_error(f, "RGB_from_SVG");
}
}
} else {
}
#endif // FLTK_USE_SVG
else {
write_static_rgb(f, idata_name);
}
}

View File

@ -398,12 +398,15 @@ libdecor_plugin_cairo_destroy(struct libdecor_plugin *plugin)
free(plugin_cairo->cursor_theme_name);
wl_shm_destroy(plugin_cairo->wl_shm);
if (plugin_cairo->wl_shm)
wl_shm_destroy(plugin_cairo->wl_shm);
pango_font_description_free(plugin_cairo->font);
wl_compositor_destroy(plugin_cairo->wl_compositor);
wl_subcompositor_destroy(plugin_cairo->wl_subcompositor);
if (plugin_cairo->wl_compositor)
wl_compositor_destroy(plugin_cairo->wl_compositor);
if (plugin_cairo->wl_subcompositor)
wl_subcompositor_destroy(plugin_cairo->wl_subcompositor);
libdecor_plugin_release(&plugin_cairo->plugin);
free(plugin_cairo);
@ -2679,13 +2682,6 @@ globals_callback(void *user_data,
wl_callback_destroy(callback);
plugin_cairo->globals_callback = NULL;
if (!has_required_globals(plugin_cairo)) {
libdecor_notify_plugin_error(
plugin_cairo->context,
LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE,
"Compositor is missing required globals");
}
}
static const struct wl_callback_listener globals_callback_listener = {
@ -2731,6 +2727,13 @@ libdecor_plugin_new(struct libdecor *context)
wl_callback_add_listener(plugin_cairo->globals_callback,
&globals_callback_listener,
plugin_cairo);
wl_display_roundtrip(wl_display);
if (!has_required_globals(plugin_cairo)) {
fprintf(stderr, "libdecor-cairo-WARNING: Could not get required globals\n");
libdecor_plugin_cairo_destroy(&plugin_cairo->plugin);
return NULL;
}
return &plugin_cairo->plugin;
}

View File

@ -33,6 +33,7 @@
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <wayland-client-core.h>
#include <wayland-cursor.h>
#include "libdecor-plugin.h"
@ -427,10 +428,13 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
free(plugin_gtk->cursor_theme_name);
wl_shm_destroy(plugin_gtk->wl_shm);
if (plugin_gtk->wl_shm)
wl_shm_destroy(plugin_gtk->wl_shm);
wl_compositor_destroy(plugin_gtk->wl_compositor);
wl_subcompositor_destroy(plugin_gtk->wl_subcompositor);
if (plugin_gtk->wl_compositor)
wl_compositor_destroy(plugin_gtk->wl_compositor);
if (plugin_gtk->wl_subcompositor)
wl_subcompositor_destroy(plugin_gtk->wl_subcompositor);
free(plugin_gtk);
@ -659,8 +663,10 @@ libdecor_plugin_gtk_frame_free(struct libdecor_plugin *plugin,
/* when in SSD mode, frame_gtk->header is not a proper GTK widget */
if (!GTK_IS_WIDGET(frame_gtk->header)) return;
gtk_widget_destroy(frame_gtk->header);
frame_gtk->header = NULL;
if (!GTK_IS_WIDGET(frame_gtk->window)) return;
gtk_widget_destroy(frame_gtk->window);
frame_gtk->window = NULL;
free_border_component(&frame_gtk->headerbar);
free_border_component(&frame_gtk->shadow);
@ -671,6 +677,7 @@ libdecor_plugin_gtk_frame_free(struct libdecor_plugin *plugin,
}
free(frame_gtk->title);
frame_gtk->title = NULL;
frame_gtk->decoration_type = DECORATION_TYPE_NONE;
@ -885,11 +892,15 @@ ensure_title_bar_surfaces(struct libdecor_frame_gtk *frame_gtk)
* after construction. So we just destroy and re-create them.
*/
/* avoid warning when restoring previously turned off decoration */
if (GTK_IS_WIDGET(frame_gtk->header))
if (GTK_IS_WIDGET(frame_gtk->header)) {
gtk_widget_destroy(frame_gtk->header);
frame_gtk->header = NULL;
}
/* avoid warning when restoring previously turned off decoration */
if (GTK_IS_WIDGET(frame_gtk->window))
if (GTK_IS_WIDGET(frame_gtk->window)) {
gtk_widget_destroy(frame_gtk->window);
frame_gtk->window = NULL;
}
frame_gtk->window = gtk_offscreen_window_new();
frame_gtk->header = gtk_header_bar_new();
@ -1526,10 +1537,9 @@ libdecor_plugin_gtk_frame_property_changed(struct libdecor_plugin *plugin,
if (!streq(frame_gtk->title, new_title))
redraw_needed = true;
free(frame_gtk->title);
frame_gtk->title = NULL;
if (new_title)
frame_gtk->title = strdup(new_title);
else
frame_gtk->title = NULL;
if (frame_gtk->capabilities != libdecor_frame_get_capabilities(frame)) {
frame_gtk->capabilities = libdecor_frame_get_capabilities(frame);
@ -2100,6 +2110,7 @@ pointer_leave(void *data,
if (frame_gtk) {
frame_gtk->active = NULL;
frame_gtk->hdr_focus.widget = NULL;
frame_gtk->hdr_focus.type = HEADER_NONE;
draw_decoration(frame_gtk);
libdecor_frame_toplevel_commit(&frame_gtk->frame);
update_local_cursor(seat);
@ -2532,15 +2543,6 @@ globals_callback(void *user_data,
wl_callback_destroy(callback);
plugin_gtk->globals_callback = NULL;
if (!has_required_globals(plugin_gtk)) {
struct libdecor *context = plugin_gtk->context;
libdecor_notify_plugin_error(
context,
LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE,
"Compositor is missing required globals");
}
}
static const struct wl_callback_listener globals_callback_listener = {
@ -2580,6 +2582,13 @@ libdecor_plugin_new(struct libdecor *context)
wl_callback_add_listener(plugin_gtk->globals_callback,
&globals_callback_listener,
plugin_gtk);
wl_display_roundtrip(wl_display);
if (!has_required_globals(plugin_gtk)) {
fprintf(stderr, "libdecor-gtk-WARNING: Could not get required globals\n");
libdecor_plugin_gtk_destroy(&plugin_gtk->plugin);
return NULL;
}
/* setup GTK context */
gdk_set_allowed_backends("wayland");

View File

@ -40,6 +40,8 @@ void Fl_Printer::untranslate(void) {}
int Fl_Printer::end_page (void) {return 1;}
void Fl_Printer::end_job (void) {}
void Fl_Printer::set_current(void) {}
void Fl_PostScript_File_Device::end_current(void) {}
void Fl_PostScript_File_Device::set_current(void) {}
bool Fl_Printer::is_current(void) {return false;}
Fl_Printer::~Fl_Printer(void) {}

View File

@ -1075,7 +1075,10 @@ Fl_Font Fl_Cairo_Graphics_Driver::set_fonts(const char* /*pattern_name*/)
// Force LANG=C to prevent pango_font_face_get_face_name() below from returning
// translated versions of Bold, Italic, etc… (see issue #732).
// Unfortunately, using setlocale() doesn't do the job.
saved_lang = strdup(saved_lang);
char *p = saved_lang;
saved_lang = (char*)malloc(strlen(p) + 6);
memcpy(saved_lang, "LANG=", 5);
strcpy(saved_lang + 5, p);
fl_putenv(Clang);
} else saved_lang = NULL;
static PangoFontMap *pfmap_ = pango_cairo_font_map_get_default(); // 1.10
@ -1089,10 +1092,13 @@ Fl_Font Fl_Cairo_Graphics_Driver::set_fonts(const char* /*pattern_name*/)
pango_font_family_list_faces(families[fam], &faces, &n_faces);
for (int j = 0; j < n_faces; j++) {
const char *p = pango_font_face_get_face_name(faces[j]);
// Remove " Regular" suffix from font names
if (!strcasecmp(p, "regular")) p = NULL;
// build the font's FLTK name
int lfont = lfam + strlen(p) + 2;
int lfont = lfam + (p ? strlen(p) + 2 : 1);
char *q = new char[lfont];
snprintf(q, lfont, "%s %s", fam_name, p);
if (p) snprintf(q, lfont, "%s %s", fam_name, p);
else strcpy(q, fam_name);
Fl::set_font((Fl_Font)(count++ + FL_FREE_FONT), q);
}
/*g_*/free(faces); // glib source code shows that g_free is equivalent to free

View File

@ -1172,6 +1172,8 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi
//libdecor_frame_popup_grab(parent_xid->frame, scr_driver->get_seat_name());
}
wl_surface_commit(new_window->wl_surface);
// put it on same screen as parent_win
this->screen_num(parent_win->screen_num());
return false;
}
@ -1322,7 +1324,10 @@ void Fl_Wayland_Window_Driver::makeWindow()
xdg_surface_add_listener(xid->xdg_surface, &xdg_surface_listener, xid);
struct xdg_positioner *positioner = xdg_wm_base_create_positioner(scr_driver->xdg_wm_base);
xdg_positioner_set_anchor_rect(positioner, 0, 0, 1, 1);
float f = Fl::screen_scale(Fl_Window_Driver::menu_parent()->screen_num());
int snum = Fl_Window_Driver::menu_parent()->screen_num();
float f = Fl::screen_scale(snum);
// put it on same screen as parent menu
Fl_Window_Driver::driver(previous_floatingtitle)->screen_num(snum);
xdg_positioner_set_size(positioner, previous_floatingtitle->w() * f , previous_floatingtitle->h() * f );
xdg_positioner_set_anchor(positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT);
xdg_positioner_set_gravity(positioner, XDG_POSITIONER_GRAVITY_TOP_RIGHT);

View File

@ -22,6 +22,7 @@
#include <FL/fl_draw.H>
#include <FL/fl_string_functions.h> // fl_strdup()
#include <FL/platform.H>
#include <FL/fl_utf8.h>
#include "Fl_Font.H"
#include <stdio.h>
@ -1388,6 +1389,18 @@ Fl_Font Fl_Xlib_Graphics_Driver::set_fonts(const char* pattern_name)
fl_open_display();
int n_families, count = 0;
PangoFontFamily **families;
char *saved_lang = fl_getenv("LANG");
const char *Clang = "LANG=C";
if (saved_lang && strcmp(saved_lang, Clang)) {
// Force LANG=C to prevent pango_font_face_get_face_name() below from returning
// translated versions of Bold, Italic, etc… (see issue #732).
// Unfortunately, using setlocale() doesn't do the job.
char *p = saved_lang;
saved_lang = (char*)malloc(strlen(p) + 6);
memcpy(saved_lang, "LANG=", 5);
strcpy(saved_lang + 5, p);
fl_putenv(Clang);
} else saved_lang = NULL;
Fl_Xlib_Graphics_Driver::context();
Fl_Xlib_Graphics_Driver::init_built_in_fonts();
pango_font_map_list_families(Fl_Xlib_Graphics_Driver::pfmap_, &families, &n_families);
@ -1399,15 +1412,22 @@ Fl_Font Fl_Xlib_Graphics_Driver::set_fonts(const char* pattern_name)
pango_font_family_list_faces(families[fam], &faces, &n_faces);
for (int j = 0; j < n_faces; j++) {
const char *p = pango_font_face_get_face_name(faces[j]);
// Remove " Regular" suffix from font names
if (!strcasecmp(p, "regular")) p = NULL;
// build the font's FLTK name
int lfont = lfam + strlen(p) + 2;
int lfont = lfam + (p ? strlen(p) + 2 : 1);
char *q = new char[lfont];
snprintf(q, lfont, "%s %s", fam_name, p);
if (p) snprintf(q, lfont, "%s %s", fam_name, p);
else strcpy(q, fam_name);
Fl::set_font((Fl_Font)(count++ + FL_FREE_FONT), q);
}
/*g_*/free(faces); // glib source code shows that g_free is equivalent to free
}
/*g_*/free(families);
if (saved_lang) {
fl_putenv(saved_lang);
free(saved_lang);
}
// Sort the list into alphabetic order
qsort(fl_fonts + FL_FREE_FONT, count, sizeof(Fl_Fontdesc), (sort_f_type)font_sort);
return FL_FREE_FONT + count;