Commit Graph

3900 Commits

Author SHA1 Message Date
Albrecht Schlosser
a8640c6225 Fix Fl_Tree::insert() with pos out ouf range (#18)
The given position to insert a new item was not checked  against the
valid range so the program  could crash if a position less than zero
or greater than children() was given. The position is now clamped to
the valid range, i.e. the item is either prepended or appended.

Fixes issue #18.

Backported from 1.4, commit 9b272cfa4e
2019-01-25 18:27:21 +01:00
ManoloFLTK
c9bb57e58e Fix minor text input problem related to dead key previewing.
macOS normally previews a dead key and then replaces the preview by the final text
after the second key is typed.
macOS ≥ 10.7 also opens an auxiliary window to help choosing among possible characters
after some keys (e.g., n, c, o, a) are pressed and maintained for a while.
The problem fixed here is that after an auxiliary window has been used,
dead keys are no longer previewed.
That problem emerged at some undetermined point before 10.14 and after 10.7.
2019-01-23 18:55:35 +01:00
Manolo Gouy
a53dbee5e9 Merge branch 'branch-1.3' of https://github.com/fltk/fltk into branch-1.3 2019-01-09 15:32:55 +01:00
Manolo Gouy
294105d8d7 Support running under MacOS 10.14 with SDK 10.14 and 32-bit architecture. 2019-01-09 15:25:29 +01:00
Albrecht Schlosser
35e03733f4 Fix Fl_GIF_Image Color Table handling (STR 3491)
Loading GIF images could crash if there was no "Global Color Table"
but individual "Local Color Tables" with individual images.

Now local color tables are used correctly if available, but images that
lack both global and local color tables are being loaded with a default
(gray) color table and a warning is issued with Fl::warning().

The default color table uses black and white in the first two indices
as recommended by the standard.
2019-01-06 18:03:02 +01:00
Albrecht Schlosser
b7d434b863 Quick fix: menu disappearing (STR #3503 continued)
Quick fix to repair a case when Fl_Menu_Item::pulldown() was called with only
five arguments (argument pbutton == null) as discussed here:

d87ac9b597 (comments)

Backported from 'master': 9ea0d4ccbc
2018-12-11 18:21:00 +01:00
ManoloFLTK
037a09cdea macOS mojave: fix window with subwindow created in iconized form. 2018-12-08 19:15:35 +01:00
Albrecht Schlosser
dabc725486 Complete fix for STR #3503 (Fl_Choice).
Fl_Choice::handle() needs to be fixed as well.
2018-12-07 17:55:31 +01:00
Albrecht Schlosser
3aa32804f7 Fix crash if menu is deleted while menu is open (SGR #3503).
This can happen when a menu widget (e.g. Fl_Choice) is deleted in a
timer callback while the menu is open (pulldown active).
2018-12-07 14:27:39 +01:00
Manolo Gouy
a0b4e146e8 MacOS: further support of scenarios mixing miniaturize/deminiaturize/change screen configurations.
Test scenario:
 - use 2-screen configuration, one retina, one non-retina as main screen
 - put subwindow-containing window on retina
 - miniaturize window
 - close retina screen
 - de-miniaturize window
 The subwindow was wrong without this change.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13132 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-23 09:52:26 +00:00
Manolo Gouy
433b77e5d9 MacOS: introduce classes FLViewLayer and FLGLViewLayer to support layer-based windows under Mojave.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13130 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-22 14:28:57 +00:00
Manolo Gouy
47127be7dd MacOS: fix necessary for 10.14.2 public beta 3
Apple keeps changing how windows are drawn under 10.14 Mojave, even between minor 
releases! 
This change is required to correctly update a GL window moved from a non-retina to
a retina display under 10.14.2 public beta 3 (glpuzzle shows the problem).
It's unsure if it will still be necessary with 10.14.2, or later versions, but the change
does no harm if it's not necessary.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13125 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-17 16:05:11 +00:00
Manolo Gouy
93f4f91429 MacOS: simpler implementation of extra code necessary at first display of layer-backed GL windows
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13122 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-16 08:56:48 +00:00
Manolo Gouy
9dfa8a92a9 Fix macOS 10.14 Mojave support of the FLTK-cairo interface.
After experimenting with a modified cairo_test program that draws both with
 cairo and with regular FLTK drawing functions to the same window, it seems
 necessary to control for possible changes to the graphics context made by
 cairo in Fl_Window::make_current() rather than in
 cairo_create_surface().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13120 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-09 14:46:49 +00:00
Manolo Gouy
50b8ba6a53 Remove compilation warning with -Wexpansion-to-defined
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13118 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-09 13:34:02 +00:00
Manolo Gouy
2eea5d5856 Support of macOS 10.14 Mojave: better implementation of the Cairo-FLTK interface.
This implementation puts all code related to Cairo support under Mojave in 
the Cairo-specific source file cairo/Fl_Cairo.cxx, which is preferable.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13116 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-08 17:23:27 +00:00
Manolo Gouy
63626c8f26 Cairo support under macOS 10.14 Mojave: slightly simpler implementation
This post http://www.fltk.org/newsgroups.php?s36927+gfltk.general+v36944
reports a full-size Cairo-using FLTK app to be OK under Mojave with the
equivalent of this fix for the 1.4 branch.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13114 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-08 13:14:37 +00:00
Albrecht Schlosser
8fb3709ff0 Windows/OpenGL: fix pixel format detection (STR #3119).
This patch fixes two aspects described in STR #3119:
 (a) enables detection and prefers pixel formats with composition
 (b) selects no more than 32 bit colors (8 bits per pixel)

(a) was the reason for this STR, (b) was reported repeatedly in
fltk.general (see STR #3119).


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13112 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-05 18:56:24 +00:00
Manolo Gouy
6467a4ada0 MacOS: fix support of Cairo under macOS 10.14 Mojave.
The cairo_test program would redraw the window vertically flipped after the window was
hidden or miniaturized when layer-backed windows were used.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13111 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-05 09:04:38 +00:00
Manolo Gouy
7e04fe0acf Further fix to support gl_start() under MacOS platform.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13110 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-02 12:25:43 +00:00
Manolo Gouy
04e782d946 MacOS Mojave: restore support of gl_start()/gl_finish().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13107 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-01 21:01:41 +00:00
Manolo Gouy
fa89042fac Avoid dependence of Fl_cocoa.mm from libfltk_gl
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13102 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-30 15:45:31 +00:00
Manolo Gouy
5be486de5f Fix issue when moving window between retina/non-retina screens while window is under progressive redraw.
The problem was visible with test/mandelbrot and with layer-backed views.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13101 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-30 08:22:26 +00:00
Manolo Gouy
3409bcbb5e Fix moving GL subwindow between retina and non-retina screens.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13095 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-29 17:17:43 +00:00
Manolo Gouy
3dcee16c5e Fix handling of layer-backed GL window moved between retina and non-retina screens.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13092 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-29 15:52:51 +00:00
Manolo Gouy
4424fa9d35 Fix first drawing of layer-backed OpenGL window.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13088 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-28 16:53:40 +00:00
Manolo Gouy
e89bdd8c82 Implement method drawRect:(NSRect) for class FLViewGL
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13083 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-26 07:44:29 +00:00
Manolo Gouy
8ceabc92ef Slight simplification by removal of response to viewFrameDidChangeNotification
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13082 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-25 08:55:35 +00:00
Manolo Gouy
4c8b7c99ea Add support of MacOS 10.14 Mojave when app is linked with SDK 10.14
Mojave support requires to draw windows using so-called "layer-backed views".

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13077 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-20 21:58:04 +00:00
Manolo Gouy
b868e87c04 MacOS: fix is_bundled() function for case when [NSBundle mainBundle] is nil.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13056 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-09-22 07:26:37 +00:00
Manolo Gouy
38cd22d609 MacOS: fix regression in OS 10.13 where an unbundled app had its system menu bar unresponsive.
The regression was detected by "FLTK 1.4 on macOS: Trouble compiling my Application with Makefile"
 in fltk.general.
 The fix is to have unbundled apps initialize under MacOS 10.13 as under earlier OS,
 thus the new initialization procedure introduced for 10.13 is for bundled apps only.
 Tested OK on 10.13.6 and 10.14 public beta 10.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13052 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-09-17 08:54:41 +00:00
Manolo Gouy
39bb0bf488 MacOS 10.10+: Fl_Window::fullscreen() and fullscreen_off() no longer call Fl_Window::hide() + Fl_Window::show()
The new procedure essentially resizes the window, as done on the X11+EWMH and Windows platforms.
 This improves in particular the possibility to turn an Fl_Gl_Window fullscreen on and off.
 MacOS 10.10+ is required because the procedure isn't stable (random crashes during fast switches) with 10.9.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13051 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-09-17 08:08:39 +00:00
Manolo Gouy
226b64e9bd X11 + OpenGL: new procedure to create OpenGL3+ contexts giving access to the highest OpenGL version supported by GLX.
The ABI compatibility was checked with the abi-compliance-checker tool.
The same code has already been committed in the 1.4 branch.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13043 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-09-06 16:51:31 +00:00
Manolo Gouy
7bd8638805 Support recent MS Office apps that use \r\n as end of line in pasteboard.
FLTK now transforms that into \n as is expected under MacOS.
 Older MS Office apps used \r as old MacOS software.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13015 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-08-10 15:51:26 +00:00
Manolo Gouy
e60e4750f8 Fix Fl::paste() in Fl_win32.cxx to paste GIF images.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12879 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-04-29 16:09:15 +00:00
Albrecht Schlosser
b88929f98c Fix Fl_Text_Editor overstrike mode (STR #3463).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12848 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-04-18 13:13:07 +00:00
Albrecht Schlosser
fe7ff8888e Fix, optimize, and comment "gleam" scheme box drawing.
Some border lines were too short or too long, the shading code would draw
too many shaded lines, and the code was hard to understand.

With this commit all background pixels of the box are drawn exactly once.
The border lines are consistent, but some pixels of the border are not
drawn at all so the background shines through. This is intended for
backwards compatibility.

A minor change is that the drawn background does no longer overlap the
border lines. Hence undrawn pixels that previously displayed the colored
box background are now transparent and show the parent widget's color.

This commit adds comments and implementation notes to make the code easier
to understand and better maintainable (hopefully).


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12778 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-03-20 16:20:17 +00:00
Albrecht Schlosser
67fd2793a3 Fix latest MinGW build error (S_OK, __FD_ISSET, STR #3454).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12679 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-19 14:50:02 +00:00
Manolo Gouy
6e5c31eab6 Introduce global fl_mac_quit_early that, if set to 0, prevents FLTK from terminating the app after cmd-Q without Fl::run() returning.
This is a MacOS-specific public global variable.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12649 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-07 09:37:10 +00:00
Manolo Gouy
49a1d38cfd WIN32 + OpenGL: fix use of wglUseFontBitmapsW() to draw all of UTF under GL with gl_draw() - continued.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12624 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-01-07 07:47:27 +00:00
Manolo Gouy
3a90d5dc14 WIN32 + OpenGL: fix use of wglUseFontBitmapsW() to draw all of UTF under GL with gl_draw().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12623 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-01-07 07:41:46 +00:00
Manolo Gouy
a124051e7e Fix crash after calling Fl_Copy_Surface::draw_decorated_window() with MacOS 10.13
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12611 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-28 07:27:18 +00:00
Manolo Gouy
ed632e8cfd Top-level menus should not be inactivated. Their items can be.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12571 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-27 20:50:34 +00:00
Manolo Gouy
e0aa84368d MacOS: improve handling of dropped files at launch time for MacOS 10.13
Because opening a file can call the event loop and thus access the list of dropped files,
it's necessary to remove the object from the list before opening the file.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12521 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-22 06:19:21 +00:00
Manolo Gouy
f3d5f20315 Mac OS 10.13 "High Sierra": restore possibility to run app from a command line and find it activated.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12515 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-18 15:23:41 +00:00
Manolo Gouy
714d970db1 MacOS: make sure all files dropped to the app at launch time are open when Fl_Window->wait_for_expose() is used.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12513 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-18 13:57:18 +00:00
Manolo Gouy
db96b5e091 Mac OS: complete changes needed for 10.13 "High Sierra" regarding how FLTK applications start.
With MacOS 10.13 "High Sierra", it was necessary to change what happens at application start time.
The new procedure is:
fl_open_display() calls [NSApp run], and during this call:
      the main event loop is started;
      the app delegate receives an openFile: message for each file dropped on the app icon. Each
            such filename is memorised in an NSMutableArray called dropped_files_list;
      the app delegate receives applicationDidFinishLaunching and stops the main event loop
            (this seems to occur unpredictably after the first openFile: message or after all of them).
When the FLTK event loop begins, it checks whether dropped_files_list is empty. If it is not,
    the first element of this list is a filename which is opened and is removed from dropped_files_list.

This new setup allows to turn resizable windows fullscreen and back as expected under MacOS,
and to support launching apps while dropping file(s) on its icon.

For now, the new setup is used only when MacOS 10.13 is running.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12509 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-17 10:35:29 +00:00
Manolo Gouy
150c261a45 MacOS 10.13: fix problem with window made fullscreen by clicking on green window button.
With MacOS 10.13 "High Sierra", when a window is made fullscreen by clicking on the green window button,
 the window hides the system menubar, but it's not possible to show the menubar by moving the pointer
 to the very top of the window. This new way of starting apps fixes this problem.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12504 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-15 17:42:48 +00:00
Manolo Gouy
64112db0cb Better implementation of Fl_Window::wait_for_expose() for Mac OS 10.13 High Sierra.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12487 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-11 15:27:36 +00:00
Manolo Gouy
d9e36a352f Fix for STR#3397: Font size/type not working inside GL window with gl_font(), gl_draw()
Function load_xfont_for_xft2() tries to load an X font corresponding to a given xft font, to use it
with GL. Under Ubuntu, always the same font was loaded, whatever the family, style and size.
With this fix, style and size requests are honored under Ubuntu. Family request may not be honored.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12403 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-08-27 07:24:49 +00:00