Commit Graph

7153 Commits

Author SHA1 Message Date
ManoloFLTK
152cc52d89 Wayland: capture window titlebar as depth-4 image 2024-06-17 15:35:02 +02:00
ManoloFLTK
41ffc2c485 Fix "Under Ubuntu 22.04 any FLTK application appears in the Appmenu as 'FLTK'" 2024-06-16 23:22:58 +02:00
ManoloFLTK
377ff11ec9 Link frameworks used by recent macOS versions with -weak_framework
This allows FLTK apps to use the recent frameworks when they run on recent
macOS versions even if the minimum supported macOS version of these apps is more
ancient than the framework.
2024-06-16 19:48:55 +02:00
Matthias Melcher
d137ddfa7d Improve Fl::option documentation. 2024-06-15 15:16:42 +02:00
Albrecht Schlosser
3cc5c090f9 X11: update XDND protocol from version 4 to 5 (#988)
Some applications insist on sending XDND protocol version 5 and
rejected (ignored) FLTK as DND receiver because we allowed only
protocol version 4. Known apps: Google Chrome and Chromium.

This commit enables XDND protocol version 5 in FLTK programs as
DND receiver.
2024-06-15 12:11:41 +02:00
ManoloFLTK
7d98413d46 macOS 15.0 Sequoia: fix capture of window titlebars
The previous procedure using CGWindowListCreateImageFromArray()
is obsoleted in macOS 15.0 .
The new procedure requires an additional framework: ScreenCaptureKit;
FLTK uses it only for macOS ≥ 15.0
2024-06-14 11:55:53 +02:00
ManoloFLTK
7104746413 Fix crash in howto-drag-and-drop under macOS 2024-06-11 15:04:48 +02:00
ManoloFLTK
d7d1d0d6b2 Wayland: fix interactive moving and resizing of a subwindow - cont'd (#987) 2024-06-11 11:37:45 +02:00
ManoloFLTK
b17357339f Fix: Changing default color palette affects opengl child drawing on Wayland (#989) 2024-06-09 20:04:23 +02:00
ManoloFLTK
e5693efb75 Wayland: support DnD from X11-FLTK to Wayland-FLTK 2024-06-08 09:38:28 +02:00
ManoloFLTK
651d9f3e79 Wayland: add necessary calls to gtk_surface1_release() 2024-06-04 16:53:10 +02:00
ManoloFLTK
e2eeb36883 macOS: remove use of deprecated [NSBox setBorderType:] method 2024-06-03 17:36:08 +02:00
ManoloFLTK
6712130f22 Document how to control window location in screen under Wayland 2024-06-03 15:05:04 +02:00
ManoloFLTK
ce46b4b68b Wayland: fix interactive moving and resizing of a subwindow (#987) 2024-06-03 09:50:41 +02:00
ManoloFLTK
d792ed21f5 Fix Child Windows under Wayland are clipped on resizing … (#987) 2024-06-02 08:28:40 +02:00
ManoloFLTK
482da12f71 Fix: Zero-sized borderless window causes high cpu usage on windows (#985) 2024-06-01 16:48:27 +02:00
ManoloFLTK
5365aefc6e libdecor: update to upstream commit c2bd8ad6 (31-may-2024) 2024-06-01 10:12:50 +02:00
ManoloFLTK
70c6f2ce12 Fix: Wayland sends wrong events after an FL_DRAG of a top window - cont'd (#983) 2024-05-28 22:28:54 +02:00
ManoloFLTK
9c8977eff1 Fix: Wayland sends wrong events after an FL_DRAG of a top window (#983) 2024-05-28 15:33:33 +02:00
ManoloFLTK
f3f69b892d Remove useless Fl_Window_Driver accessors after new member Fl_Window::get_size_range() 2024-05-27 11:39:27 +02:00
Matthias Melcher
e325c2e4a0 Adding new call Fl_Window::get_size_range(), #981 2024-05-26 17:50:47 +02:00
Matthias Melcher
2bab8c94ff Revert InputChoice from fd791a0
A change to Fl_Input_Choice callbacks slipped into
fd791a068e.
This Commit removes that change. It may need to be
fixed and reapplied later in its own Commit.
2024-05-26 17:00:41 +02:00
ManoloFLTK
00dc35097b Control screen used by Fl_Menu_Bar::play_menu() - cont'd 2024-05-24 13:20:58 +02:00
ManoloFLTK
a09d43eb40 Fix: Fl_Browser unexpected display of empty lines ("@." vs "") (#979) 2024-05-24 10:03:37 +02:00
ManoloFLTK
0a6610c480 Control screen used by Fl_Menu_Bar::play_menu() 2024-05-23 16:38:51 +02:00
ManoloFLTK
8807efe939 More details about handling modal windows and various gnome versions 2024-05-21 09:23:24 +02:00
ManoloFLTK
c5d6382fb1 Wayland: don't call gtk_surface1_release() probably not useful
Also, add comment about when call to gtk_surface1_set_modal() is useful or useless but harmless.
2024-05-20 18:22:19 +02:00
Albrecht Schlosser
f903cf8026 Fix "Support building with unusual prefix" (STR 3434)
Add '$(LDFLAGS)' to build commands for libs, for details see STR 3434.
This applies to configure/make only, CMake builds are not affected.
2024-05-20 15:14:57 +02:00
ManoloFLTK
3d6bcda157 Wayland: accept diverse versions of the GTK Shell protocol 2024-05-19 17:34:39 +02:00
ManoloFLTK
642ec5b74b Slightly reorganize code of Fl_MacOS_Sys_Menu_Bar_Driver::play_menu() 2024-05-18 12:09:49 +02:00
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
79c3db48cf New member function Fl_Menu_Bar::play_menu(const char *title) 2024-05-14 17:46:25 +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
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
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
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
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
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
2af1da4ff4 Wayland: simpler implementation of "GTK Shell" protocol 2024-05-06 09:29:32 +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
24c1472c06 macOS + GL: remove compilation error with old SDK versions 2024-05-02 11:12:36 +02:00
Albrecht Schlosser
d22d4a526f Remove (comment out) debug statement (kdialog) 2024-04-30 18:02:53 +02:00
ManoloFLTK
a0d657b2e8 Fix preset_file() and directory() in native file chooser for kdialog 2024-04-30 16:14:29 +02:00
ManoloFLTK
9472ff546c Implement and document new class Fl_PDF_File_Surface 2024-04-30 10:22:47 +02:00
Albrecht Schlosser
b402b6a839 Fix potential NULL pointer dereference
... as reported in thread "Windows 11 crash (still investigating)"
of fltk.coredev, started on Apr 24, 2024.

This bug could only be triggered if a /subwindow/ wss hidden but was
not limited to Windows.
2024-04-29 16:32:13 +02:00
ManoloFLTK
e4b0668fad X11: simpler code to capture window decoration under xfce 2024-04-27 08:13:17 +02:00
Matthias Melcher
eeed395246 Fix repositioning subwindows.
The commit f288aea from Feb. 23rd introduced a
regression where children of subwindows were moved
inside the subwindow when only the subwindow itself
was supposed to move.
2024-04-26 20:19:08 +02:00
Matthias Melcher
1408a87425 Box type focus frame graphics fixes. 2024-04-26 18:17:04 +02:00
ManoloFLTK
02373a9dea X11: fix capture of window decoration under xfce 2024-04-26 16:53:08 +02:00
Matthias Melcher
e8fa492264 Fixes warning. 2024-04-26 12:46:29 +02:00
Matthias Melcher
281ec24c8f Box types can now defined and draw their own focus frame, STR 2145, #659 2024-04-26 12:42:11 +02:00
ManoloFLTK
c82fde7292 Wayland: slightly simpler code for IM support 2024-04-26 07:21:12 +02:00
ManoloFLTK
c0d2aa3f09 Fix problem in window titlebar capture under X11. 2024-04-25 15:12:34 +02:00
ManoloFLTK
6d21285e0f Fix error under KDE+Wayland where keystrokes tend to be repeated
see also: fltk-rs/fltk-rs#1539
2024-04-25 11:52:06 +02:00
ManoloFLTK
38c9ebc29d Substantial fix for "IME problem under wayland" in fltk-rs
see: fltk-rs/fltk-rs#1539
2024-04-25 08:49:08 +02:00
ManoloFLTK
00b603fa09 Very partial fix for "IME problem under wayland" in fltk-rs
see: https://github.com/fltk-rs/fltk-rs/issues/1539
2024-04-24 10:03:17 +02:00
Matthias Melcher
3f91c8b5ee macOS: Fix scaling subwindows #927
Converting Cocoa coordinates into FLTK coordinates
should be avoided as much as possible because the
conversion loses precision for scaling != 100%.
2024-04-23 19:25:31 +02:00
ManoloFLTK
5ec7176e81 Fix for Fl_Native_File_Chooser::filter_value() - cont'd (#899) 2024-04-22 18:35:59 +02:00
ManoloFLTK
abfc8ee52f Fix: Fl_Native_File_Chooser::filter_value() [Kdialog] always returns 0 (#899)
- remove build option FLTK_USE_KDIALOG replaced by an Fl::option() option
- new run-time option OPTION_FNFC_USES_KDIALOG
- make options OPTION_FNFC_USES_KDIALOG and OPTION_FNFC_USES_ZENITY
false by default
- add mention of new program fltk-options in the doc of Fl::option()
- change logic of choice of the native file chooser under X11/Wayland:
the zenity and kdialog choosers are opt-in; otherwise the GTK file chooser
is used, unless opted out with  OPTION_FNFC_USES_GTK
- document that zenity may be interesting for sandboxed apps
- document that both zenity and kdialog make member functions
Fl_Native_File_Chooser::filter_value() inoperable
2024-04-22 16:34:08 +02:00
ManoloFLTK
ee37965fad Fix: Wayland use of alpha in glClearColor/glClear (#957) 2024-04-22 14:27:42 +02:00
Albrecht Schlosser
e39c96f419 Fix build of test programs using shared FLTK libs 2024-04-21 19:12:59 +02:00
Albrecht Schlosser
89b957586e CMake: add target_include_directories() for optional libs (#954)
This ensures that header files for libraries found by `pkg-config`
(pkg_check_modules) in non-system directories will be found by the
compiler during the compilation of the FLTK library.

This issue has been reported in PR #954 related to builds with Conan
where some header files are not in system locations.
2024-04-21 18:53:22 +02:00
ManoloFLTK
7ec6f96d9c Add "fl_" prefix to libdecor symbols when using the built-in copy of libdecor
This allows client apps to use other versions of libdecor if they wish,
just like what FLTK already does with libpng and libjpeg.
2024-04-20 13:35:53 +02:00
Albrecht Schlosser
d2bd3c6240 CMake/MSVC: Fix shared library build, add to GitHub CI build
Fault was a simple typo or copy-paste error
2024-04-20 01:44:26 +02:00
Albrecht Schlosser
a9d3d3e3fb CMake: fix propagation of CMake targets to user projects (#954)
Unfortunately commit 5417ea5f1f broke
simple user projects by propagating unknown CMake target names to
linker requirements of user projects.

This commit tries to fix this w/o breaking the intentions of PR #954.
2024-04-19 20:45:32 +02:00
ManoloFLTK
15d9a350bf Restore IMPORTED_TARGET in pkg_check_modules command for libdecor 2024-04-18 20:51:10 +02:00
ManoloFLTK
e6957fc2f5 Allow libdecor package version ≥ 0.2.0 with FLTK_USE_SYSTEM_LIBDECOR 2024-04-18 19:32:47 +02:00
Albrecht Schlosser
8ca1e0ca03 Fix 'int Fl_Menu_::value()' if item is in a submenu (STR 3241)
More precise: ... if the last picked item is in a "detached submenu",
i.e. in one addressed by another menu item with the FL_SUBMENU_POINTER
flag set.

Also: document *why* this is the case, and what the result value is.
2024-04-17 19:14:59 +02:00
Matthias Melcher
fd791a068e
Separate FLUID user documentation, screen shot automation (#936)
* CMake integration, no autotiools
* alignment panel is now correctly renamed to setting panel
* source view is now correctly renamed to code view
* Merge FLTK FLUID docs into FLUID user manual.
* Add two simple entry tutorials
* Remove FLUID chapter form FLTK docs.
* GitHub action to generate HTML and PDF docs and
  make the available as artefacts
2024-04-17 17:51:32 +02:00
Albrecht Schlosser
b4cf1a9824 Fix and improve generation of fltk-config (#954 and more)
Parts of this commit fix the usage of CMake targets in the generation
process of fltk-config modified by PR #954.

The rest improves handling of variables used to generate fltk-config,
removes obsolete comments, documents variables like GLLIBS etc. which
had to be done anyway.
2024-04-14 19:15:08 +02:00
Jordan Williams
5417ea5f1f
CMake: Use imported targets for PkgConfig packages (#954)
This carries include directories and the required link flags.
Several libraries brought in through pkg_check_modules aren't linked correctly using the _LDFLAGS variables.
Instead, they link the libraries directly with `-l`.
This is problematic because it doesn't properly pull in the actual directory of the library being linked when it is not in a system library directory.
Likewise, the necessary include directories for several of these targets aren't properly set either.
Linking against the imported targets automatically pulls in the necessary include directories.
2024-04-14 19:07:15 +02:00
Albrecht Schlosser
e9e5f4bdb1 Remove "MS" from "MS Windows" in docs code, and comments
The system (platform) is called "Windows", "MS Windows" doesn't make
much sense. I removed "MS" for consistency.
2024-04-13 21:49:27 +02:00
Jordan Williams
a6651e10ff
CMake: Improve detection of the GLU library and GL/glu.h header file (#953)
* CMake: Improve detection of the GLU library and GL/glu.h header file

Locate the GLU library and header independent of the GL library and header locations.
Add the GLU header location to necessary target_include_directory calls.

* CMake: Locate and use the GL include directory

Find the GL include directory and use it in target_include_directories calls.
2024-04-12 15:58:57 +02:00
Albrecht Schlosser
5de880ae81 Fix "Support for NetBSD", part 4 (#944)
Add missing return statement to replacement function for trunc().

Closes #944
2024-04-12 13:28:33 +02:00
Albrecht Schlosser
05a95e146b Fix Fl_Terminal::handle_unknown_char() for plot_char() (#948)
- Add 'int Fl_Terminal::handle_unknown_char(int drow, int dcol)'
  to write the "unknown" character to the intended display position.

- Define Fl_Terminal::unknown_char as a static variable to avoid
  redundancy. In the future this might be overridden by users.
2024-04-09 12:53:12 +02:00
ManoloFLTK
ba7b2427b6 Make Fl_GTK_Printer_Driver recognize more paper sizes
also, make clear the B* paper size names are from JIS not ISO.
2024-04-08 17:24:38 +02:00
ManoloFLTK
2662cad50b Improve Fl_GTK_Printer_Driver::begin_job() 2024-04-08 16:29:25 +02:00
ManoloFLTK
5b802be52b Add Tabloid paper size to menu_print_page_size array 2024-04-08 11:19:14 +02:00
Greg Ercolano
31170c4731 Rename putchar() to plot_char() (#944)
Some old platforms (NetBSD, AIX) implement the common stdio "putchar()"
function as a global macro which poisons the global namespace, preventing
all C and C++ programs from using "putchar()" as a function or method.

There was a long thread about this in fltk.coredev during the period
Mar 25 2024 ~ Apr 4 2024, subject "RFC: Fl_Terminal::putchar() in public API"
as to why we have no choice but to not use putchar() as a method name.
2024-04-06 23:36:04 -07:00
ManoloFLTK
39c1386ba7 Improve use of fl_create_print_window() under Windows 2024-04-04 16:36:51 +02:00
ManoloFLTK
6763b357f4 Improve use of fl_create_print_window() under X11 2024-04-04 12:01:04 +02:00
Albrecht Schlosser
e5c4c1415b Add replacement for potentially missing trunc() (#944)
- add configure + CMake checks to define HAVE_TRUNC in config.h

- src/Fl_Timeout.cxx: add local replacement function
2024-04-02 16:03:29 +02:00
Albrecht Schlosser
7a879568b3 Improve support for NetBSD (#944)
- fix gcc version check for FL_DEPRECATED macro

- fix #include for select() on NetBSD < 3.0 (#944)

For more info please see GitHub Issue #944
2024-04-02 16:03:00 +02:00
Albrecht Schlosser
16cd29fd6d Remove dead code/comment: HP-UX 9.x not supported
README.Unix.txt documents that HP-UX 11.11 is required
2024-04-02 15:12:45 +02:00
ManoloFLTK
1bc5680472 Fix error in Fl_PostScript_File_Device::begin_page() under Pango
This fixes the bug reported in fltk.general "Fl_Printer bug?"
2024-03-30 17:21:11 +01:00