From 62f9813e4ed6a001848d3c31b72f3d48d48df774 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 31 Mar 2016 05:01:22 +0000 Subject: Fix error with PostScript driver on the Mac platform. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11481 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Widget_Surface.cxx | 6 ++++-- src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Fl_Widget_Surface.cxx b/src/Fl_Widget_Surface.cxx index 1453b9447..3d557cdde 100644 --- a/src/Fl_Widget_Surface.cxx +++ b/src/Fl_Widget_Surface.cxx @@ -180,8 +180,10 @@ int Fl_Widget_Surface::printable_rect(int *w, int *h) {return 1;} */ void Fl_Widget_Surface::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset) { - Fl_Shared_Image *top, *left, *bottom, *right; - win->driver()->capture_titlebar_and_borders(top, left, bottom, right); + Fl_Shared_Image *top=0, *left=0, *bottom=0, *right=0; + if (win->border() && !win->parent()) { + win->driver()->capture_titlebar_and_borders(top, left, bottom, right); + } int wsides = left ? left->w() : 0; int toph = top ? top->h() : 0; if (top) { diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index 9f0b497ff..c202da51f 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -98,6 +98,7 @@ void Fl_Cocoa_Window_Driver::flush_overlay() void Fl_Cocoa_Window_Driver::draw_begin() { + if (!Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) return; CGContextRef gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); if (shape_data_) { # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 @@ -118,8 +119,7 @@ void Fl_Cocoa_Window_Driver::draw_end() { // on OS X, windows have no frame. Before OS X 10.7, to resize a window, we drag the lower right // corner. This code draws a little ribbed triangle for dragging. - CGContextRef gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); - if (fl_mac_os_version < 100700 && gc && !parent() && pWindow->resizable() && + if (fl_mac_os_version < 100700 && !parent() && pWindow->resizable() && (!size_range_set() || minh() != maxh() || minw() != maxw())) { int dx = Fl::box_dw(pWindow->box())-Fl::box_dx(pWindow->box()); int dy = Fl::box_dh(pWindow->box())-Fl::box_dy(pWindow->box()); @@ -139,7 +139,10 @@ void Fl_Cocoa_Window_Driver::draw_end() } } # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - if (shape_data_) CGContextRestoreGState(gc); + if (Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) { + CGContextRef gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); + if (shape_data_) CGContextRestoreGState(gc); + } # endif } -- cgit v1.2.3