Commit Graph

6591 Commits

Author SHA1 Message Date
Albrecht Schlosser
8b1ec4c531 Fix Visual Studio (MSVC) compiler warnings 2023-03-09 17:47:51 +01:00
ManoloFLTK
2527632054 Fix gl_overlay under Wayland 2023-03-09 17:41:37 +01:00
Albrecht Schlosser
5175192755 CMake: build shared libs with OPTION_CAIROEXT (issue #250)
- remove separate libfltk_cairo to avoid cyclic dependencies, but
- keep a dummy libfltk_cairo in 1.4.0 for backwards compatibility
- move cairo/Fl_Cairo.cxx to src/Fl_Cairo.cxx
- add preliminary Cairo support for Visual Studio (MSVC)

Static linking is not affected by this change, but users building
with hand-made Makefiles will have to remove libfltk_cairo starting
with FLTK 1.4.0. The dummy library can be linked for backwards
compatibility but it will be removed later (in 1.4.x or 1.5.0).

The shared FLTK library libfltk.{so|dylib|dll|..} depends on libcairo
if and only if FLTK is built with one of the Cairo options. This has
always been the case for OPTION_CAIROEXT but is now also true if only
OPTION_CAIRO is selected, i.e. FLTK programs linked with a Cairo
enabled shared FLTK library will also be linked with libcairo. The same
is true for configure options --enable-cairo and --enable-cairoext,
respectively.

Preliminary Cairo support for MSVC now detects a Cairo installation
using the CMake variable FLTK_CAIRO_DIR which must be set by the user.
Note that this feature is temporary and may be changed in the future
for a better and more comfortable version.
2023-03-09 17:34:05 +01:00
ManoloFLTK
e32d4bcab9 Fix Fl_Wayland_Screen_Driver::x() and friends 2023-03-09 16:56:57 +01:00
ManoloFLTK
e409b01ba6 Remove useless repetition from array dead_keys[] 2023-03-08 12:19:09 +01:00
ManoloFLTK
b14172401d Fix: Shift-Tab not "reverse navigating" on some platforms (#696) 2023-03-08 09:04:55 +01:00
ManoloFLTK
f89a9f9efc DnD of filenames: make Wayland behave as Windows and macOS
and also add more detailed documentation of platform-specific behaviors.
2023-03-06 11:08:04 +01:00
ManoloFLTK
a52811567e Wayland: improve DnD of filenames to allow space-containing names 2023-03-05 11:54:55 +01:00
ManoloFLTK
5ae92f034a Simpler use of member variable wl_registry in class Fl_Wayland_Screen_Driver 2023-03-04 08:34:10 +01:00
ManoloFLTK
b438d448fb Remove unused variable declaration + fix in wayland.dox 2023-03-03 18:00:44 +01:00
ManoloFLTK
77c6877374 Reorder members of class Fl_Wayland_Screen_Driver 2023-03-03 16:47:49 +01:00
ManoloFLTK
37764fcd28 Improve Fl_Wayland_Window_Driver::wld_scale() 2023-03-03 09:28:12 +01:00
ManoloFLTK
8f24d7f295 Fix typos in Doxygen documentation 2023-03-02 12:15:14 +01:00
ManoloFLTK
86c238c000 Add Fl_Wayland_Window_Driver::wld_scale() member function 2023-03-02 11:36:26 +01:00
Matthias Melcher
04be85c636 Improved Fl_String capacity increments 2023-03-01 15:21:49 +01:00
Matthias Melcher
a3d89f7e28 Fix malloc/delete mismatch 2023-02-27 14:17:25 +01:00
Matthias Melcher
13cd927ab4
Add Fl_String to Fl_Preferences (#687) 2023-02-25 22:44:39 +01:00
Albrecht Schlosser
314ad2310e Derive internal Fl_Help_View buffer from Fl_String
Refactor the internal class HV_Edit_Buffer by deriving it from the
the recently extended Fl_String class.

The class HV_Edit_Buffer still needs some "special" methods but the
code could be simplified substantially.
2023-02-24 14:14:16 +01:00
Matthias Melcher
9f87af8ad9
Fl_String refactoring and extension (#683)
- add true unittest and Fl_String testing
- interface and printout are similar to gtest
  without requiring external linkage.
  just run `unittest --core`.
- new Fl_String API
- extended API to fl_input_str and fl_password_str
- co-authored-by: Albrecht Schlosser <albrechts.fltk@online.de>
2023-02-23 15:42:05 +01:00
Albrecht Schlosser
ce45bcae2f Silence false positive gcc warning (#682)
... and fix a typo.

This warning was reported for gcc 12.2 (MinGW-w64 / MSYS2) but may have
appeared in earlier gcc versions (gcc 9.4 is not affected).

It's very likely that this warning needs '-O2' or '-O3' to be issued.
2023-02-21 12:46:47 +01:00
Matthias Melcher
2971625418 Add GLUT_ELAPSED_TIME simulation 2023-02-20 13:40:27 +01:00
ManoloFLTK
6f4cf105b1 Remove 2 compilation warnings under Windows with mingw64
Compiling Fl_Native_File_Chooser_WIN32.cxx...
fl_dnd_win32.cxx:436:11: warning: private field 'm_EnumF' is not used [-Wunused-private-field]
  FLEnum *m_EnumF;
          ^
1 warning generated.

Fl_Native_File_Chooser_WIN32.cxx:378:19: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
  bool unixpath = IsUnixPath(_directory) | IsUnixPath(_preset_file);    // caller uses unix paths?
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                         ||
Fl_Native_File_Chooser_WIN32.cxx:378:19: note: cast one or both operands to int to silence this warning
1 warning generated.
2023-02-20 12:43:36 +01:00
ManoloFLTK
147bda5471 Rename fd_callback() to wayland_socket_callback() 2023-02-19 08:53:00 +01:00
ManoloFLTK
2af43ef4c8 Remove special FL_CURSOR_NONE implementation in Wayland 2023-02-17 16:24:41 +01:00
ManoloFLTK
e84a1730ad Wayland: improve and document support of FL_CURSOR_NONE 2023-02-17 09:52:34 +01:00
ManoloFLTK
f6b87790cc Wayland: new struct wl_cursor *custom_cursor member variable 2023-02-15 22:52:20 +01:00
Matthias Melcher
6fbfaba19d
Move class Fl_Shortcut_Button from FLUID to core (#677) (#680) 2023-02-15 15:24:25 +01:00
ManoloFLTK
a4d0f7d269 Wayland: allow Fl_Window::cursor(Fl_Cursor) for whole window 2023-02-15 12:20:26 +01:00
ManoloFLTK
9ff67f013e Wayland: add support of Fl_Window::default_cursor(Fl_Cursor) 2023-02-15 06:43:39 +01:00
ManoloFLTK
868ab9696f Rename class Fl_Display_Cairo_Graphics_Driver to Fl_X11_Cairo_Graphics_Driver 2023-02-14 11:52:21 +01:00
ManoloFLTK
b055b82eb2 Use libdecor/src/os-compatibility.h to declare os_create_anonymous_file() 2023-02-14 10:44:15 +01:00
ManoloFLTK
8038b1f1ad Update doc of Fl_Image::copy() after new Fl_Anim_GIF_Image class 2023-02-14 08:51:42 +01:00
ManoloFLTK
3d0b96b095 Remove unneeded list of wayland seats 2023-02-13 16:54:16 +01:00
ManoloFLTK
9958016a47 Windows: minor change to support build with mingw64 4.9
This old compiler is available as a cross compiler from macOS to 64-bit Windows.
2023-02-13 12:24:27 +01:00
ManoloFLTK
f459fdb637 Allow scaled image in Fl_Window::cursor(const Fl_RGB_Image *, int, int) 2023-02-13 12:11:04 +01:00
ManoloFLTK
bb74d263e2 Wayland: add necessary check to support OWL 2023-02-12 08:52:09 +01:00
Matthias Melcher
5a25641317
Very controlled GDIplus startup and shutdown #635 (#679)
Fall back to GDI if GDIplus is not available
2023-02-11 19:14:23 +01:00
ManoloFLTK
740c56ce15 Wayland: improve support for FL_CURSOR_{NONE, HELP} 2023-02-11 14:36:58 +01:00
Matthias Melcher
d9b519f969 Infinite undo: fix compiler warning 2023-02-10 17:21:47 +01:00
Matthias Melcher
7f87c847ba
Unlimited undo/redo for Fl_Input_ and Fl_Text_Buffer (#558) (#676) 2023-02-10 17:13:20 +01:00
Matthias Melcher
72f8604381 Don't for a box type for pulldowns (#675) 2023-02-10 16:58:33 +01:00
Albrecht Schlosser
d7f21d9568 Remove dead code and comments (Windows only)
Most of the old code was a leftover of STR 3454 (which fixed winsock
issues).

Also removed an old comment about usage of Windows WSAAsyncSelect()
and why it had been removed (related to Windows socket functions).
2023-02-10 13:31:07 +01:00
Albrecht Schlosser
2239ecc4a1 Fix typos in documentation and comments
(no code changes)
2023-02-10 13:13:36 +01:00
Matthias Melcher
ffadc23cab
Expose elapsed time API (#670) 2023-02-09 14:48:39 +01:00
ManoloFLTK
3cbbe7be2c Remove XOR-based code that was unused and incomplete (#673) 2023-02-07 15:26:46 +01:00
ManoloFLTK
a496be9178 Fix "\todo TextDPosToLineAndCol does not exist" 2023-02-07 15:00:03 +01:00
ManoloFLTK
afb44149d9 Fix "\todo TextDEndOfLine and BufEndOfLine functions don't exist" 2023-02-07 14:32:26 +01:00
ManoloFLTK
7a8771d3c4 macOS+XQuartz: support new homebrew name for GTK2 shared lib 2023-02-07 12:47:42 +01:00
ManoloFLTK
160eb2926d Remove usage of __APPLE_QUARTZ__ (#673) 2023-02-06 21:42:40 +01:00
ManoloFLTK
f1b2e92f07 Use fl_utf_strcasecmp() for Unicode-aware case-insensitive comparisons 2023-02-06 18:48:43 +01:00
ManoloFLTK
18c363a0d9 Use fl_tolower() for case-insensitive Unicode-aware comparisons 2023-02-06 18:48:43 +01:00
ManoloFLTK
55cb8081c7 Don't assume strcasecmp() is a function because of Visual studio C 2023-02-06 16:30:56 +01:00
ManoloFLTK
e0b45688a7 Add necessary #include "flstring.h" 2023-02-06 16:15:22 +01:00
ManoloFLTK
dc51880e28 Fix "\todo Add a flag to ignore case" from Fl_Browser_.cxx 2023-02-06 15:26:53 +01:00
ManoloFLTK
587687629e Fix "\todo Make comparison UTF-8 aware" in numericsort.c 2023-02-06 13:17:24 +01:00
ManoloFLTK
57a87f7053 Fix "\todo provide user documentation for fl_set_status function" 2023-02-06 11:17:31 +01:00
ManoloFLTK
a56c48079e Fix "\todo Complete documentation of class Fl_String"
Also
- fix "\todo Unicode?" in Fl_Text_Display::display_insert() after verification
- fix "\todo [Internal] The user_data value must be implemented using \p fl_intptr_t"
because that's now in place.
2023-02-06 10:34:47 +01:00
ManoloFLTK
589c1f31c3 Improve doc of Fl_Widget::test_shortcut() methods
This removes a \todo item.
2023-02-05 11:45:23 +01:00
Matthias Melcher
1aa6c4fed8
Fix position() methods that shadow Fl_Widget::position()
* `FL_DEPRECATED` macro to mark `position()` method that shadow `Fl_Widget::position()` #69 (#666)
2023-02-02 20:54:19 +01:00
ManoloFLTK
6276822e9e Allow cmake -DOPTION_APPLE_X11=On without -U__APPLE__ 2023-02-02 18:48:24 +01:00
Albrecht Schlosser
4e75549e7b Update dependencies and fix whitespace errors
- replace tabs with spaces
- remove trailing whitespace
2023-02-02 17:09:14 +01:00
Albrecht Schlosser
fb00fb3d66 Minimize and fix include statements of Fl_Int_Vector
- replace <FL/Fl.H> with <FL/Fl_Export.H> in public header
- add missing <string.h> in implementation
2023-02-02 17:00:28 +01:00
ManoloFLTK
16dff07994 Fix "Native file chooser on Linux fails with BROWSE_MULTI_FILE" (#669) 2023-02-02 15:20:55 +01:00
ManoloFLTK
ddc213d91c Add preliminary support of Wayland under macOS
Wayland under macOS is WIP at
  https://github.com/owl-compositor/owl
2023-02-02 14:39:11 +01:00
ManoloFLTK
96fd8a5f7a Wayland: use fl_wl_find() instead of fl_find() 2023-02-01 09:30:09 +01:00
ManoloFLTK
94c918a1ae Fix miscellaneous #include directives 2023-01-31 18:22:04 +01:00
ManoloFLTK
eaaf5ba90c Fix crash in Zenity filechooser with badly formed filter (#665) 2023-01-31 17:37:20 +01:00
ManoloFLTK
8ef592db1e Fix crash in Zenity filechooser with badly formed filter (#665) 2023-01-31 17:01:30 +01:00
ManoloFLTK
f75f05e7b7 Fix crash in Zenity filechooser with badly formed filter (#665) 2023-01-31 15:37:33 +01:00
ManoloFLTK
9bf2726bce Fix "Native Filechooser (Zenity) crashes on second invocation" (#665) 2023-01-31 13:13:48 +01:00
ManoloFLTK
1045538ed0 Fix launching of unbundled app from /tmp 2023-01-30 20:08:18 +01:00
ManoloFLTK
95f926fd01 Document that Fl::add_fd() opens display under macOS 2023-01-30 07:39:20 +01:00
Albrecht Schlosser
86a0a28815 Fix comments and remove a 'todo' item from docs
Comments and docs only, no code changes.
2023-01-28 16:09:54 +01:00
ManoloFLTK
d604c37c90 Fix for [fltk.coredev] native file chooser crash 2023-01-27 08:35:38 +01:00
Matthias Melcher
e2028c66fe STR 2936: FLUID: option to ignore syntax check in DeclBlock 2023-01-26 16:32:17 +01:00
ManoloFLTK
1581662d00 Simpler Fl_Wayland_Gl_Window_Driver::resize() is enough 2023-01-26 16:04:06 +01:00
Matthias Melcher
179771acd2
Fixing FLUID file corruption from issue #653 (#662)
Removing all globals in file writer (#653 )
Fix some static analyser complaints
Valgrind: handle width==0 in GfxDrivers on Wayland and X11
Don't use `Fl_Input_::static_value`, it accesses previous
buffer that may be deleted
Project file write encapsulated, removing globals
Encapsulating project file reader, removing states in glbals
Project i/o increased source code readability
2023-01-26 15:23:43 +01:00
Matthias Melcher
3a7c9fe978 STR 2639 Fixes Fl_Pack resize behaviour
FLUID cleanups
FLUID Fl_Pack support improvement
FLUID fix error in handling live mode resizables
2023-01-23 16:08:59 +01:00
ManoloFLTK
17467b48bd Wayland: remove useless member variables of struct output 2023-01-23 08:11:10 +01:00
wcout
2ddfd9d949
Animated GIF support (Fl_Anim_GIF_Image class) (#375) 2023-01-21 17:27:58 +01:00
Matthias Melcher
2c595e8dde STR 2822: function to count bytes in a UTF-8 string 2023-01-20 16:13:00 +01:00
Matthias Melcher
b19c0e4f63 STR 2894: pressed_menubutton_ now protected in Fl_Menu_Button 2023-01-20 15:22:21 +01:00
Matthias Melcher
4f3f2bb30b STR 2909: Fl_Tile now forwards FL_RELEASE event to children 2023-01-20 14:04:22 +01:00
Matthias Melcher
ab5cc5866d STR 3408: Fl_Scroll draws background inactive if needed 2023-01-20 13:51:17 +01:00
Matthias Melcher
f4620329f1 STR 3461: fix menu linespacing 2023-01-20 13:44:13 +01:00
ManoloFLTK
35b7473e70 Wayland menus: support tall popup menu + Sway support 2023-01-16 17:07:22 +01:00
ManoloFLTK
ff3906bec0 Wayland menus: support tall popup menu 2023-01-16 16:00:54 +01:00
Albrecht Schlosser
f44bdfb7cf Fl_Chart: minor update and additional documentation
Add forgotten parameter docs and some minor code fixes.
2023-01-16 00:08:47 +01:00
Albrecht Schlosser
dde2d21b5d Improve deriving from Fl_Chart (STR 2022)
This commit makes the local, static drawing functions in the source
file available for subclasses by converting them to static protected
methods as requested by STR 2022.

The source and header files have been reformatted according to the
CMP, documentation for the new protected methods was added.

Source code *functionality* has not been changed.

This resolves and closes STR 2022.

Todo:
 - investigate whether these drawing methods wouldn't better be
   member functions and "convert" them if applicable
 - investigate whether the internal struct FL_CHART_ENTRY could become
   a local part of the Fl_Chart class, maybe Fl_Chart::Entry.
 - rename private member variables with trailing underscore (see CMP)
2023-01-15 23:48:00 +01:00
ManoloFLTK
761aa5e485 Rename static member Fl_Wayland_Window_Driver::tall_popup to new_popup
The new name reflects better the role of this bool member variable.
Also, add explanatory comments about the use of this variable.
2023-01-15 10:18:50 +01:00
ManoloFLTK
37775538c4 Extend commit a4b33f8 to other uses of function convert_crlf()
Helper function convert_crlf() from file fl_wayland_clipboard_dnd.cxx has been
repaired by commit a4b33f8 (13 jan 2023). But the same function was also in
file Fl_cocoa.mm. This commit moves the repaired code to class Fl_Screen_Driver
and has both fl_wayland_clipboard_dnd.cxx and Fl_cocoa.mm use it.
2023-01-14 09:56:09 +01:00
ManoloFLTK
c8b4a56735 Add missing initialisation after dynamic memory allocation 2023-01-14 08:16:23 +01:00
Albrecht Schlosser
a4fdf92d06 Fix set_fonts() in Xlib/xft and Cairo Graphics_Driver
src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx:
 - fix font_name_process() out of bounds memory access
 - unify/align font_name_process() code (see also Xlib/xft)
 - fix font name string allocation

src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
 - unify/align font_name_process() code (see also Cairo_Graphics)
 - fix font name string allocation

Todo: move common code to Fl_Graphics_Driver or another common file.
2023-01-13 22:39:23 +01:00
ManoloFLTK
f3e21ddad2 Fix for "Rename Fl_X* Fl_Window::i private class member" (#223) 2023-01-13 21:16:17 +01:00
ManoloFLTK
dd6b9b90ee Wayland menus: add missing use of scaling factor 2023-01-13 19:37:06 +01:00
Albrecht Schlosser
59bf6dc059 Fix "alloc-dealloc-mismatch" in Fl_Native_File_Chooser_Kdialog
Error was reported by Address Sanitizer (ASAN) when picking a file.
Platform: Unix/Linux.

==1734703==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) on 0x607000108420
    #0 0x7f3357d846ef in operator delete[](void*) ../../../../src/libsanitizer/asan/asan_new_delete.cc:168
    #1 0x4e195f in Fl_Native_File_Chooser_Driver::strfree(char*) ../../src/Fl_Native_File_Chooser.cxx:262
...
0x607000108420 is located 0 bytes inside of 66-byte region [0x607000108420,0x607000108462)
allocated by thread T0 here:
    #0 0x7f3357d0a3ed in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cc:445
    #1 0x57951a in Fl_Kdialog_Native_File_Chooser_Driver::filter(char const*) ../../src/Fl_Native_File_Chooser_Kdialog.cxx:245
    #2 0x4e14a0 in Fl_Native_File_Chooser::filter(char const*) ../../src/Fl_Native_File_Chooser.cxx:176
2023-01-13 18:15:51 +01:00
Albrecht Schlosser
a4b33f8e76 Wayland: Fix "heap-buffer-overflow" error
- replace strchr() with memchr() because buffer is not nul-terminated
- fix '*(p+1)' potentially accessing memory out of bounds

This fix also prevents
- multiple memmove() calls
- multiple searches from the beginning of the string
2023-01-13 16:44:06 +01:00
Albrecht Schlosser
54e75dc902 Improve debug output of Fl_String
- add newline (\n) before string output
- remove quotes (')
2023-01-13 16:41:40 +01:00
ManoloFLTK
6a5c326c39 Fix for "Screen resolution change (win32)" (#651) 2023-01-13 15:15:02 +01:00
ManoloFLTK
7dd7cfcf95 Wayland Fix "Error "heap-use-after-free" when scaling twice" (#650) 2023-01-12 21:28:03 +01:00
ManoloFLTK
66860c2e83 Improve "Implementation note about menu windows under Wayland" 2023-01-12 21:27:17 +01:00
Albrecht Schlosser
bafd3fd3d7 Add Fl_Scheme_Choice widget and use it in test programs
This widget offers the selection of all known FLTK schemes as a simple
widget based on Fl_Choice.

Some test and demo programs use Fl_Scheme_Choice to enable the developer
or user to switch schemes quickly for comparison.

Todo:
 - add features to add new schemes during runtime (partially done)
 - update status when the scheme is changed by Fl::scheme("...")
2023-01-12 19:21:09 +01:00
Albrecht Schlosser
79832b679f Add the initial version of class Fl_Scheme
This basic version of class Fl_Scheme contains only static methods that
are needed for Fl_Scheme_Choice and further extensions.
2023-01-12 19:21:09 +01:00
ManoloFLTK
b375d07d32 New static member Fl_Window *Fl_Wayland_Window_Driver::previous_floatingtitle 2023-01-12 11:58:53 +01:00
ManoloFLTK
62e33973a1 New static member bool Fl_Wayland_Window_Driver::tall_popup 2023-01-12 11:36:20 +01:00
ManoloFLTK
32b966ef8f Remove repeated code in classes menuwindow and menutitle 2023-01-12 10:33:41 +01:00
ManoloFLTK
b8d9f2282f Remove useless #include directives 2023-01-12 10:33:41 +01:00
ManoloFLTK
8a8a4c793e Simpler implementation of Fl_Window_Driver::scroll_to_selected_item() 2023-01-12 09:03:53 +01:00
ManoloFLTK
86a6d4e3d3 Wayland menus: remove useless Fl_Window_Driver::extra_menutitle() 2023-01-12 08:28:06 +01:00
Albrecht Schlosser
0bd156e219 Fix buffer overflow in Fl_Tree_Item::show_self() 2023-01-12 00:06:05 +01:00
ManoloFLTK
ccfc479e43 Fix "Wayland: compilation warnings" (#649) 2023-01-11 23:53:34 +01:00
ManoloFLTK
bd1e759771 Fix "Long line crashes Fl_Hold_Browser" (#645)
This is in fact a regression introduced at commit be0f06e.
2023-01-11 18:18:22 +01:00
ManoloFLTK
9210e3efbf Wayland: Further improved implementation of menu windows
Tall menus now work also as single popup window and show the correct selected item.

Groups of popups with a menutitle, an associated menuwindow, and possibly submenus
are constructed around the menuwindow, the menutitle being a child popup of the
menuwindow. This positions these popup groups better than before.
2023-01-11 17:40:38 +01:00
ManoloFLTK
dc4c443bfc Fix ";" inadvertently written "," 2023-01-11 09:36:54 +01:00
ManoloFLTK
9bdaf5a84d Virtual member Fl_Window_Driver::makeWindow() now returns void 2023-01-09 17:35:38 +01:00
ManoloFLTK
a5b431e35e Wayland: Possibly better way to complete popup construction 2023-01-09 17:11:21 +01:00
ManoloFLTK
a6dd0adac7 Doc only: fix for "Fl::awake() and Fl::add_timeout()" (#524) 2023-01-09 15:07:59 +01:00
ManoloFLTK
13ce93330a Wayland: fix Fl::event_key(int) 2023-01-09 10:06:29 +01:00
Matthias Melcher
7d167b3cf1
FLUID: add drag'n'drop for images (#642)
FLUID dnd for desktop images into the design
Documentation for fl_access
2023-01-08 19:43:31 +01:00
ManoloFLTK
09db3a6dea Fix "Xrender blurs adjacent images with bilinear scaling" (#633)
Many thanks to @wcout for providing this fix.

Xrender now draws images in the same way when tiling images
or not when FL_RGB_SCALING_BILINEAR is on.
This allows to remove static bool Fl_Tiled_Image::drawing_tiled_image()
which becomes unused.
2023-01-08 11:17:03 +01:00
ManoloFLTK
222b2ea2e8 Wayland: Improved implementation of menu windows 2023-01-08 09:30:51 +01:00
Matthias Melcher
6ada45f1f2 Fix missing parameter documentation 2023-01-08 01:07:04 +01:00
Greg Ercolano
8e16286ebb Fix Fl_Spinner draw problem - closes #638 2023-01-07 09:35:53 -08:00
ManoloFLTK
18f2854656 Fix for "Shift-Ctrl-C shortcut in fluid not working on newer linux OS's" (#637) 2023-01-07 15:36:02 +01:00
Albrecht Schlosser
8dd3ff8e12 X11: Optionally copy selection buffer to clipboard (STR 3229)
The new method Fl::selection_to_clipboard(int) enables copying
selection data to the clipboard on X11 if it is set to 1.

This feature was requested by STR 3229 and the implementation was
inspired by an `xterm` feature named "Select to Clipboard" which can
be enabled by 'ctrl + middle mouse button + "Select to Clipboard"'
in an xterm window.
2023-01-06 16:45:22 +01:00
Matthias Melcher
e0830305a2 Add Fl_Tabs dragging in pulldown mode 2023-01-05 23:17:02 +01:00
Matthias Melcher
4bff15278e Adding Fl::hide_all_windows() 2023-01-05 15:20:13 +01:00
Matthias Melcher
8826dca106
Add close buttons for individual tabs in Fl_Tabs (#628)
Add close buttons for Fl_Tabs
Introducing callback reasons
FLUID shows all FL_WHEN_... options
Adding Fl_Tabs overflow types
Improved test/tabs to show new features
2023-01-05 13:51:30 +01:00
Albrecht Schlosser
4d1a508c7e Refactor drawing small circles: add fl_draw_circle()
This method can be used to draw small circles as part of the GUI.
It is independent of the current scheme.

Very small circles are approximated by drawing several rectangles.
2023-01-05 01:06:25 +01:00
ManoloFLTK
ae240340ab Fix for "Fl_Native_File_Chooser_MAC.mm compilation warning" (#627) 2023-01-04 18:02:29 +01:00
ManoloFLTK
13f2ea664a Cairo/Pango: compute character widths fast and string widths accurately
This commit has Fl_Cairo_Graphics_Driver compute string widths in 2 ways:
1) when the string contains several unicode characters, the width of the
whole string is computed, accounting for kerning when it occurs;
2) when the string contains a single unicode character, its width is
computed, memorised, and re-used next time it's necessary.

The effect of this approach is
- Fl_Text_Display is fast because it uses memorised single character widths repeatedly
- Fl_Input is drawn accurately because the cursor position is determined
by string widths, not by sums of character widths.
2023-01-04 17:23:13 +01:00
Albrecht Schlosser
9aa7cab532 Clarify and improve Fl::scheme() related documentation 2023-01-03 17:11:00 +01:00
Albrecht Schlosser
22a830c496 Fix missing include file for Visual Studio
... if GDIPLUS is disabled.

Thanks to Winfried Szukalski for reporting this.
2023-01-02 21:21:04 +01:00
Albrecht Schlosser
99a1daf1a9 Modify 'oxy' scheme's "choice arrow" for consistency
The "choice arrow" used two "down-arrows" which was different than
all the other schemes. Changed to up-arrow and down-arrow to make
this more consistent.

The exception is the default scheme (none or base) which uses only
one down-arrow.
2023-01-02 18:15:00 +01:00
Albrecht Schlosser
e8f2602032 Fix box frame sizes of "round" boxes in scheme 'oxy' 2023-01-02 18:00:47 +01:00
Albrecht Schlosser
a1ebe027be Fix a doxygen warning and improve "file list" contents
FL/Fl_Group.H: add `\brief` keyword
src/Fl_Group.cxx: fix warning: the '#' in '#include' must be escaped
2023-01-02 15:56:56 +01:00
Matthias Melcher
a63ad76603
FLUID refactor and macOS warnings removed (#623)
P renamed to g_project
class Project renamed to class Fluid_Project
fixes macOS type cast warnings
2023-01-01 20:05:42 +01:00
Albrecht Schlosser
23e8d831a8 Add a missing FL_OVERRIDE flag 2023-01-01 18:02:46 +01:00
Adam Chyła
bfe730ecbf
Remove commented fl_beep calls (#620) 2022-12-30 23:15:53 +01:00
Matthias Melcher
473b5d8b5b Fixing false FL_OVERRIDE 2022-12-30 20:54:03 +01:00
Matthias Melcher
96f080a212 Fix uninitialised struct in SVG reader 2022-12-30 20:49:48 +01:00
Matthias Melcher
44c874b731
Use FL_OVERRIDE for all overridden virtual methods (#611)
FL_OVERRIDE is defined as `override` for C++11 and higher
FL_OVERRIDE is defined as `override` for VisualC 2015 and newer
Don't interfere with Fl_Widget::override()
2022-12-30 19:14:36 +01:00
Albrecht Schlosser
f58a93a159 Fix misleading indentation (warning: [-Wmisleading-indentation]) 2022-12-30 17:32:01 +01:00
ManoloFLTK
b2a38f793f Wayland+FreeBSD: fix "test/mandelbrot crashes on rightclick" (#618) 2022-12-30 09:40:58 +01:00
ManoloFLTK
7e4306af6b Fix "Focus is lost leaving full screen on macOS 13" (#608) 2022-12-29 15:54:32 +01:00
Albrecht Schlosser
78cf29ba29 Improve and extend fl_contrast() (#370)
- Add internal fl_contrast_cielab() as the new default.
- Keep old function as internal fl_contrast_legacy().
- Add fl_contrast_mode() to switch between fl_contrast() functions.
- Add fl_contrast_level() to fine tune fl_contrast() per mode.
- Add option to register and use a custom contrast function.
- Add test/contrast.cxx test program.
- Move all fl_contrast() related code to a new file src/fl_contrast.cxx.
- Add fl_lightness() convenience function for perceived lightness.
- Add fl_luminance() convenience function for physical luminance.
2022-12-28 18:16:23 +01:00
ManoloFLTK
31327cd649 Fix for Two compiler warnings (#615) - cont'd
The Page_Format and Page_Layout  enums have been conceived for them to be combinable
into a single int value.
2022-12-28 16:58:52 +01:00
ManoloFLTK
72b8054ecc Fix compiler warnings on Windows with mingw-w64 CMAKE_CXX_STANDARD=20 (#615) 2022-12-28 09:32:01 +01:00
ManoloFLTK
7601bd832c Wayland: remove un-needed #include directives 2022-12-28 09:08:52 +01:00
ManoloFLTK
bb96cfac44 Wayland: remove un-necessary Fl_Wayland_Gl_Window_Driver::gl_event_queue 2022-12-28 08:55:02 +01:00
ManoloFLTK
86adfe0dbe Wayland: simplify function struct wl_display *fl_wl_display() 2022-12-28 08:43:22 +01:00
Albrecht Schlosser
b6cdb8ef25 Fix doxygen warnings (typos in argument names) 2022-12-27 19:26:34 +01:00
ManoloFLTK
e73b2da5e4 Wayland: Dropdown menu moves when navigated (#613) - cont'd
Menu windows containing sub-menus are now processed differently.
2022-12-27 13:15:31 +01:00
ManoloFLTK
694df9d7e6 Wayland: Fix for "Dropdown menu moves when navigated" (#613)
This commit uses Wayland popup positionning methods to handle common
menu windows and prevents them from expanding below display bottom or above top.
The previous algorithm remains in place for menu windows higher than
the display height. Further changes for these big menus may come later.
2022-12-26 08:13:27 +01:00
ManoloFLTK
b26db74dd0 Fix for "Fatal error while communicating with the Wayland server" (#610)
This commit should fix: once the mouse leaves the app window area and returns back to it
(app loses focus and gets it again) the crash happens.
2022-12-24 11:13:02 +01:00
Matthias Melcher
6ea1f73d93 Missing parentheses 2022-12-22 00:33:08 +01:00
Matthias Melcher
d98c663893
Fix compilation on old gcc (#606)
* Fixing char* use in FLUID
* Fixing const cast
2022-12-22 00:18:01 +01:00
Albrecht Schlosser
1d212b7a03 Clean up class Fl_String (part of issue #601)
- remove static variable 'string_count'
- improve and document methods debug() and hexdump()

This commit does not resolve issue 601 but removes some development
leftovers.

Methods debug() and hexdump() left for debugging as requested.
2022-12-20 20:05:15 +01:00
Albrecht Schlosser
004ea67203 Update dependencies, remove trailing whitespace 2022-12-19 15:23:20 +01:00
Albrecht Schlosser
62f68128bf Fix compiler warning (unused variable) 2022-12-19 15:21:38 +01:00
ManoloFLTK
84c5992d9f Complete Fl_Cairo_Graphics_Driver::restore_clip()
The driver's clip_ member was not updated to the new Cairo clip state
which rendered function Fl_Cairo_Graphics_Driver::clip_box() inaccurate.
2022-12-19 10:22:22 +01:00
Greg Ercolano
e7630e045a Added ansi_show_unknown(bool) (default off)
It may be useful to some to have the terminal emit an error character
to show unknown escape sequences. Off by default, unknown escape sequences
are silently ignored. If enabled, '¿' is inserted instead.
2022-12-18 13:21:22 -08:00
ManoloFLTK
b246b6650a Fix "link errors connected with recent Zenity dialog feature" (#602) 2022-12-18 09:29:37 +01:00
Greg Ercolano
993b7da3b5 ESC sequences can traverse append(), unicode support for backspace
This is basically a rewrite of the ESC handler, keeping state
in the class, so ESC sequences can continued between called
to append() (such as when reading data from a pipe in blocks).

New private class 'Fl_Escape_Seq' handles parsing and state info.
It also has careful bounds checking during parsing.

Backspace supports Unicode, and the unicode chars can straddle
across append() operations as well.

Private variables in Fl_Simple_Terminal renamed _xxx to xxx_
to improve CMP compliance.
2022-12-17 20:53:54 -08:00
Matthias Melcher
8586c257ab Update SVG binary constructor documentation 2022-12-17 23:44:42 +01:00
ManoloFLTK
b9852ff58f Add cross-platform fl_close_fd(int fd) to close a file descriptor 2022-12-17 19:13:30 +01:00
ManoloFLTK
5b6d5f9279 Remove further unused code after 12da87b 2022-12-17 19:12:53 +01:00
ManoloFLTK
2c1bb09578 Remove useless Fl_System_Driver members after 12da87b 2022-12-17 18:20:53 +01:00
Matthias Melcher
12da87ba0c
Adding length checks for in-memory image data (see #542) (#592)
SVG is now decompressed in memory
Bitmap invalid array length handling to return an error
RGB Image data reader to return error if image data is too short
FLUID: Add size argument to bitmap and JPEG data
2022-12-17 16:01:35 +01:00
Greg Ercolano
118bf55c38 Added backspace handling to simple terminal ansi() mode
This addresses a comment from MoAlyousef in issue #577
	on 12/15/2022 requesting backspace processing.
2022-12-16 10:48:32 -08:00
ManoloFLTK
41f37613ec Derive Fl_Zenity_Native_File_Chooser_Driver from Fl_Kdialog_Native_…
Also add Fl::option(OPTION_FNFC_USES_ZENITY)
2022-12-16 16:21:23 +01:00
Trent McPheron
576271fb04 Add Zenity-based file chooser based on the KDialog one (HugLifeTiZ)
If available, it is used on Linux regardless of the current desktop because
it offers free XDG portal integration, which means it picks the correct file
chooser on all desktops, and allows for meaningful file selection in sandbox
environments like Flatpak.
2022-12-16 16:21:23 +01:00
ManoloFLTK
2ddb27f0f2 Fix for "Recent macos build issues" (#598) 2022-12-16 08:06:41 +01:00
Albrecht Schlosser
44a2547394
Rename some Fl_Flex methods for FLTK compliance (#594)
Change some method names to comply with FLTK style as discussed
in fltk.coredev, thread "Fl_Flex method name question".

* Rename Fl_Flex::margins(...) to Fl_Flex::margin(...)
  (use singular form for all margin related methods)

* Remove Fl_Flex::setSize() and isSetSize() "backwards compatibility" methods

* Rename Fl_Flex::set_size(...) to fixed(...)

Note: the latter affects existing (pre-release) fluid (.fl) files: you may
  want to edit and replace "set_size_tuples" with "fixed_size_tuples"
2022-12-15 16:46:40 +01:00
ManoloFLTK
2fd1866f49 macOS: Add "Show hidden files" button to native file chooser 2022-12-15 12:10:41 +01:00
Albrecht Schlosser
64d8c913be Fix trailing whitespace and dependencies 2022-12-13 15:58:56 +01:00
Albrecht Schlosser
b82ea16d69 Fix compiler warning [-Wmaybe-uninitialized]
Fl_BMP_Image.cxx:228:30: warning: ‘width’ may be used uninitialized in this function
  228 |       int maskSize = (((width*Bpp+3)&~3)*height) + ...
      |                         ~~~~~^~~~
2022-12-13 15:51:54 +01:00
Matthias Melcher
a5adbd99ca
Add option to bind images to a widget (#589)
Adding image binding to FLUID as well
2022-12-10 23:22:24 +01:00
ManoloFLTK
8dcd121d44 Text positioning different in 1.4.x vs 1.3.x (#568) - cont'd
@wcout reports that we get better results if function pango_font_metrics_get_height()
is not used until version 1.50.6 and above of libpango. The difference is specially visible
with underscore characters in unscaled, standard DPI displays. This commit does that.
2022-12-10 19:00:09 +01:00
Matthias Melcher
a23c77c5a1
Defer opening the display as much as possible (#586) 2022-12-10 16:21:07 +01:00
Matthias Melcher
60d6e9be14 Fixes some VC compiler warnings 2022-12-10 16:03:29 +01:00
Albrecht Schlosser
8dea6505e9 Windows: fix memory leak caused by RegisterDragDrop (#569)
- call RevokeDragDrop() when the window is hidden
- do not delete the *static* FLDropTarget object
2022-12-10 15:03:30 +01:00
Matthias Melcher
5673072271
Fixes OpenGL complex polygons when scaling (#576)
Also fixes gap()
2022-12-10 13:10:36 +01:00
ManoloFLTK
df059de37e "Public members Fl::awake_ring_*_ should be private" (#559) - cont'd 2022-12-10 10:19:54 +01:00
Albrecht Schlosser
ceb268fd34 Suppress (GitHub CI/wayland) compiler warning
[ 15%] Building CXX object src/CMakeFiles/fltk.dir/Fl_Text_Display.cxx.o
.../fltk/src/Fl_Text_Display.cxx: In constructor ‘Fl_Text_Display::Fl_Text_Display(int, int, int, int, const char*)’:
.../fltk/src/Fl_Text_Display.cxx:122:57: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ writing between 4 and 8589934584 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  122 |     for (int i=1; i<mNVisibleLines; i++) mLineStarts[i] = -1;
      |                                          ~~~~~~~~~~~~~~~^~~~
.../fltk/src/Fl_Text_Display.cxx:120:39: note: at offset 4 into destination object of size 4 allocated by ‘operator new []’
  120 |   mLineStarts = new int[mNVisibleLines];
      |                                       ^

This warning is IMHO obsolete because the code in question should not
be executed at all (mNVisibleLines == 1). However, the compiler seems
to substitute this with '__builtin_memset(...)' and analyzes "correctly"
that memory at offset 4 would be overwritten but not that the written
size would be 0.

The "fix" uses a compiler macro and #if to clarify that this code must
not be executed and should not be compiled (see comment why this code
exists).
2022-12-09 18:56:09 +01:00
ManoloFLTK
59be6a7ef9 Fix for "Public members Fl::awake_ring_*_ should be private" (#559) 2022-12-09 18:50:04 +01:00
ManoloFLTK
36ef15963a Comment only: put Fl_Display_Cairo_Graphics_Driver in class hierarchy 2022-12-09 18:47:55 +01:00
ManoloFLTK
eb2572deaf Add new Wayland-specific fl_wl_compositor() function 2022-12-09 17:06:35 +01:00
wcout
632661fa64 Fix Fl_Text_Display drawing of line numbers (#578)
The formerly undrawn rectangle beneath (or above) the line numbers is now filled with FL_BACKGROUND_COLOR.
Additionally the small rectangle between the scrollbars is now filled with FL_BACKGROUND_COLOR instead of FL_GRAY for consistency.
2022-12-09 16:55:06 +01:00
ManoloFLTK
36cd0a397c New Fl_ICO_Image class to read Windows .ico icon files
Many thanks to @darealshinji for contributing all the code
for this new FLTK image class (see branch Fl_ICO_Image of https://github.com/darealshinji/fltk).
2022-12-09 10:43:20 +01:00
Albrecht Schlosser
0bb30d8f92 Fix typo in comment 2022-12-08 20:40:03 +01:00
Albrecht Schlosser
823dc5acc4 Fix compilation warning, update dependencies
Warning: variable ‘j’ set but not used [-Wunused-but-set-variable]
2022-12-08 19:09:18 +01:00
ManoloFLTK
b9a9f7f10c Simpler prototype of Fl_Wayland_Graphics_Driver::buffer_commit() member - cont'd 2022-12-08 15:22:08 +01:00
ManoloFLTK
503492db78 Simplify prototype of Fl_Wayland_Graphics_Driver::buffer_commit() member 2022-12-08 10:16:06 +01:00
ManoloFLTK
cbd37a2870 Wayland: fix progressive drawing as in test/mandelbrot 2022-12-07 08:46:50 +01:00
ManoloFLTK
90c7e6bcb1 Fix issue #537 without damaging test/mandelbrot 2022-12-06 14:46:11 +01:00
Matthias Melcher
0d485b34a2
Fixing fl_complex_polygon() compilation for WIN32 (#571) 2022-12-05 19:57:30 +01:00
Matthias Melcher
9f92972729
Implement fl_complex_polygon() for OpenGL (#570) 2022-12-05 19:27:12 +01:00
ManoloFLTK
a8923a0fd4 Wayland: remove regression in mandelbrot introduced by 1a5d657
The panel was drawn solid black when test/mandelbrot was unfocussed.
2022-12-04 12:29:24 +01:00
ManoloFLTK
1b938ab8b1 Fl_Cairo_Graphics_Driver: simpler way to construct font from name+size 2022-12-04 09:31:24 +01:00