Commit Graph

11668 Commits

Author SHA1 Message Date
Albrecht Schlosser
d0922792ae Improve fl_contrast() functionality and documentation
- swap 3rd and 4th parameter of fl_contrast()
- change 'Fl_Fontsize fs' to a neutral 'int size' parameter
- clarify documentation of fl_contrast_level() and that different
  contrast algorithms use different level values
- clarify that level 39 for the CIELAB mode results in "sufficient"
  contrast, i.e. /readable/ text which is the only intention of
  fl_contrast().

Reasoning: swapping the arguments looks more natural, i.e. the context
before another argument (size) is what one would usually expect. Since
the 'size' argument doesn't have be a font size, making it a simple
'int size' is more flexible and correct for future extensions.
2024-05-17 14:20:01 +02:00
ManoloFLTK
7410498a7f Comment that macOS windows move OK between LowRes and HighRes screens 2024-05-17 09:53:47 +02:00
Albrecht Schlosser
9820d9f555 Fix and improve fl_contrast() calculations
- src/fl_contrast.cxx:
  - FL_CONTRAST_LEGACY: reset black/white threshold from 55 to 50
  - FL_CONTRAST_CIELAB: change default contrast level from 55 to 39

- test/contrast.cxx:
  - set default contrast mode to CIELAB
  - add "random color" button to test random foreground colors (text)
  - slightly increase terminal size
  - make the Fl_Terminal widget the resizable() of the window
