These virtual members are moved from Fl_Screen_Driver to Fl_System_Driver
- wait(double)
- ready()
These virtual members are moved from Fl_System_Driver to Fl_Screen_Driver
- copy(const char *stuff, int len, int clipboard, const char *type)
- void paste(Fl_Widget &widget, int clipboard, const char *type)
- clipboard_contains(const char *type)
- clipboard_notify_change()
These members are moved from Fl_X11_Screen_Driver to Fl_X11_System_Driver
- poll_or_select_with_delay(double time_to_wait)
- poll_or_select()
and are made virtual in preparation for the introduction of class
Fl_Unix_System_Driver.
The CMake instructions would use the wrong image libs (png, jpeg, zlib)
if the fallback was active (OPTION_USE_SYSTEM_XXX) was true but the
header files were not present.
This had already been fixed for jpeg but not for the other two libs.
This commit rearranges the logic for all three libs.
Add information about builtin or system libraries to config summary.
* Added filename function to Fl_Preferences
Static function to get filename before opening.
Member to get filename after opening.
Bug fixes for memory mapped preferences.
* ERROR is a macro on Windows, don't use it
* Added Fl_Preferences::dirty().
User can now check if the database will be written
when flushed or destroyed.
Flush returns a crude error code.
* Fl_Preferences::get binary data returns # of bytes read.
* Verified group deletion code
* Fl_Preferences ignores locale.
This will make .prefs files interchangeable
between different computers.
* Updating the Preferences Mode to ignore locale.
* Fixes in docs.
Implement a new way to make the GTK file-chooser window modal-like
by preventing any event processing by other FLTK windows.
The new way is also no longer X11-specific.
Processing of all FLTK events as well as window resizing while the file chooser runs is suspended,
Normal event processing and resizing is restored when chooser closes.
Add new method
Fl_Widget::draw_focus(Fl_Boxtype t, int x, int y, int w, int h, Fl_Color bg)
... with background color for correct contrast testing (in Fl_Tabs)
Draw the focus box of the "tabs" of Fl_Tabs widgets with the correct
boxtype and background color.
Make 'unsigned int visible_focus()' const so it can be used in 'const'
methods.
Do not draw the focus box if the per-widget focus box option is off.
FLTK 1.3 supports complex text input methods (TIMs) for the 3 platforms
(X11, Windows, macOS). This support has an interface with FLTK that is
common for X11 and Windows, via (undocumented) functions fl_set_spot(),
fl_set_status() and fl_reset_spot().
In contrast, and because it's been developed independently, the
interface between the macOS TIM and FLTK 1.3 is completely different :
static functions FL::insertion_point_location() and Fl::reset_marked_text().
The present change implements a single TIM/FLTK interface
used by all platforms based on functions fl_set_spot() and
fl_reset_spot().
The previous macOS-specific functions FL::insertion_point_location() and
Fl::reset_marked_text() are maintained only for compatibility with 1.3
and deprecated.
... as discussed in fltk.coredev in thread "RFC: introduce public
config header <FL/fl_config.h>", see:
https://groups.google.com/g/fltkcoredev/c/xLCs1AIXMVo/m/MHZpQggzAQAJ
- Rename abi-version.h to fl_config.h, rename input files,
update dependencies, .gitignore, CMake, configure and Makefiles.
- Include Cairo options in FL/fl_config.h
- Rename FLTK_USE_CAIRO to FLTK_HAVE_CAIROEXT for consistency.
- Include <FL/fl_config.h> in config.h and wherever necessary,
fix include order (move FL/Fl.H to the top) and more.
- Move USE_X11 to fl_config.h and rename to FLTK_USE_X11
- Do not include <config.h> in Cairo demo program which is no
longer required in Cairo programs since FLTK 1.4.0
This fixes issue #309: FLTK 1.4 does not properly size window when using display scaling on Windows 10.
FLTK now tests whether the app's DpiAwareness has been previously set, presumably
via a manifest, before attempting to set it to FLTK's preferred level DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
Thanks to Paul D. Hahn for finding these issues on his very old
"CentOS 6 linux with g++ 5.1" system.
For details see the very long thread "fl_choice() dialog apprearance
discrepancy problem in 1.4" (typo intentionally ignored):
https://groups.google.com/g/fltkgeneral/c/UQk3RRf-l4A/m/0GtPNv1CCQAJ
Use of the kdialog command by class Fl_Naive_File_Chooser can now be turned off
at build-time through CMake OPTION_USE_KDIALOG.
If building via configure + make, set #define USE_KDIALOG to 0 in config.h before make.
Under the X11 platform, class Fl_Native_File_Chooser will behave as follows :
- if the KDE desktop is used and if command "kdialog" is available in the path,
the Qt/KDE file chooser is used;
- otherwise, if the GTK library is available at run-time,
the GTK file chooser is used;
- otherwise, the FLTK file chooser is used.
In addition, when Fl::OPTION_FNFC_USES_GTK is off, the FLTK file chooser
is always used.
"Tiny window problem if child group larger than window"
See Greg's comment 4: "something is wrong here: either the logic or
the docs are incorrect, not sure which."
It turned out that both were incorrect.
Since we fixed the code this commit completes the STR by fixing the
docs as well so they match the behavior.
The previous name existed already with different case (fl_string.h)
in the FL folder which broke the build on macOS and Windows.
This may be a temporary fix - until I find a better way.
Since macOS 11, configure --enable-x11 (and the equivalent with CMake)
fails when compiling fl_write_png.cxx in parsing of time.h.
The error happens only if png.h is included without time.h having
been included before.
The fix is to #include time.h before png.h
A better fix than his hack is desirable.
The bug would appear with test/device and when scaling up to 133% or above:
the background of the Porsche pixmap would be truncated.
The bug requires to set OPTION_XRENDERER=0 to appear.
src/print_button.cxx: "Print front window" implementation (new file)
This is compiled and activated if USE_PRINT_BUTTON is defined.
The feature can be fine controlled by environment variable
'FLTK_PRINT_BUTTON' (see docs in source file).
The error was reported for "centos 6 with devtoolset-6 installed
which contains gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3)".
The fix includes the missing header files *and* makes sure that the
correct conversions (to size_t) take place as in
src/drivers/PostScript/Fl_PostScript_image.cxx.
The new function fl_write_png() was moved to its own file and is now
publicly available ("exported") so other programs can use it.
This function was used in fluid to write a window screenshot (.png)
together with a template (.fl) to preferences storage.
This undocumented macro is used on X11 and macOS platforms to
consolidate mouse move events, i.e. to collect some events and send
them later as one event. The old macro name CONSOLIDATE_MOTION has been
renamed to FLTK_CONSOLIDATE_MOTION since it is now a "global" symbol.
Users can define FLTK_CONSOLIDATE_MOTION in their build system, e.g.
on the compiler commandline, as 0 or 1 to disable or enable this
feature, respectively.
In FLTK 1.3 the default was 0 (OFF) on macOS and 1 (ON) on X11.
In FLTK 1.4 the default is always 0 (OFF).
This fixes focus box drawing on X11 for some broken graphics
drivers with line width zero as discussed on issue #156 titled
"Incorrect rendering on Alpine Linux".
This title is not entirely correct. The issue has been observed on
other Linux distros as well if the "modesetting" driver is in effect.
This does not fix rectangle drawing (missing pixels) in general which
is obviously caused by a similar or the same driver issue.
Declare Fl_Scroll::bbox() and Fl_Scroll::recalc_scrollbars() 'const'.
These methods don't change the Fl_Scroll widget.
Use Fl_Scroll::recalc_scrollbars() in Fl_Scroll::bbox() to simplify
the code and to avoid code duplication.
bbox() can now be called at any time and returns the correct values,
no matter if draw() has been called before.
There's not much we can do if we find unknown data in the main
parser loop. The best we can do is terminating.
If we find a GIF trailer (0x3b) this means logical end of file.
If we get there in the main loop the GIF file is empty (no image).
This behavior is consistent with many other image viewers including
browsers (Firefox and Chrome).
This is part 1 and a prerequisite for the fix of issue #271.
It enables the user of this internal class (Fl_{BMP|GIF}_Image)
to test for read errors and EOF (end of file) while reading.
The method used to read data from memory got an optional third
argument 'const long datasize = -1)' to limit the size of the
memory block of data provided to the image reader. Default is -1
which means "unlimited" (backwards compatibility).
Using only two arguments (w/o size limit) is deprecated and should
only be done if the data size is not available.
src/Fl_Native_File_Chooser_WIN32.cxx:331:12: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
331 | while ( s=strchr(s,'\\') ) *s = '/';
| ~^~~~~~~~~~~~~~~
src/Fl_Native_File_Chooser_WIN32.cxx:336:12: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
336 | while ( s=strchr(s,'/') ) *s = '\\';
| ~^~~~~~~~~~~~~~
I compiled with `-Wextra-semi -Werror=extra-semi` on Linux and Windows
(cross-compiled on Linux) and removed all "extra semicolon" warnings
I could find. I didn't check on macOS (yet).
Note: Linux configured with and w/o Pango but not w/o Xft. Compilation
with other options (e.g. Cairo) might still emit such warnings.
Add CMake test for PTHREAD_MUTEX_RECURSIVE
Add autoconf/configure compile test for PTHREAD_MUTEX_RECURSIVE
Replace "#ifdef PTHREAD_MUTEX_RECURSIVE"
with "#ifdef HAVE_PTHREAD_MUTEX_RECURSIVE"
and define HAVE_PTHREAD_MUTEX_RECURSIVE in config.h
- add missing dependencies to build the shared libfltk_cairo(.dylib)
- remove incorrect dependency on cairo from libfltk
- add cairo_test-shared demo (linked with shared libs)
The old version would reschedule an existing timer if a matching timer
existed already which was unique to macOS.
The new behavior is consistent on all platforms and allows to create
multiple timer entries with the same callback and userdata.
Calling Fl::repeat_timeout() instead of Fl::add_timeout() to create
a timer would crash on macOS but fall back to Fl::add_timeout() on
Windows and Unix/Linux. Although this is documented as "undefined
behavior" a crash should always be avoided and the fallback is now
consistent on all major platforms.
In the future this may be documented as the standard behavior.
Issue #210: "Fl::event_x() & event_y() doesn't take into account
embedded window's coords with Mouse wheel events"
In fact the calculation of Fl::event_x() and Fl::event_y() used the
wrong window coordinates if the event was sent to a subwindow.
This is a hypothetical fix, since the condition `count == 0` may not
be true although `doit` has been allocated. In practice this should
not be possible since the same loop is executed twice in lines 463++
and 471++. But anyway, here it is...
Some of the previous constness changes turned out to be incomplete,
others had to be reverted because some other driver methods could
not be made 'const' - particularly those calling open_display() to
get the requested information.
As requested by issue #181:
"Fl_Screen_Driver.H non-const functions should be const"
Not all methods could be made 'const' because some screen related
methods call init() internally.
src/Fl_Native_File_Chooser_WIN32.cxx:190:10:
warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound
depends on the length of the source argument [-Wstringop-overflow=]
190 | strncpy(wp2, string, n);
| ~~~~~~~^~~~~~~~~~~~~~~~
Although there was no real problem with the code (the allocated buffer
was large enough), the code was questionable and there was redundant
code that could be simplified.
Actually we don't know about some newer MSVC versions, but current
version MSVC 2019 works fine w/o defining round(). If other MSVC
versions need this as well we can change the version test or add
a compiler feature test to CMake (configure not required).
The font size is set to the value necessary for the GL scene before
computing the string width.
Virtual Fl_Gl_Window_Driver::effective_size() becomes unnecessary.
PR #203 "Multithread fix for PNG loading" includes a suggested fix
that moves the variable fp to the Fl_PNG_Image structure.
This commit fixes the threading issue by allocating the variable fp
with new, avoiding the [-Wclobbered] warning w/o using a static var.
The same issue is now also fixed in Fl_JPEG_Image.
Albrecht caught a problem with my strncat use (see comments for 12d8da9c).
I noticed we have fl_strlcpy() and fl_strlcat() which is what was really
needed here.
This file was included (in math.h or elsewhere) on Linux and latest
macOS versions but maybe not in earlier macOS versions or with other
configuration options.
Applied vsnprintf_v2.patch from STR#3413 which documents
the previously undocumented function, so that it shows up
here in the doxygen docs:
Files -> File List -> vsnprintf.c -> fl_vsnprintf()
This commit does not solve STR #3413, just adds the recommended documentation
for fl_vsnprintf(). Other functions in src/vsnprintf.c could use docs too.
See the bottom of comment #5 in the STR for recommendations to fully solve.
This fixes the inconsistency created by the possibility to change img->w() and img->h()
values. The fix is to use img->data_w() and img->data_h() that have constant values.
Most coordinate calculations are done with the new inline function
int Fl_Scalable_Graphics_Driver::floor(int coord)
that is used by both the Windows and X11 platforms.
- rewrite to use pkg-config with both autoconf + CMake
- remove hardcoded library names
- fix build dependencies and search directories
- remove or replace old and unused variables
- update README files
To be done:
- implement fallback for autoconf/configure if pkg-config is missing
- fix pango build (uses cairo internally)
... except src/Fl.cxx
Fl.cxx uses the FL_CFG_* macros to define the values of runtime
configuration options. This is now the only usage of config_lib.h.
Todo: we can probably implement these runtime config vars in another
way and finally remove config_lib.h.
Select the "best" target rather than a random one out of a list of
suitable targets. The old target selection algorithm would sometimes
select the wrong target and hence retrieve unexpected data.
This could happen in both copy-paste and drag-and-drop operations.
Note: backported to 1.3.6 (git current) as well
(commit 7ce6d2cf5d).
Closes#182.
The fix in mouse_event() makes sure the scale factor of the receiving window is correct
when distinct screens have distinct scale factor values.
The fix after WM_MOVE event makes sure a subwindow-containing window in a
multiple-screen desktop having distinct scale factor values is correctly rescaled.
Fix search (string comparison) which had a few different issues.
Document the function, arguments, and details about string matching.
To do: correctly match complex HTML entities like "€" with
Unicode code points >= U+0080 (UTF-8 multi byte encoding).
Under XP (at least), WM_PAINT events occur where information of where to redraw
is mostly given by the system, in the window's update region. When the GUI is scaled,
that information must be un-scaled and then added to Fl_X::i(window)->region, for the
adequate part of the window to be painted.
The corrected error was to use, e.g.,
int dx = W - w->w() * s;
which does not produce the desired integer value.
The correct writing is :
int dx = W - int(w->w() * s);
Changes here concentrate the fix within static function alpha_blend() and thus
are visible only when drawing transparent images under X11 platform
without Xrender.
The issue lies in details how floating point scaled coordinates are converted
to integer values and its impact on the drawing of large SVG images.
This commit fixes the X11 platform.
The macOS platform is immune because drawing uses floating point
coordinates.
The Windows platform still needs fixing.
Thanks to "fire-eggs" for spotting it.
Also minor optimisations in Fl_X11_Screen_Driver::read_win_rectangle_unscaled() and
Fl_Cocoa_Screen_Driver::read_win_rectangle_unscaled().
This closes PR #151.
* save fl_file_chooser directory on cancel (STR3225)
by default, the fl_file_chooser() starts in the current directory
if no filename is given, but the directory is reset to the "system
directory" if the dialog is cancelled without choosing a file.
This patch saves and restores the directory if no file is chosen.
See also https://www.fltk.org/str.php?L3225
* add fl_file_chooser() reinitialization comments
Use cairo-PostScript to output PostScript when pango is available.
This allows to draw in vectorial form any script.
Before, only the Latin script could be drawn to PostScript in vectorial form.
That is necessary to support macOS Big Sur because previous procedure
did not work for tabbed windows. The new procedure is potentially
usable from macOS 10.5, but tested at this stage for macOS ≥ 10.15.
The intent is to gather in a single place of the X11 platform source code
all variable elements when using dlopen() and dlsym() system functions
(e.g., .so vs .dylib extension name, is RTLD_DEFAULT available, locations
to be sought).
Member function Fl_System_Driver::load() is created only to support
Fl_Plugin_Manager::load().
The deprecated methods are now calling the new methods to be
entirely compatible.
These methods should be removed in 1.5.0
(fix unrelated whitespace as well)