Commit Graph

444 Commits

Author SHA1 Message Date
Manolo Gouy
309213bfae Simpler code for capture of OpenGL windows: the pixel array is converted to top-to-bottom earlier.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11326 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-09 06:59:12 +00:00
Matthias Melcher
12eef8e64d Separating Fl_X and Fl_Window_Driver in Fl_Window.
This was needed because Fl_X only exists if a window is mapped, but we need the driver from the very beginning. Adding Fl_X in the ctor would create hidden bugs. Strategy is now to remove system specific stuff from Fl_X and move it one-by-one to Fl_Window_Driver while maintaining a working code base. X11 and WIN32 fixups will follow in 15 minutes.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11308 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-07 21:15:25 +00:00
Manolo Gouy
7decb3d3b2 Rewrite the Fl_Copy_Surface class with strict separation of public API and platform-related code.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11257 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-01 17:20:25 +00:00
Matthias Melcher
95824506fe Moved timer code to screen drivers. Not sure if this should be in System Drivers instead.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11253 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-01 00:54:21 +00:00
Manolo Gouy
0b406baa0f Rewrite all fl_XXX_offscreen() functions so they use an Fl_Image_Surface object.
These functions become therefore platform-independent.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11241 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-27 13:52:27 +00:00
Manolo Gouy
682f950796 Create class Fl_Widget_Surface that supports draw(Fl_Widget *, int, int).
This simplifies the implementation of Fl_Copy_Surface and Fl_Image_Surface
which now are made to derive from Fl_Widget_Surface.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11220 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-26 12:51:47 +00:00
Matthias Melcher
052401a34e Instantiate the right Fl_Window_Driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11195 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-19 22:21:02 +00:00
Manolo Gouy
1b5e231c90 Rename Fl_Graphics_Driver::set_gc(void*) to gc(void*) and Fl_Graphics_Driver::get_gc() to gc().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11191 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-19 12:40:24 +00:00
Manolo Gouy
f33b45f1d3 Remove all uses of the fl_gc global variable. Towards a clean driver model.
fl_gc remains usable by the application as a hook into the system.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11189 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-18 16:21:51 +00:00
Manolo Gouy
ec290bc9e0 Remove Fl_X::q_fill_context() used only once.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11171 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-14 06:36:20 +00:00
Manolo Gouy
6439f34ee7 Remove Fl_X::q_clear_clipping() used only once.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11170 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-14 06:19:26 +00:00
Manolo Gouy
4af616a7a2 New member function Fl_Quartz_Graphics_Driver::draw_CGImage() used internally for all image drawing.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11165 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-13 14:48:13 +00:00
Manolo Gouy
8deac1e6ba Simpler code to support drawing to high-resolution Fl_Image_Surface object.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11162 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-13 06:25:34 +00:00
Manolo Gouy
df0b1dcb07 Fl_Window::capture_titlebar_and_borders() returns a double-resolution top image.
Also, Fl_Image_Surface now can draw a scaled Fl_Shared_Image to 
a double-resolution surface.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11160 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-12 21:15:48 +00:00
Manolo Gouy
bf7c25a1d7 Add Fl_Shared_Image *Fl_Image_Surface::highres_image() to draw into high-resolution bitmap.
Also, change arguments of void Fl_Window::capture_titlebar_and_borders() from
Fl_RGB_Image to F_Shared_Image so, in the future, scaled images having
a drawing size distinct from a pixel size can be returned, to support
high-resolution displays.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11159 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-12 16:17:40 +00:00
Manolo Gouy
bc83464b64 Add Fl_Shared_Image *Fl_Image_Surface::highres_image() to draw into high-resolution bitmap.
This new member function returns a high resolution bitmap image scaled to the adequate
 drawing size. This allows to create a bitmap image able to fill all pixels of a high resolution
 display. This is functional only for the Mac OS platform. On other platforms, 
 the new member function returns an unscaled bitmap.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11158 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-12 11:49:32 +00:00
