# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1561233015 0 # Node ID b498fb0360fccc0c0f9b995d5e8b17e86105f839 # Parent 38a50e0820b193bff7dd435e68b1d6278f575343 Mac: 10.14 seems to have drastically changed the drawing mechanism. Disable video memory and flush window code when building for Mojave. diff -r 38a50e0820b1 -r b498fb0360fc mac/dw.m --- a/mac/dw.m Fri Jun 21 22:07:30 2019 +0000 +++ b/mac/dw.m Sat Jun 22 19:50:15 2019 +0000 @@ -150,9 +150,11 @@ * the replacements are not available in earlier versions. */ #if defined(MAC_OS_X_VERSION_10_14) && ((defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14) || !defined(MAC_OS_X_VERSION_MAX_ALLOWED)) +#define DWProgressIndicatorStyleBar NSProgressIndicatorStyleBar #define DWWebView WKWebView #define BUILDING_FOR_MOJAVE #else +#define DWProgressIndicatorStyleBar NSProgressIndicatorBarStyle #define DWWebView WebView #endif @@ -452,7 +454,9 @@ exp.width = rect.size.width; exp.height = rect.size.height; int result = exposefunc(object, &exp, handler->data); +#ifndef BUILDING_FOR_MOJAVE [[object window] flushWindow]; +#endif return result; } /* Clicked event for buttons and menu items */ @@ -624,6 +628,8 @@ atStart:NO]; } +NSGraphicsContext *_dw_draw_context(NSBitmapImageRep *image); + /* Used for doing bitblts from the main thread */ typedef struct _bitbltinfo { @@ -688,8 +694,7 @@ if([bltdest isMemberOfClass:[NSBitmapImageRep class]]) { [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:[NSGraphicsContext - graphicsContextWithGraphicsPort:[[NSGraphicsContext graphicsContextWithBitmapImageRep:bltdest] graphicsPort] flipped:YES]]; + [NSGraphicsContext setCurrentContext:_dw_draw_context(bltdest)]; [[[NSDictionary alloc] initWithObjectsAndKeys:bltdest, NSGraphicsContextDestinationAttributeName, nil] autorelease]; } else @@ -745,12 +750,14 @@ } -(void)doFlush:(id)param { +#ifndef BUILDING_FOR_MOJAVE if(_DWLastDrawable) { id object = _DWLastDrawable; NSWindow *window = [object window]; [window flushWindow]; } +#endif } -(void)doWindowFunc:(id)param { @@ -2888,13 +2895,19 @@ DWRender *render = (DWRender *)handle; NSSize oldsize = [render size]; NSSize newsize = [render frame].size; + + /* The 10.14 appkit warns this property does nothing... not sure + * how long that has been the case but just removing it for Mojave. + */ +#ifndef BUILDING_FOR_MOJAVE NSWindow *window = [render window]; - + if([window preferredBackingLocation] != NSWindowBackingLocationVideoMemory) { [window setPreferredBackingLocation:NSWindowBackingLocationVideoMemory]; } - +#endif + /* Eliminate duplicate configure requests */ if(oldsize.width != newsize.width || oldsize.height != newsize.height) { @@ -4836,7 +4849,9 @@ { scrollbar = [[DWScrollbar alloc] initWithFrame:NSMakeRect(0,0,100,5)]; } +#ifndef BUILDING_FOR_YOSEMITE [scrollbar setArrowsPosition:NSScrollerArrowsDefaultSetting]; +#endif [scrollbar setRange:0.0 andVisible:0.0]; [scrollbar setKnobProportion:1.0]; [scrollbar setTarget:scrollbar]; @@ -9678,7 +9693,9 @@ DWWindow *window = handle; [window setRedraw:YES]; [[window contentView] showWindow]; +#ifndef BUILDING_FOR_MOJAVE [window flushWindow]; +#endif [window setRedraw:NO]; }