summaryrefslogtreecommitdiff
path: root/FL/mac.H
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-12-20 07:19:23 +0000
committerManolo Gouy <Manolo>2014-12-20 07:19:23 +0000
commitf3a84c0ee5f88fe664d759106724f786c706f817 (patch)
tree3541953164e2d24c31ae46ef11f2c2e86b3873a3 /FL/mac.H
parenta7dc3ea9e24399f318a9478fbcffe04ff2870de6 (diff)
Changed OpenGL support for the Mac OS X platform: use cocoa instead of deprecated AGL.
All changes are mac-specific, except a very minor change in file src/gl_draw.cxx where string drawing wrongly claimed to support @symbol, not possible because symbols are drawn using non-GL primitives. Unchanged application code can use the new FLTK code. In addition, the new code allows mac applications to draw OpenGL scenes at high resolution on so-called 'retina' displays, but this requires some support from app code. They must call, before opening GL windows, Fl::use_high_resolution(1); and change their glViewport() calls as follows glViewport(0, 0, pxel_w(), pixel_h()); This uses 2 new member functions of the Fl_Gl_Window class, pixel_w() and pixel_h() returning the window dimensions in pixel units, that is, twice the w() and h() when the window is mapped on a retina display. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10498 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/mac.H')
-rw-r--r--FL/mac.H9
1 files changed, 8 insertions, 1 deletions
diff --git a/FL/mac.H b/FL/mac.H
index 85e40c12b..df234710f 100644
--- a/FL/mac.H
+++ b/FL/mac.H
@@ -74,8 +74,10 @@ typedef CGContextRef Fl_Offscreen;
#ifdef __OBJC__
@class NSCursor;
+@class NSOpenGLPixelFormat;
#else
class NSCursor;
+class NSOpenGLPixelFormat;
#endif // __OBJC__
typedef CGContextRef Fl_Offscreen;
@@ -151,6 +153,8 @@ public:
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
bool mapped_to_retina(); // is window mapped to retina display?
void mapped_to_retina(bool); // sets whether window is mapped to retina display
+ bool changed_resolution(); // did window just moved to display with another resolution?
+ void changed_resolution(bool);// sets whether window just moved to display with another resolution
#endif
// Quartz additions:
CGContextRef gc; // graphics context (NULL when using QD)
@@ -160,6 +164,8 @@ public:
static void q_begin_image(CGRect&, int x, int y, int w, int h);
static void q_end_image();
// Cocoa additions
+ static int resolution_scaling_factor(Fl_Window*);
+ static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // computes NSOpenGLPixelFormat from Gl window's mode
void destroy(void);
void map(void);
void unmap(void);
@@ -183,7 +189,8 @@ public:
private:
#if FLTK_ABI_VERSION >= 10304
CGRect* subRect_; // makes sure subwindow remains inside its parent window
- unsigned mapped_to_retina_; // stores whether window is mapped to retina display
+ // stores 2 binary flags: whether window is mapped to retina display; whether resolution just changed
+ unsigned mapped_to_retina_;
#else
bool subwindow; // for ABI compatibility, useless with true subwindows
#endif