Matthias Melcher
50ee3bcd66 Mark places that need to be refactored with // PORTME:
Searching for __APPLE, WIN32 or X11 did give me many false results. I instead marked most ifdef's that I would like to get rid of with the text // PORTME:, so they can be easily found by a global search.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11155 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-11 12:02:36 +00:00
Matthias Melcher
e83bc2527f Basic Screen Driver Structure. LIMBO!
Creating the basic structure for a screen driver system.
OS X works X11 and WinAPI are in limbo and will be fixed in the next hour or so.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11148 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-10 19:49:35 +00:00
Manolo Gouy
2b36a14d10 Fix Mac OS "Print front window" of the application menu.
This is part of r.10990 committed to the 1.3 branch, still to be replicated
in this branch.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11105 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-01 09:14:08 +00:00
Albrecht Schlosser
0a6be0a83f Fix compiler warnings (STR 2988), porting from branch-1.3.
This commit is the accumulated patch introduced in branch 1.3
in svn r 11094, 11095, and 11096.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11097 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-01-31 04:33:54 +00:00
Manolo Gouy
1c3c544edf Added Fl_Window::capture_titlebar_and_borders a new private member function
that triggers a warning when FL_PORTING is ON and with a default platform-neutral
implementation.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11074 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-01-28 11:51:07 +00:00
Matthias Melcher
780f43a4f1 Removed all references to Quartz driver files from library headers in Xcode. Works in Xcode.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11065 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-01-27 22:35:58 +00:00
Manolo Gouy
8e3f66073f 1) Added a new way to detect whether the drawing operation is using the platform's native driver
and whether we are printing:  virtual int Fl_Graphics_Driver::has_feature(driver_feature feature)
This is also because it is not convenient to derive a printer-specific driver with its own
implementation of virtual functions when this implementation differs only in one line of code.

2) Solved the problem of inclusion of non public header by the public header FL/Fl_Device.H:
bracket this with #if FL_LIBRARY / #endif so this non public header is included only when building
FLTK itself.

3) Removed several (but not all) of the FLTK_ABI_VERSION guards that are no longer
useful for code targeting FLTK 1.4.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11063 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-01-27 18:11:20 +00:00
Manolo Gouy
eeb65bef23 1) Replicate in branch-1.3-porting all recent changes of branch-1.3
2) Advance branch-1.3-porting with new function Fl_X::capture_titlebar_and_borders()
that contains all the platform-specific code of all operations related to drawing
window borders and title bars. What is platform-specific and what is not
is therefore much clearer, to ease porting.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11002 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-01-10 19:08:16 +00:00
Manolo Gouy
59823515cf Mac OS: It is not necessary to open the display to send the
+[NSWindow  frameRectForContentRect:styleMask:] message
(checked on 10.11 and 10.3). Therefore fluid -c will run without
opening the display.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10979 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-23 09:33:06 +00:00
Manolo Gouy
527d5943d0 Mac OS: when an app is asked to open a file by Applescript, have it redraw itself
without waiting for the next event to come, because AppleScript does not break the
event loop.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10978 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-23 07:34:49 +00:00
Manolo Gouy
25fc85190e Mac OS: Fix for STR#3268 where a fullscreen window could become relocated
behind the menu bar and dock.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10975 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-21 13:38:49 +00:00
Manolo Gouy
09cd712c0d Allowing to use FLTK objects in static initializers (cont'd).
On the Mac platform, it is also necessary to change the initialization of 
the macKeyLookUp array for keyboard events to work in a static
initializer.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10962 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-13 09:51:07 +00:00
Manolo Gouy
8d1d2df0c2 Mac OS: using true system windows for FLTK sub-Fl_Window's.
Improved handling of the situations where a subwindow is created,
hidden, the parent window resized, and the subwindow shown,
with a new size. This change no longer sends setFrame: or setFrameOrigin:
messages to hidden subwindows. Instead, subwindows acquire their correct
size and position when they are shown again and Fl_X::map() is called.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10954 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-09 12:52:17 +00:00
Manolo Gouy
c7950b30c4 Mac OS: the present code asks the system to build the mini window image when a subwindow-less window is miniaturized,
and builds itself the image when a window with subwindow is miniaturized. That is mostly OK, but it fails when a window
containing a subwindow is miniaturized (a mini image is computed), deminiaturized, the subwindow is removed
or hidden, and the window is miniaturized again: the old mini image is used, and that is not appropriate.
The solution is to remove the FLTK-computed mini image when a window with subwindow is deminiaturized.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10953 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-09 10:13:46 +00:00
Manolo Gouy
ade095f240 Mac OS: added visibility test necessary after a subwindow-containing group was hidden.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10951 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-07 20:10:07 +00:00
Manolo Gouy
caba454f39 Mac OS: removed some code that was duplicated by checkSubwindowFrame run later.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10950 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-07 17:53:26 +00:00
Manolo Gouy
f79f70b96a Removed compilation warning with SDKs 10.3 and 10.4u
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10948 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-03 17:18:33 +00:00
Manolo Gouy
58afd21c73 Mac OS: send the setWantsBestResolutionOpenGLSurface:YES message in
Fl_X::create_GLcontext_for_window() where it is directly relevant.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10947 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-02 14:22:52 +00:00
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