Commit Graph

410 Commits

Author SHA1 Message Date
Manolo Gouy
22af09dae7 Mac OS: support for high resolution OpenGL windows.
Methods Fl::event_x_pixel() and Fl::event_y_pixel() committed at r.10941
are removed. Instead method Fl_Gl_Window::pixels_per_unit() is added.

The documentation explains in more detail how to write cross-platform
FLTK code supporting high resolution OpenGL windows on retina displays.

The examples/OpenGL3test.cxx app exercises Fl_Gl_Window::pixels_per_unit().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10945 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-02 09:59:37 +00:00
Manolo Gouy
597ac17bda Mac OS: added Fl::event_x_pixel() and Fl::event_y_pixel() that return the mouse event position
in pixel units that differ from FLTK units for OpenGL windows mapped to a retina display.
On non Mac OS platforms, these are synonyms of Fl::event_x() and Fl::event_y().
The example/OpenGL3test demo program is modified to call these new functions.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10941 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-01 16:17:37 +00:00
Manolo Gouy
b2f24781d4 Mac OS: fixed possible crash when closing fullscreen GL window with close button of title bar.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10937 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-30 13:06:31 +00:00
Manolo Gouy
d74f373552 Mac OS: allow calling Fl_Gl_Window::pixel_w() before the window is shown.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10936 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-30 12:46:42 +00:00
Manolo Gouy
b0696db39a Added new method Fl_Copy_Surface::draw_decorated_window()
that copies a window to the clipboard together with its title bar and borders.
This requires very little new code because the capture of window decorations
is shared with the Fl_Paged_Device::print window() method.
The device test program is changed to call the new method.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10928 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-24 14:26:52 +00:00
Manolo Gouy
511ec0bb3d Mac OS: have Fl_Paged_Device::print_widget() print top-level windows with
rounded bottom corners as they appear on screen.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10916 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-19 16:33:44 +00:00
Manolo Gouy
364dfaf802 Mac OS. This simpler algorithm is just as good: remove the constraint
altogether for subwindows; keep it unchanged for windows.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10913 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-16 16:48:01 +00:00
Manolo Gouy
31c9c98434 Corrected typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10912 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-16 08:59:33 +00:00
Manolo Gouy
535b477e7c Mac OS: with OS 10.11, the (green) window maximize button turns the window fullscreen so
it covers the dock and the system menu bar. The default behavior of a subwindow of such
a fullscreen window is to be prevented to cover the menu bar (which makes not much sense 
because this bar is covered by the main window). If the location of the subwindow within
its parent window expected by FLTK would have it cover the menu bar, Mac OS moves
it down. The subwindow therefore does not lie where FLTK wants it.
This patch overrides the adequate method of the NSWindow class to prevent this bad behavior.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10911 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-16 08:47:18 +00:00
Manolo Gouy
ebffeb8edd Mac OS: Added necessary check because a non-FLTK window can be found
as child of an FLTK window when turning a window full-screen.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10909 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-15 10:45:59 +00:00
Manolo Gouy
ba26f2c194 Mac OS X: simplified code for moving and resizing subwindows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10908 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-13 10:55:38 +00:00
Manolo Gouy
647821fa71 Mac OS X: with OS 10.11 "El Capitan" window capture returns an ARGB image (it used to return RGBA)
whereas OpenGL window capture returns RGBA as before. Capturing a window with subwindow(s)
requires ARGB <--> RGBA conversion when Quartz and OpenGL windows are mixed.
The OpenGL-inside-Quartz case was taken care of before.
Here, the Quartz-inside-OpenGL case is properly handled.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10900 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-11 07:46:15 +00:00
Manolo Gouy
68f3cc6d88 Mac OS X: added checks that subwindows do not leak out of
enclosing window when they are programmatically resized or moved.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10899 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-10 06:39:37 +00:00
Manolo Gouy
f00901534a Mac OS: fixed bad window resizing when presence of sub-sub-window and window
resized by top border.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10898 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-09 10:25:16 +00:00
Manolo Gouy
4ad9e7c6b8 Mac OS: improved control that subwindows do not leak outside their parent
after window resize.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10893 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-08 19:00:17 +00:00
Manolo Gouy
8a4acc5b05 Mac OS only.
Allow proper initial display of a subwindow-containing window in iconized state
(previously, the subwindow was not displayed in the icon).
Also fixes a problem with subwindows when the screen resolution was changed
while the window was iconized.
Tested with Mac OS 10.11, 10.6 and 10.3.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10891 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-11-07 17:20:33 +00:00
Manolo Gouy
7e025aac22 Added support for OpenGL V3 and higher.
On the X11/MSWindows platforms, this requires external installation of the GLEW library.
This fixes STR#3198 and STR#3257.
Added two new examples programs.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10876 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-10-27 08:40:56 +00:00
Manolo Gouy
accbfd9f66 More careful coding that does not read beyond the end of the image data
when an ARGB system image is converted to the RGBA format.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10870 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-10-20 14:53:37 +00:00
Manolo Gouy
57e603e6bc More detailed comment.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10869 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-10-19 14:41:24 +00:00
Manolo Gouy
2dd9d06818 Make sure the FLTK and the system keep their representations of window coordinates synchronized.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10863 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-09-22 05:43:37 +00:00
Manolo Gouy
bf5822bb8b Mac OS: slightly simpler code that does just the same thing.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10861 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-09-10 14:53:16 +00:00
Manolo Gouy
157eb68eae Mac OS: 1) simpler tracking of window changes between retina/non retina displays.
2) improved window creation in iconized state (child windows still don't show in icon, though).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10860 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-09-10 13:09:38 +00:00
Manolo Gouy
1e1f1c33bd Mac OS: added missing cast required by some compilers.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10856 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-09-07 10:45:00 +00:00
Manolo Gouy
60ad983b4e Mac OS: properly handle OpenGL profile requests independently from what SDK version is used at compile time.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10855 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-09-07 09:26:19 +00:00
Manolo Gouy
3570777a58 Removed the global variable inputContext_SEL.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10845 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-27 17:10:00 +00:00
Manolo Gouy
16e08ce3a2 Programs compiled with pre-10.7 SDKs can now fully use retina displays.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10844 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-27 12:31:46 +00:00
Manolo Gouy
a3adc0c4ad Improved handling of differences between OS versions in text input.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10843 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-27 08:40:30 +00:00
Manolo Gouy
03cad454d7 It's clearer to implement and use a doNothing: message.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10841 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-25 10:57:16 +00:00
Manolo Gouy
89589d7c9b Remove a compilation warning appearing with Mac OS 10.11 +
explain better the intent of this thread creation.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10840 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-24 19:09:56 +00:00
Manolo Gouy
daeed067c8 Mac OS: simpler algorithm for function NSBitmapImageRep* GL_rect_to_nsbitmap()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10834 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-17 17:05:32 +00:00
Manolo Gouy
60a78880d5 Mac OS: more efficient handling of ARGB image data produced under
Mac OS 10.11 when capturing screen data.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10833 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-16 16:10:12 +00:00
Manolo Gouy
1e6bc1c73a Improved Mac OS implementation of Fl_Window::wait_for_expose().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10828 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-11 11:47:21 +00:00
Manolo Gouy
cc36ab53b3 - Implement Fl_Window::wait_for_expose() for Mac OS:
The -[NSWindow makeKeyAndOrderFront:] message used to make the window appear on the screen,
but, starting with 10.10 (approximately), this changed, and it became necessary to query for events
for a new window to appear on the screen. With 10.11 two event messages are needed.
The solution is therefore to implement Fl_Window::wait_for_expose().

- Calling NSDisableScreenUpdates()()/NSEnableScreenUpdates() before and after window updates
greatly accelerates multi-window update operations.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10826 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-07 12:55:56 +00:00
Manolo Gouy
4388e5635e Simpler code to support copy/paste of image data, that is also valid from Mac OS 10.3.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10822 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-08-01 17:25:53 +00:00
Manolo Gouy
7819882874 Fixed image copy/paste for Mac OS 10.4 and 10.5 that use different pasteboard type names
from later OS versions.
Unfortunately, it does not work with Mac OS 10.3

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10818 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-25 15:57:14 +00:00
Manolo Gouy
491938a4a9 Make Fl_Copy_Surface work on Mac OS 10.3:
use different pasteboard data type names according to running OS.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10817 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-25 08:02:03 +00:00
Manolo Gouy
a3e48a4afd Use -(NSGraphicsContext*)[NSWindow graphicsContext] to obtain the adequate
graphics context to draw to a window. This requires Mac OS 10.4.
The advantage is that it is possible for a secondary thread to call 
Fl_Window::make_current() without needing to create an autorelease pool.

We save the native graphics state, and also the state with origin at top. 
Fl_X::q_release_context() restores the graphics state twice to return to
the native state. This allows to use a single graphics context for a single
window and a single thread.

Under 10.3, we have to create a new NSGraphicsContext when Fl_Window::make_current()
is called directly, so that secondary threads cannot call Fl_Window::make_current() without
having created an autorelease pool.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10816 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-24 22:17:36 +00:00
Manolo Gouy
80402f622c Restore usability on Mac OS 10.3:
- do not use NSOpenGLPFAMultisample
- do not use -[NSBitmapImageRep bitmapFormat]
that require Mac OS 10.4

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10815 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-24 21:30:46 +00:00
Manolo Gouy
696231e512 Prepare for Mac OS 10.11 'El Capitan':
- avoid double redraw after window deminiaturization
- make sure that a new window appears on screen during the Fl_X::make() call

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10801 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-20 11:09:48 +00:00
Manolo Gouy
ad4d5ba5b5 Make sure the window is drawn when Fl_X::make() is called
(necessary with Mac OS 10.11).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10800 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-19 21:28:05 +00:00
Manolo Gouy
1cf24ff074 Restore compilability with Mac OS SDK 10.3 and above
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10798 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-18 07:18:15 +00:00
Manolo Gouy
ee7a427d87 Allow compilation with early Mac OS SDKs
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10796 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-17 17:17:53 +00:00
Manolo Gouy
6ad3a28cc5 Comment for a change that appeared in Mac OS 10.11
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10793 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-17 16:14:21 +00:00
Manolo Gouy
7c0c17a452 Preparing for Mac OS 10.11 'El Capitan':
change in rect_to_NSBitmapImageRep().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10790 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-15 21:47:39 +00:00
Manolo Gouy
3283aacf98 Prepare for Mac OS 10.11 "El Capitan"
Screen captures produce ARGB data (instead of RGBA until 10.10)
so access to the raw image data takes now this into account.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10789 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-13 20:43:13 +00:00
Manolo Gouy
9e320937fc Improved Fl_Window::make_current() that now creates a new NSGraphicsContext only when drawing
is not done through the standard event loop.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10784 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-11 15:35:20 +00:00
Manolo Gouy
634ede015d Define NSInteger in FL/mac.H when needed, so it's available to all source files.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10779 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-06-30 02:23:26 +00:00
Manolo Gouy
a6b88e9191 Directly draw windows without forcing the system to send the -[NSView drawRect:] message
because this slowed window drawing under Mac OS 10.10

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10777 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-06-28 19:28:23 +00:00
Manolo Gouy
a097978096 Mac OS: computing a method's address once is enough.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10750 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-06-12 13:15:38 +00:00
Lauri Kasanen
03f69c0dd5 Add support for Fl::copy(..clipboard = 2..)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10731 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-05-18 09:10:06 +00:00