1) add Wayland code that prevent subwindows from leaking outside their parent.
This does not cover GL subwindows.
2) add macOS code that prevent GL subwindows from leaking outside their parent.
This fixes issue #494 for the macOS platform.
N.B.: Wayland GL subwindows are not prevented from leaking because no solution
that would not require any change in client applications was found. Code that
would cover Wayland GL subwindows but would require client applications to always
use the FL_ALPHA flag is included in this commit in commented out form.
Conflicting demands arise in the implementation of class Fl_Xlib_Graphics_Driver
for drawing images with the XRender library :
1) Issue #163 leads to use a bilinear filter to draw-and-scale images.
2) This tends to blur the edges of drawn areas which is bad for tiled images
(that is because the edges get alpha values, even for an opaque source image).
This commit resolves the conflict adding a means to detect whether the library
is busy drawing a tiled image. If so, the bilinear filter is not applied, drawn areas
don't have blurred edges, resulting in a nice tiling.
With this commit, these test apps perform correctly:
- tiled_image is correct at all scaling factor values also when modified
to use a depth-3 or a depth-4 Fl_RGB_Image as tile;
- unittests - Drawing Images is correct at all scaling factor values;
- pixmap_browser scales correctly up and down JPEG and PNG images.
Support different margin sizes on all four edges. Default margin
and gap size is now 0 (compatible with Fl_Pack).
Doxygen: move the description from the constructor to the class
declaration which constitutes a "description".
Make some methods virtual and/or 'const'.
Clarify demo programs, make them even more "FLTK style".
This work is based on the repository and latest commit:
https://github.com/osen/FL_Flex.git
commit 36e4ed75a00daac825b87e81295818b4650991f5
Author: Karsten Pedersen <...>
Date: Fri Apr 23 12:06:16 2021 +0000
Added Fltk (LGPL) license.
This widget is similar to Fl_Pack and supports either one row or one
column of widgets but has some more features. Test and demo programs
are included:
test/flex_login.cxx: simple "login window" demo program
test/flex_demo.cxx: slightly more complex demo program
The original demo programs can still be compiled and built with
the new widget provided you '#include <FL/Fl_Flex.H>'.
Backwards compatible methods are included (except debug()).
The original widget has been modified to match FLTK standards and
enhanced in several ways, including:
- support box frames
- add HORIZONTAL and VERTICAL enum values (as in Fl_Pack)
- add horizontal() method (as in Fl_Pack)
- use type() rather than internal 'direction' variable
- add standard widget constructor (x, y, w, h, label)
- add margin and gap accessors rather than hard coding constants
- improve test and demo programs
- add documentation
- replace <vector> with array as required by FLTK CMP
- rename camelCase method names, keeping old names for compatibility:
- change 'setSize(Fl_Widget*, int)' to 'set_size(Fl_Widget*, int)'
- change 'bool isSetSize(Fl_Widget*)' to 'int set_size(Fl_Widget*)'
- remove debug() method
- add a way to "unset" fixed size: set_size(Fl_Widget *, 0)
- add layout() method to force recalculation of children
- unify resizeRow() and resizeCol() methods to avoid code duplication
- improve widget size calculation.
This widget overrides FL_NO_BOX internally by FL_UP_BOX for all
practical purposes, e.g. draw(). This has been this way since
its initial release and can't be changed.
- emphasize that Fl_Image::copy(W, H) creates an image with
w() == data_w() == W and h() == data_h() == H
- clarify some more docs of Fl_Image methods (ensure that data_w()
and data_h() are used where appropriate rather than w() and h()
- improve wording, examples, and formatting of related docs.
Closes#431
Copying an image does not (and must not) change the original object,
hence copy() should always be 'const'.
This is *necessary* if the given Fl_Image object is 'const'.
- Add this include statement only where needed.
- Rename Fl_System_Driver::stat() to flstat().
This fixes an issue when using some (!) MinGW 64-bit build systems
that obviously '#define stat _stat64' or similar. This would
result in compiler problems if 'stat()' is a member function of
Fl_System_Driver.
This public method returns a pointer to the internal Fl_Image
object (const Fl_Image *). This is only for reference, the internal
image must not be modified by user code but it can be inspected and
copied to another image.
For details see comment in src/Fl_x.cxx: this "Hack to speed up
bg box drawing" is now disabled for several reasons. The code
is still available if the macro ENABLE_BOXCHEAT is defined.
Windows platform: Remove comments about obsolete code and one
exported declaration of the variable 'fl_background_pixel' which
is used only on the X11 platform.
X11 platform: Remove comments.
Other platforms: not affected.
* Provide a link to the "FLTK standard box types" image
The doc for Box Types has the text "see figure 1" which does not exist! [It is figure 5.3 in PDF, no number in HTML].
This change provides a hyperlink which allows the reader to actually navigate to the cited figure.
Confirmed to work as desired in HTML; I don't have LATEX so cannot confirm the PDF.
* Add figure title "Standard Box Types" (#397)
Co-authored-by: Albrecht Schlosser <albrechts.fltk@online.de>
* Fix build system for unites,
* Updated unittest to check OpenGL drawing.
Making sure that OpenGL drawing is exactly the same
as native drawing to make FLTK widget rendering
look the same in GL windows.
* Make OpenGL optional.
* Implemented clipping in OpenGL
* unites drawing fast shapes
* Fixed CMake
* Updating unittest.
Added tests for fl_pi and fl_arc (int)
Renamed tab to render complex shapes.
* Improved OpenGL FLTK drawing emulation.
* Fixed GTK ROUND DOWN BOX
* Fixing Makefile for unittest
* Correctly aligning OpenGL text.
* Fixed text alignment in GL windows.
Explained the "FLTK over GL " example in Cube.
* Overlapping test.
* Better GL graphics alignment.
* Drawing the focus rect.
* Adding Alpha Channel support for GL.
* Added FLTK-on-GL documentation.
- Fix compiler warning [-Wmaybe-uninitialized] for variable home
- Reformat enum 'Root' for better readability
- Add new enum values CORE_SYSTEM_L and CORE_USER_L
- Improve documentation (deprecated and new enums)
- Initialize internal static variable 'filename' which could be used
uninitialized and thus return any previous value (type == MEMORY)
* 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.
Elaborated on Fl_Cairo_Window's use of FLTK style coordinates,
and how this differs from cairo's default native normalized
coordinate system, and shows how to switch from one to the other.
Also, small comment fix to the cairo example regarding the "X" color.
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
Make clear that outside labels of widgets are not considered when
calculating the bounding box of the children (scroll area) and
include a hint to add an invisible box if necessary.
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.
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.
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.
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.
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin20.4.0
Warning appeared after upgrade to Xcode 12.5 in several files,
example:
In file included from Fl_Scroll.cxx:19:
../FL/Fl_Scroll.H:102:17: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
typedef struct {
^
ScrollInfo
../FL/Fl_Scroll.H:104:5: note: type is not C-compatible due to this member declaration
typedef struct { int x,y,w,h; } Fl_Region_XYWH;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../FL/Fl_Scroll.H:128:5: note: type is given name 'ScrollInfo' for linkage purposes by this typedef declaration
} ScrollInfo;
^
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.
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.
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.
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)
Previously (FLTK 1.3.x) the return value of a checked menu item
was FL_MENU_VALUE (4) but the docs warned explicitly:
"You should not rely on a particular value, only zero or non-zero."
* Fix Fl_Check_Browser.{H|cxx} indentation (#121)
... and some more whitespace errors as proposed by Greg
... in issue #121: Fl_Check_Browser--whitespace-patch.txt
Fixes#121
* Fix copyright years
Make maximum box corner radius and shadow width configurable.
See Fl::box_border_radius_max() and Fl::box_shadow_width().
Documentation: update image of box types.
Fixes#130
These unused typedefs are not used anywhere and should not be defined
at all.
Remove typedef 'Fl_String' as decided in fltk.coredev.
Remove typedef 'Fl_CString' as well for the same reason.
fix dead links to Fl_Group::resizable(Fl_Box *box)
reorder paragraphs to highlight different behaviour
add link to new "How does resizing work?" chapter in dox
A lot of code touched because low level functions needed to pass up
error messages reliably, and this had to propagate up the entire
driver hierarchy.
Tested OK *in English* on:
> Linux
> OSX 10.10.x
> Windows VS2017
> Windows mingw64
I have no way to test on Android, but it might work.
TODO: Needs testing in other languages to verify proper UTF8 error messages,
esp. with Windows VS, due to complexities with FormatMessage() -- see get_ms_errmsg()
Amended by Albrecht:
- rename union member variables as discussed
- add comments to new array_ union members
Fixes#96
Signed-off-by: Albrecht Schlosser <albrechts.fltk@online.de>
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files
The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
Test programs device and pixmap_browser use these new classes.
Class Fl_SVG_File_Surface can be optionally made non functional using the
--disable-svg configure option or turning off OPTION_USE_SVG in CMake.
Class Fl_EPS_File_Surface can be optionally made non functional using the
--disable-print configure option or turning off OPTION_PRINT_SUPPORT in CMake.
- add 'can_expand' optional parameter to scale()
- don't expose name and e-mail of the nanosvg author in docs
- format example code according to the FLTK coding style
- fix (some) trailing spaces
FTR: all examples compile and work well with current FLTK 1.4.
(1) The new virtual method Fl_Image::release() which is equivalent to
'delete this' automatically extends to Fl_Shared_Image::release()
which makes the latter method virtual.
This new method in the base class makes Fl_Image::release() callable
on all objects derived from Fl_Image.
(2) Add virtual method Fl_Shared_Image *Fl_Image::as_shared_image()
This new method can be used to detect whether an Fl_Image instance
is an Fl_Shared_Image or not.
Add argument 'center' to position the message box centered over
the given x/y coordinates.
Add another method to supply a widget or window to center the
message box over.
Fix documentation and don't use INT_MIN to avoid having to
include limits.h in user code.
Add new function to set (x,y) position.
Reset to previous mode after innards is called by fl_* function.
Use magic number for preferred position state.
Note: several commits squashed and commit messages edited by AlbrechtS.
Metrowerks CodeWarrior was an ancient macOS compiler (discontinued
since 2005) that defined the macro __MWERKS__. Code using this macro
and several comments have been removed.
According to the documentation fl_font(face, size) may be called
"outside a draw context if necessary to call fl_width()".
This worked in 1.3.5 but did not in 1.4 (so far). I reworded the
docs to make clear that other measurement functions can be called
as well and refactored the code to make sure that fl_font(face, size)
will open the display if necessary.
The X11 specific overloaded function fl_open_display(Display *)
has never been documented but exposed (and "exported" in the ABI)
in FL/platform.H which is not necessary. This internal function
is now static and no longer exposed in the ABI.
Don't confuse with fl_open_display() w/o arguments which is still
exported and declared in FL/platform.H.
Unfortunately this typedef for shortcuts in Fl_Menu_Items etc.
can currently not be used with the full (21-bit) range of Unicode.
These restrictions are now documented but should be removed in a
future version, if possible.
Clarify functionality of fl_not_clipped() and fl_clip_box().
Add developer documentation for Fl_Graphics_Driver::clip_box().
Documentation only, no code changes in this commit.
This new class is explicitly internal and undocumented. We can
rename and/or redefine or extend it as we need.
This work is based on Matt's recent update with separate internal
classes BMPReader and GIFReader which have been replaced by
Fl_Image_Reader.
The FLTK 1.0 compatibility support by defining macro 'FLTK_1_0_COMPAT'
did no longer work since FLTK 1.3.x and nobody complained. Hence we
can safely remove this "feature".
Documentation changes:
- Drop chapter 'Migrating Code from FLTK 1.0 to 1.1'
- Drop chapter 'Migrating Code from FLTK 1.1 to 1.3'
- Add chapter 'Migrating Code from FLTK 1.3 to 1.4'
The removed chapters are still available in FLTK 1.3 docs.
Added Fl_Preferences::file_access() and various flags that make it possible to limit or completely deny file access to the preferences system, either for the core library or for the application or both.
The code to determine whether the GTK library is available is now in Fl_X11_System_Driver::probe_for_GTK()
called both by Fl_Printer::begin_job() and Fl_Native_File_Chooser.
New Fl::option OPTION_PRINTER_USES_GTK allows to deactivate use of
the Gnome print dialog.
Minor change in Fl_Native_File_Chooser: GTK version 3 is searched before version 2,
whereas the search order was the opposite before.
Users can press ctrl-c (or ctrl-x) while using the fl_color_chooser()
function or the Fl_Color_Chooser widget to copy the current color
selection to the clipboard.
This method can be called after all menu modifications to make sure
the menu() array is relocated (copied from the internal working area)
to a private place owned by the Fl_Menu_ instance.
menu_end() is now called in Fl_Menu_Button::popup() to make sure
the menu array is in private storage.
This fixes STR 3523 w/o user code changes. Calling menu_end() is
in most cases optional.
Todo: call menu_end() where useful (or necessary), e.g. in
Fl_Choice, Fl_Menu_Bar, etc. ?
Rename member function Fl_Surface_Device::end_current_() to end_current(),
set it protected, and make it called by the destructor of all classes
derived from Fl_Surface_Device that re-implement end_current().
This way, end_current() runs equally if Fl_Surface_Device()::pop_current()
is called before or after the drawing surface is deleted.
Particularly to Doxygen docs and NEdit which appears to have moved
to sourceforge (according to Wikipedia), see
https://en.wikipedia.org/wiki/NEdit
Note: nedit.org exists but shows some non-English text.