2024-05-16 19:58:24 +02:00
ManoloFLTK
9df6dc2aeb Fix uses of isupper() and isprint() - STR #3436 2024-05-15 14:59:13 +02:00
ManoloFLTK
a9085c3b11 Change member function args to Fl_Menu_Bar::play_menu(const Fl_Menu_Item *) 2024-05-15 11:50:32 +02:00
ManoloFLTK
66c37e5128 Fix crash in test/cube under macOS when using Quit menubar item 2024-05-14 18:15:05 +02:00
ManoloFLTK
79c3db48cf New member function Fl_Menu_Bar::play_menu(const char *title) 2024-05-14 17:46:25 +02:00
Albrecht Schlosser
ea96237525 Update bundled libpng from 1.6.42 to 1.6.43 2024-05-13 19:18:54 +02:00
Albrecht Schlosser
1325a257bf Update README.txt 2024-05-13 19:08:42 +02:00
Albrecht Schlosser
bc63ea7629 CMake: improve linking OpenGL3 example programs (#959)
- Remove find_library(LIB_GLEW ...) from 'resources.cmake'

- Use the variable FLTK_GLEW_DIR to "find" a user supplied GLEW library
  for OpenGL3 example programs (examples/OpenGL3*.cxx).
  Both static and shared libs (DLLs) are supported, but the static
  library is preferred to avoid DLL dependencies.

- Define preprocessor macro 'GLEW_STATIC' by CMake compile definitions
  if and only if the static glew library (glew32s) was found and linked.
  The previous code defined 'GLEW_STATIC' unconditionally in the source
  code which led to undefined references if a shared lib (DLL) was used.
2024-05-13 15:19:27 +02:00
Albrecht Schlosser
d1ea57bc7a CMake: improve finding cairo.dll on Windows
- don't use pkg-config to find Cairo if FLTK_CAIRO_DIR is set
- use FLTK_CAIRO_DIR to locate Cairo headers and DLL if it is set
- otherwise try to find Cairo with pkg-config anyway

This prevents accidentally "finding" the system Cairo libs provided
by MSYS - which would tie the FLTK library and user programs to MSYS,
i.e. it would make FLTK programs depend on the MSYS installation.
2024-05-13 15:18:04 +02:00
ManoloFLTK
a28a7c381d Documentation: add details about handling of FL_DND_RELEASE event
see also STR #3399.
2024-05-13 14:58:14 +02:00
ManoloFLTK
5b3dd72e4e Wayland: call gtk_surface1_set_modal() of GTK Shell protocol - cont'd 2024-05-13 13:24:07 +02:00
ManoloFLTK
95eb4cb91a Remove change erroneously committed at 4eb98c0 2024-05-13 13:07:14 +02:00
ManoloFLTK
4eb98c0af4 Fl_Menu_Bar: document how to programmatically open menu from menubar 2024-05-13 12:46:47 +02:00
Albrecht Schlosser
6c06e953e1 Fix "Cannot build project with CMake ..." (#970)
... (add_library cannot create ALIAS target "fltk" because target
"fltk::fltk" is imported but not globally visible)

It turned out that this was due to a CMake feature that was changed in
CMake 3.18. This commit makes imported FLTK targets globally visible
for CMake versions less than 3.18.
2024-05-13 12:05:27 +02:00
ManoloFLTK
ef33f3e0e2 Wayland: call gtk_surface1_set_modal() of GTK Shell protocol for modal wins
This has the Mutter compositor open modal windows at the center of their parent window
rather than at an unpredictable display position before this commit.
2024-05-11 19:52:00 +02:00
Albrecht Schlosser
e9feef99fa Update README.CMake.txt for building X11 specific programs
Clarify different ways to disable Wayland in executable programs
designed to use X11 specific code w/o further changes.
2024-05-11 17:29:26 +02:00
Albrecht Schlosser
e5afb8a532 Enable suppression of "deprecated" warnings (FL_NO_DEPRECATE)
This is intended for backwards compatibility with FLTK 1.3.x code
ported to 1.4.0.

Users defining FL_NO_DEPRECATE can compile old (1.3.x) code w/o
seeing lots of "deprecated" warnings. A legitimate use case is if
old (1.3) code is intended to be used with both FLTK 1.3 and 1.4.

FL_NO_DEPRECATE should NOT be defined if the user's code is targeted
at 1.4.x or later. Users should fix their code to be prepared for
the next minor release (e.g. 1.5.0).

Todo: document this.
2024-05-11 17:14:28 +02:00
ManoloFLTK
0078733fcb Fix DnD to Wayland FLTK app on the KDE/Plasma desktop 2024-05-11 08:27:05 +02:00
ManoloFLTK
f56999aaf8 Add detailed comment about getting all supported XDND data types 2024-05-11 07:43:27 +02:00
ManoloFLTK
32b9c120f0 Fix DnD from Wayland gnome app to X11 FLTK app
This DnD gives two data types of the dragged text: text and a gnome-specific type.
The code previously accepted DnD with 1 data type or 4 or more data types,
and processed situations with 2 or 3 data types in a special way that fails
with gnome source apps.
The new code processes situations with 2 and 3 data types just like other ones.
This works OK when dragging from gnome wayland apps.
2024-05-10 20:26:53 +02:00
ManoloFLTK
7b76552d18 Wayland: slightly improved fix for issue #878 2024-05-10 14:43:48 +02:00
ManoloFLTK
25ffce6cdf configure-based build: move terminal to fluid-dependent section 2024-05-10 08:20:31 +02:00
ManoloFLTK
29312ee090 Restore building with configure under Windows: add -lwinspool 2024-05-10 07:44:03 +02:00
ManoloFLTK
a9a800fe3d Wayland documentation: improve layout 2024-05-10 07:42:50 +02:00
Albrecht Schlosser
da58045c23 Remove unused variables, fix compiler warnings 2024-05-09 19:55:53 +02:00
Albrecht Schlosser
79ddf2f2b8 Optimize "arrow" drawing and centering
- center (sub)menu arrow as good as possible
- adjust arrow sizes in Fl_Counter widget
- refactor "oxy" arrow drawing and centering in widgets
2024-05-09 19:46:07 +02:00
ManoloFLTK
ffd06dd9eb Fix README.Wayland about libdecor-related packages 2024-05-09 11:54:22 +02:00
ManoloFLTK
9fa66ecc8a Wayland documentation: improve "Input Methods" and various details
also fix typo mentionned -> mentioned
2024-05-09 11:00:27 +02:00
Greg Ercolano
549688598f Followup: avoid dereference null pointer (#971)
Changing _root->find_clicked(..) to just find_clicked(..)
includes the check of _root for NULL, which is probably better
than doing a repeat explicit check and early exit.
2024-05-09 00:55:56 -07:00
ManoloFLTK
324fcfcb62 macOS: Fix scaling subwindows - cont'd #927 2024-05-08 19:43:56 +02:00
ManoloFLTK
e609378264 Avoid possible dereferencing of null pointer (#971) 2024-05-08 13:52:32 +02:00
ManoloFLTK
d428a00443 Have menu items drawn with same colors in all platforms (#969)
Also, remove this text from the doc of Fl_Menu_::down_box()
    "If this is FL_NO_BOX then it acts like
    FL_THIN_UP_BOX and selection_color() acts like
    FL_WHITE, for back compatibility."
that was true only for the Windows platform and that required
selection_color to be replaced by white for menu items which is
not what FLTK 1.4 expects.

The new state of menu item drawings is as follows :
- all platforms draw menu items with the same symbolic colors
- selected items and menu titles are drawn with the selection color
as background color
- menu items are drawn by default with no box but can be given one
by Fl_Menu_::down_box(Fl_Boxtype)
- the text of selected items is drawn with the menu's color
unless fl_contrast() finds it does not make enough contrast with
the background (selection color) and substitutes it with a more
adapted color
- the Windows platform uses a visibly different hue for its default
selection color from what other platforms use
2024-05-08 13:26:13 +02:00
ManoloFLTK
ef313cf9fc Wayland documentation: beef up description of registry_handle_global() 2024-05-08 13:06:57 +02:00
Albrecht Schlosser
4d0963a7bf Improve arrow positions for 'oxy' scheme
- improve centering the different arrows
- fix one bug that prevented correct positioning
2024-05-07 20:05:27 +02:00
Albrecht Schlosser
60690dba51 Limit (sub)menu arrow size as discussed in fltk.general
... in thread: "FLTK 1.4 Menu Bar Style", started on May 6, 2024

This is about the little triangle (or similar) pointing right when
a submenu exists in a menu. The arrow form differs per scheme.
2024-05-07 20:05:27 +02:00
ManoloFLTK
7430ebff97 Extend some elements of the Wayland backend documentation file 2024-05-07 18:17:36 +02:00
ManoloFLTK
2af1da4ff4 Wayland: simpler implementation of "GTK Shell" protocol 2024-05-06 09:29:32 +02:00
Albrecht Schlosser
53543acb2e CMake: improve output of fl_debug_target()
Todo: check "*LOCATION" properties ...
2024-05-05 19:41:50 +02:00
Albrecht Schlosser
38e1d6b099 Fix Visual Studio compiler warnings, make output visible...
on Windows w/o a console device ("DOS"/Debug window) if OpenGL3 is
not available.
2024-05-05 19:33:28 +02:00
ManoloFLTK
dea8a93bc2 Wayland: use frame_cb before redrawing GL subwins - cont'd (#967) 2024-05-05 11:06:15 +02:00
ManoloFLTK
b726211b9b Wayland: use frame_cb before redrawing GL subwindows (#967) 2024-05-03 21:55:01 +02:00
ManoloFLTK
70b84b491b macOS + CMake: fix use of optional framework UniformTypeIdentifiers 2024-05-03 15:23:42 +02:00
ManoloFLTK
6238ede94d CMake: don't put freetype stuff in include directories for macOS
This removes these warnings for each source file compiled
  osxcross: warning: possibly dangerous include path specified: '-I /usr/include/freetype2'
  osxcross: info: you can silence this warning via 'OSXCROSS_NO_INCLUDE_PATH_WARNINGS=1' (env)
when cross-compiling from Linux to macOS.
2024-05-03 08:33:56 +02:00
Matthias Melcher
132e7d4e32 Fix MSVC warnings (#966) 2024-05-02 21:46:12 +02:00
ManoloFLTK
4a9205f282 Remove commit 4a31d49 that breaks X11 build 2024-05-02 19:54:58 +02:00
ManoloFLTK
4a31d4988b CMake: put freetype stuff in include directories for X11 only
This would create these warnings for each source file compiled
  osxcross: warning: possibly dangerous include path specified: '-I /usr/include/freetype2'
  osxcross: info: you can silence this warning via 'OSXCROSS_NO_INCLUDE_PATH_WARNINGS=1' (env)
when cross-compiling from Linux to macOS.
2024-05-02 19:43:54 +02:00
ManoloFLTK
24c1472c06 macOS + GL: remove compilation error with old SDK versions 2024-05-02 11:12:36 +02:00
Albrecht Schlosser
f194d8596f CMake/debug: add more properties to fl_debug_target()
This commit is only for CMake debugging.
2024-05-01 17:25:26 +02:00