summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-17 10:12:42 +0000
committerManolo Gouy <Manolo>2016-04-17 10:12:42 +0000
commita4e5dc0267bf972b5897aec0f167b3e2d9488a8c (patch)
tree5f18230489a8b69d63e883eb75585477056ddb72 /src
parent16beb869a506107a8286bc225a152766a8a7a798 (diff)
Move q_release_context() from class Fl_X to class Fl_Cocoa_Window_Driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11639 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm10
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm2
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H1
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx2
4 files changed, 8 insertions, 7 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 368fec105..fe224206e 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -875,7 +875,7 @@ double fl_mac_flush_and_wait(double time_to_wait) {
if (Fl::idle && !in_idle) // 'idle' may have been set within flush()
time_to_wait = 0.0;
double retval = fl_wait(time_to_wait);
- Fl_X::q_release_context();
+ Fl_Cocoa_Window_Driver::q_release_context();
[pool release];
return retval;
}
@@ -2876,7 +2876,7 @@ void Fl_X::flush()
through_Fl_X_flush = NO;
if (!through_drawRect) [[xid contentView] unlockFocus];
make_current_counts = 0;
- Fl_X::q_release_context();
+ Fl_Cocoa_Window_Driver::q_release_context();
}
}
@@ -3255,7 +3255,7 @@ void Fl_Cocoa_Window_Driver::make_current()
{
if (make_current_counts > 1) return;
if (make_current_counts) make_current_counts++;
- Fl_X::q_release_context();
+ q_release_context();
Fl_X *i = Fl_X::i(pWindow);
fl_window = i->xid;
Fl_X::set_high_resolution( i->mapped_to_retina() );
@@ -3295,9 +3295,9 @@ void Fl_Cocoa_Window_Driver::make_current()
}
// Give the Quartz context back to the system
-void Fl_X::q_release_context(Fl_X *x) {
+void Fl_Cocoa_Window_Driver::q_release_context(Fl_Cocoa_Window_Driver *x) {
CGContextRef gc = (CGContextRef)Fl_Display_Device::display_device()->driver()->gc();
- if (x && ((Fl_Cocoa_Window_Driver*)x->w->pWindowDriver)->gc != gc) return;
+ if (x && x->shown() && x->gc != gc) return;
if (!gc) return;
CGContextRestoreGState(gc); // match the CGContextSaveGState's of make_current
CGContextRestoreGState(gc);
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
index 3d53e579b..aa23818e6 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
@@ -100,7 +100,7 @@ int Fl_Cocoa_Printer_Driver::start_job (int pagecount, int *frompage, int *topag
{
OSStatus status = 0;
fl_open_display();
- Fl_X::q_release_context();
+ Fl_Cocoa_Window_Driver::q_release_context();
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (fl_mac_os_version >= 100500) {
NSPrintInfo *info = [NSPrintInfo sharedPrintInfo];
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
index 74a5b3301..67e2aa77c 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
@@ -69,6 +69,7 @@ public:
Fl_Cocoa_Window_Driver(Fl_Window*);
~Fl_Cocoa_Window_Driver();
CGContextRef gc; // graphics context
+ static void q_release_context(Fl_Cocoa_Window_Driver *x = 0); // free all resources associated with gc
// --- window data
virtual int decorated_w();
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
index 6f58ccac1..2e49d9dd1 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
@@ -236,7 +236,7 @@ void Fl_Cocoa_Window_Driver::hide() {
// worst case, an invisible pointer
if (ip && !parent()) pWindow->cursor(FL_CURSOR_DEFAULT);
if ( hide_common() ) return;
- Fl_X::q_release_context(ip);
+ q_release_context(this);
if ( ip->xid == fl_window )
fl_window = 0;
if (ip->region) Fl_Graphics_Driver::XDestroyRegion(ip->region);