Commit Graph

794 Commits

Author SHA1 Message Date
ManoloFLTK
4291e9497b Fix for issue #123 - macOS platform 2020-11-27 17:49:49 +01:00
ManoloFLTK
3ec51f0b80 Remove unnecessary function call when macOS ≥ 10.6 2020-11-19 15:59:48 +01:00
ManoloFLTK
0f6fb2ab5a Add comment about detection of macOS "Big Sur" 11.0 at run-time. 2020-11-19 15:59:48 +01:00
Albrecht Schlosser
5cb72ef065 Fix whitespace and minor formatting issues 2020-11-17 16:11:03 +01:00
ManoloFLTK
0d8385a652 Simpler macOS implementation of capture of window titlebars. 2020-10-12 21:05:38 +02:00
ManoloFLTK
5830226aab Change procedure to capture window titlebar for macOS ≥ 10.15
That is necessary to support macOS Big Sur because previous procedure
did not work for tabbed windows. The new procedure is potentially
usable from macOS 10.5, but tested at this stage for macOS ≥ 10.15.
2020-10-11 10:43:01 +02:00
ManoloFLTK
de4a5765bc Fix for issue #145 and for unbundled macOS apps. 2020-10-05 18:20:25 +02:00
ManoloFLTK
5c5132f681 Fix when building with SDK 10.15 and running with 11.0 Big Sur
When FLTK runs under macOS "Big Sur", the OS appears as 11.0
if FLTK was built with SDK 11.0 and as 10.16 it it was built with
SDK 10.15.
2020-09-19 21:59:25 +02:00
ManoloFLTK
148e1df908 Further minor change to support macOS 11.0 "Big Sur". 2020-09-07 08:36:13 +02:00
ManoloFLTK
b8b2805270 Make recent changes to support macOS 11.0 "Big Sur" active with 11.0 only.
An optimisation used for drawing to windows is not possible under 11.0.
This commits reinstalls it under macOS 10.14 and 10.15.
2020-08-17 17:21:53 +02:00
ManoloFLTK
8f32a29a8b Slightly simpler code in the drawRect:(NSRect) method 2020-08-11 15:18:56 +02:00
ManoloFLTK
e5b5189870 Add support of macOS 11.0 "Big Sur". 2020-08-10 07:31:50 +02:00
Greg Ercolano
2141c63628 Implement + deploy fl_strdup() 2020-08-01 14:19:40 -07:00
ManoloFLTK
b40e218c01 Fix for "Crashing regression in MacOS code" in fltk.coredev. 2020-07-27 17:04:27 +02:00
ManoloFLTK
5839817c51 Fix problem when calling Fl_Window::fullscreen_off() in certain circumstances.
The problem was discovered in fltk.coredev "Crashing regression in MacOS code"
2020-07-24 18:41:53 +02:00
ManoloFLTK
3bb3429670 Restore use of virtual Fl_Window::resize() to be notified when window moves.
A previous commit c66caf5dce
"Simpler implementation of Fl_Cocoa_Window_Driver::resize()"
made that Fl_Window::resize() was no longer called by FLTK when a
window is moved. This prevented the undocumented practice of
re-implementing the virtual function Fl_Window::resize() and use it
as a way to get a notification that a window was moved.
2020-07-17 15:08:33 +02:00
ManoloFLTK
e5fbfcbec1 Simpler code to support layer-based views that occur when macOS ≥ 10.14 2020-07-11 15:40:53 +02:00
Albrecht Schlosser
f09e17c3c5 Remove $Id$ tags, update URL's, and more
- 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.
2020-07-06 20:28:20 +02:00
ManoloFLTK
46b89686df Allow using an Fl_SVG_Image object as window icon.
Fix for issue #90: Setting an svg image as a window icon causes a segfault.
2020-06-15 19:05:47 +02:00
ManoloFLTK
e43dee9d8a Fix for "Fullscreen_off removing the icon from the titlebar on MacOS" in fltk.coredev 2020-06-10 17:22:59 +02:00
ManoloFLTK
f9a63b5ed5 Fix for PR#86: mousewheel simultaneous X and Y scrolling under OS X .
Thanks to the OP for most of the fix.
2020-06-02 19:44:57 +02:00
ManoloFLTK
61d9035e99 Avoid repeated calls to CGBitmapContextGetBytesPerRow(). 2020-06-01 11:04:46 +02:00
ManoloFLTK
897b903f16 Have NSAutoreleasePool released after last use of variable e 2020-05-31 21:19:26 +02:00
ManoloFLTK
9957063398 Protect NSHomeDirectory() call by an NSAutoreleasePool.
That may be necessary if preferences are accessed before fl_open_display() was called.
2020-05-31 11:47:34 +02:00
ManoloFLTK
026d560fb4 Reorganise code that captures on-screen window content.
Also introduce new rect_to_NSBitmapImageRep: method of class FLWindow
which makes it possible to reimplement it.
2020-05-20 07:51:33 +02:00
ManoloFLTK
7f7e0e4ea1 Replace Fl_Window_Driver::is_a_rescale() by Fl_Window::is_a_rescale()
so it can be called by any user code.
2020-05-08 17:08:33 +02:00
ManoloFLTK
b3d46711be Slightly improve drawing of window titlebars. 2020-04-21 09:45:43 +02:00
Albrecht Schlosser
8a7d4c9f61 Remove CodeWarrior "support"
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.
2020-03-11 14:38:02 +01:00
ManoloFLTK
87c994e2f8 Fl_Sys_Menu_Bar: make it strict equivalent of Fl_Menu_Bar outside macOS 2020-02-28 16:47:44 +01:00
ManoloFLTK
707b81b626 Restore macOS capacity to turn window fullscreen encompassing several screens. 2020-02-09 11:17:49 +01:00
ManoloFLTK
83bd04e0a3 Fix Fl_Cocoa_Window_Driver::resize when called before the window is show()'n. 2020-02-07 17:11:22 +01:00
ManoloFLTK
7cb0c2311c Fix computation of Fl_Window::decorated_h() on macOS when screen is scaled. 2020-02-06 16:01:19 +01:00
ManoloFLTK
6aa9357b17 Have Fl_Quartz_Copy_Surface_Driver use retina resolution for resulting bitmap 2020-01-19 12:02:51 +01:00
ManoloFLTK
ea09ea1009 Use visible size information when copying macOS image from clipboard. 2020-01-18 17:09:10 +01:00
ManoloFLTK
d598f9ea06 Fix typo in comment 2020-01-14 16:31:47 +01:00
ManoloFLTK
c90baf9492 Bring main window to front when it's not there. 2020-01-13 18:01:29 +01:00
ManoloFLTK
2990717d6e Implement Fl_Window::icon() and default_icon() for macOS
The implementation is effective for macOS 10.10 and above.
Demo program test/device uses the new implementation.
2020-01-11 14:57:58 +01:00
Matthias Melcher
9c5888aa34 MacOS: Added the original code to the Fl_Preferences path that would search $HOME first, and only if that fails, we try other ways to find the home directory. This should be highly compatible with what we had first. 2020-01-04 00:51:22 +01:00
Matthias Melcher
8147199a41 macOS: checking Fl_Preferences file path improved
zlib: removed warning
2020-01-03 17:05:52 +01:00
ManoloFLTK
f68dee3288 Fix problems after closing full-screen window
macOS strangely sends NSViewFrameDidChangeNotification and a drawRect: message to its content view
after having sent to the window the close message. That is apparently new in 10.15.2
2019-12-20 10:59:19 +01:00
ManoloFLTK
803a472c5f Fix support of screen scaling under macOS 2019-12-19 18:25:09 +01:00
ManoloFLTK
ee9ada9678 Undo commit b1bcd1f that was not necessary. 2019-11-09 07:21:56 +01:00
ManoloFLTK
b1bcd1f19f Safer control of memory allocation of aux_bitmap member of FLView 2019-11-08 21:02:43 +01:00
ManoloFLTK
d1e346a7d2 Restore support of OpenGL on retina without Fl::use_high_res_GL(1)
Apparently the default value of the wantsBestResolutionOpenGLSurface
property changed with macOS Catalina 10.15
2019-10-26 08:47:25 +02:00
ManoloFLTK
80f5740468 Avoid useless code when drawing directly. 2019-10-20 15:37:05 +02:00
ManoloFLTK
4d350b61c1 Rewrite for macOS 10.15 Catalina
Another way to support what occurs under macOS 10.15 where the bitmap graphics context
prepared by the system when drawRect: runs sometimes changes its number of bytes/row
even if the width and height are unchanged.
This is expected to perform better when the number of bytes/row alternates between
two values.
2019-10-14 15:41:53 +02:00
ManoloFLTK
9863fef25a Fix for macOS Catalina 10.15
Under Catalina, the bitmap graphics context prepared by the system when drawRect: runs
sometimes changes its number of bytes/row even if the width and height are unchanged.
2019-10-12 16:02:00 +02:00
ManoloFLTK
72e712efbd Faster processing of layer-backed views used with MacOS ≥ 10.14
Calls to CGBitmapContextCreateImage() and CGContextDrawImage() are replaced
by faster calls to memcpy().
2019-10-09 11:49:24 +02:00
ManoloFLTK
940b7ba13d Faster drawing of layer-based windows if entirely redrawn 2019-09-24 12:57:29 +02:00
ManoloFLTK
17d155d916 Fix window moving between retina/non-retina display with a GL subwindow. 2019-08-27 17:44:31 +02:00
ManoloFLTK
33eb87940d Fix a case when fl_read_window() did not capture subwindows correctly.
The case was under macOS with a non-GL parent window mapped to a retina display
containing a GL subwindow and if the app did not call Fl::use_high_res_GL(1).
2019-08-21 12:01:51 +02:00
ManoloFLTK
e16eea32be Avoid repetition of the same multiplication. 2019-08-19 09:34:42 +02:00
ManoloFLTK
8c39007b26 Improved implementation of layer-backed views under macOS ≥ 10.14
This new implementation does all screen drawing through the drawRect: method.
The benefit is that [[NSGraphicsContext currentContext] CGContext] provides
a system-built drawing context whose product ultimately appears on screen.
Feed-back from the fldigi FLTK application shows that this procedure is
measurably faster that the previous one when drawing a rapidly changing image.
2019-08-18 21:56:12 +02:00
ManoloFLTK
3c41e2d372 Correct guard for adequate version of macOS SDK 2019-07-06 09:22:06 +02:00
ManoloFLTK
71faa15432 Add support for macOS 10.15 "Catalina"
This is relatively to Catalina public beta for now.
2019-07-06 09:16:39 +02:00
ManoloFLTK
ef1c937606 Fix a bug appeared in macOS 10.15 Catalina Beta about GUI scaling transient window.
The bug is that the app freezes for a few seconds before the yellow transient window is closed
if the close message is set from within a timer callback.
If the window to close returns NO to the canBecomeKeyWindow message, the bug does not occur.
Anyway it's good that canBecomeKeyWindow returns NO for a window with the OUTPUT flag.
2019-07-03 15:21:31 +02:00
ManoloFLTK
aa9f0a6962 Move Fl_Cocoa_Window_Driver::capture_titlebar_and_borders() to Fl_Cocoa_Window_Driver.cxx from Fl_cocoa.mm 2019-06-12 10:02:11 +02:00
ManoloFLTK
5ab26a17b0 Better use of the did_view_resolution_change message sent to FLViewLayer 2019-06-03 21:09:03 +02:00
ManoloFLTK
da6d671d9b Support for fl_scroll() under macOS when GUI is scaled - cont'd
Handles support of non-layered windows
2019-05-22 10:56:19 +02:00
ManoloFLTK
9b80a38345 Support for fl_scroll() under macOS when GUI is scaled 2019-05-21 21:17:11 +02:00
ManoloFLTK
07f4fd4380 More accurate implementation of Fl_Cocoa_Window_Driver::decoration_sizes(). 2019-05-20 13:30:57 +02:00
ManoloFLTK
159572785d Remove small duplication of code 2019-05-20 13:16:31 +02:00
ManoloFLTK
30e05510fa Avoid small repetition 2019-05-18 17:40:18 +02:00
ManoloFLTK
99419b2f63 Have Fl_Cocoa_Window_Driver::flush() use the drawRect: method to draw to non-layered views 2019-05-17 15:23:55 +02:00
Manolo Gouy
88c2994e20 Restore use for GL windows under macOS 10.14.0 2019-05-15 21:55:10 +02:00
ManoloFLTK
fa5c2718da Remove class FLGLViewLayer and get simpler code. 2019-05-15 13:59:29 +02:00
ManoloFLTK
e236091a99 Fix GUI rescaling when one window is iconified (macOS) 2019-05-13 15:06:19 +02:00
ManoloFLTK
dd687e7fbc Fix GUI scaling in presence of un-show()'n subwindows (macOS) 2019-05-12 19:02:15 +02:00
ManoloFLTK
467e216681 Use more convenient API for function get_window_frame_sizes() 2019-05-09 10:22:31 +02:00
ManoloFLTK
32439ec259 Fix Fl_Cocoa_Window_Driver::capture_titlebar_and_borders() when GUI is scaled down 2019-05-08 16:27:53 +02:00
ManoloFLTK
12dedc26cd Adapt function fake_X_wm() to rescaled GUI. 2019-05-08 12:25:48 +02:00
ManoloFLTK
d88ef8f039 Avoid double window redraw after resize 2019-05-08 11:53:25 +02:00
ManoloFLTK
5a57c928a1 Remove unnecessary code 2019-05-07 12:45:44 +02:00
ManoloFLTK
c00f31ab10 Slightly simpler code for what is specific to macOS 10.14.0 2019-05-06 16:55:41 +02:00
ManoloFLTK
fea125eca9 Restore forcing the position of a window before it's shown 2019-05-06 16:50:42 +02:00
ManoloFLTK
38cf195727 Remove call to Fl_Group::init_sizes() because it's expected from the caller. 2019-05-04 13:25:28 +02:00
ManoloFLTK
ef355e2762 Fix control for subwindow leakage in presence of GUI scaling 2019-05-04 09:44:29 +02:00
ManoloFLTK
5fde73b9ea Reworked algorithm to support window moving across screens 2019-05-02 20:53:10 +02:00
ManoloFLTK
738cce154e macOS: further fix to window moving necessary for macOS 10.3
Running the tabs test app with all 6 subwindows shown under 10.3
and moving the window around had 3 subwindows drift away
from their correct position.
2019-04-28 18:34:24 +02:00
ManoloFLTK
172063b2ad macOS: yet simpler implementation of window resize and rescale. 2019-04-28 15:31:02 +02:00
ManoloFLTK
9ac73175be Use NSViewFrameDidChangeNotification instead of NSWindowDidResizeNotification
This allows to support the tabbing/untabbing of windows with simpler, clearer code.

