summaryrefslogtreecommitdiff
path: root/src/drivers/Cocoa
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-19 16:58:17 +0000
committerManolo Gouy <Manolo>2016-04-19 16:58:17 +0000
commit9f78323574ce8fbbcbf491980fdc9629b83a018a (patch)
treeac33378cddf4b1a0140f664afb223ac40c410bdd /src/drivers/Cocoa
parentf29fb8c539a691fb798d2da6ad798c767e1076cd (diff)
Move GL-related static member functions of the Fl_X class on Mac OS to class Fl_Cocoa_Screen_Driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11662 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Cocoa')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H18
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H4
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx3
3 files changed, 23 insertions, 2 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
index 4cde863d7..947d3d133 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
@@ -41,6 +41,15 @@
class Fl_Window;
class Fl_Input;
+#ifdef __OBJC__
+@class NSOpenGLPixelFormat;
+@class NSOpenGLContext;
+#else
+class NSOpenGLPixelFormat;
+class NSOpenGLContext;
+#endif // __OBJC__
+
+
class FL_EXPORT Fl_Cocoa_Screen_Driver : public Fl_Screen_Driver
{
protected:
@@ -55,6 +64,15 @@ protected:
public:
Fl_Cocoa_Screen_Driver();
static int next_marked_length; // next length of marked text after current marked text will have been replaced
+ // --- Cocoa-only members
+ // computes NSOpenGLPixelFormat from Gl window's mode
+ static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // uses Objective-c
+ static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx, Fl_Window *window);
+ static void GLcontext_update(NSOpenGLContext*);
+ static void GLcontext_flushbuffer(NSOpenGLContext*);
+ static void GLcontext_release(NSOpenGLContext*);
+ static void GLcontext_makecurrent(NSOpenGLContext*);
+ static void GL_cleardrawable(void);
// --- display management
// --- screen configuration
virtual void init();
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
index 3f7f0ab64..bd1071716 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
@@ -33,9 +33,11 @@ class Fl_Window;
#ifdef __OBJC__
@class CALayer;
@class NSCursor;
+@class FLWindow;
#else
class CALayer;
class NSCursor;
+class FLWindow;
#endif // __OBJC__
/*
@@ -85,7 +87,7 @@ public:
void in_windowDidResize(bool); // sets whether window is performing windowDidResize
CGRect* subRect() { return subRect_; } // getter
void subRect(CGRect *r) { subRect_ = r; } // setter
- void destroy();
+ static void destroy(FLWindow*);
unsigned char *bitmap_from_window_rect(int x, int y, int w, int h, int *bytesPerPixel);
CGImageRef CGImage_from_window_rect(int x, int y, int w, int h);
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
index 8e1b59ee2..91e0c263f 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
@@ -240,7 +240,8 @@ void Fl_Cocoa_Window_Driver::hide() {
if ( ip->xid == fl_window )
fl_window = 0;
if (ip->region) Fl_Graphics_Driver::default_driver().XDestroyRegion(ip->region);
- destroy();
+ destroy(ip->xid);
+ delete subRect();
delete ip;
}