This commit also fixes the resizing of Fl_Overlay_Window that was broken in the
recent commit "Simpler implementation of Fl_Cocoa_Window_Driver::resize()"
    c66caf5dce
2019-04-25 10:30:59 +02:00
ManoloFLTK
6f82d88af3 macOS: restore correct tabbing/untabbing of windows - continued
slightly simpler and more explicit than previous commit at
    602c6ffd8a
2019-04-23 08:11:10 +02:00
ManoloFLTK
94f859c373 Consistently compute the current GUI scaling factor value. 2019-04-22 10:02:32 +02:00
ManoloFLTK
602c6ffd8a macOS: restore correct tabbing/untabbing of windows
The recent commit "Simpler implementation of Fl_Cocoa_Window_Driver::resize()"
    c66caf5dce
did not take care of tabbing/untabbing of windows.
This is repaired here.
2019-04-22 09:48:15 +02:00
ManoloFLTK
98b4ece33e Reorder Fl_Cocoa_Window_Driver to support upward OS compatibility 2019-04-21 09:45:06 +02:00
ManoloFLTK
f3bfe93a51 Fix Fl_Cocoa_Window_Driver::fullscreen_off()
The correct order of operations is to resize the window after having set its style.
2019-04-21 09:27:44 +02:00
ManoloFLTK
3f5580d49c macOS: better support of Fl_Window::border(int) 2019-04-20 22:01:48 +02:00
ManoloFLTK
ebbee5301b macOS: simpler handling of GL windows when first displayed.
tested on macOS versions 10.3, 10.6, 10.9, 10.14
2019-04-19 13:03:49 +02:00
ManoloFLTK
698fe39ff1 Minor code reordering 2019-04-15 16:08:16 +02:00
ManoloFLTK
72954f39d8 Minor code reordering. 2019-04-15 12:04:52 +02:00
ManoloFLTK
3fa2b73698 Update comments of Fl_Cocoa_Window_Driver::make_current() for macOS 10.14 2019-04-11 13:04:53 +02:00
ManoloFLTK
86849aac8f Improve Fl_Cocoa_Window_Driver::make_current() 2019-04-09 12:43:03 +02:00
ManoloFLTK
c66caf5dce Simpler implementation of Fl_Cocoa_Window_Driver::resize() 2019-04-07 09:09:33 +02:00
ManoloFLTK
607689c890 macOS: More efficient window rescaling that rarely calls Fl_Group::resize() 2019-03-28 17:30:18 +01:00
ManoloFLTK
499ec5c291 Replace static void Fl_Window_Driver::default_icons() by virtual Fl_Screen_Driver::default_icons() 2019-03-25 18:47:29 +01:00
ManoloFLTK
6a807716a7 Rename fl_compute_macKeyLookUp() to Fl_Darwin_System_Driver::compute_macKeyLookUp() 2019-03-25 13:16:27 +01:00
ManoloFLTK
e8d7eb1e46 Invalidate Quit also when running native file chooser. 2019-03-23 14:38:20 +01:00
ManoloFLTK
f89593d0de Avoid crash when messages canBecomeKeyWindow or canBecomeMainWindow received by closed window. 2019-03-18 13:07:55 +01:00
ManoloFLTK
3d57d9136b Avoid recreation of the system menu bar without change 2019-02-27 10:41:50 +01:00
ManoloFLTK
21c0134931 New member function const Fl_Image* Fl_Window::shape() replaces int Fl_Window::is_shaped()
The new function allows to get the window's shaping image
and delete it after use, if appropriate.
2019-02-23 10:21:27 +01:00