comparison mac/dw.m @ 1939:83148aaa35a5

Mac: Fixed building on Sierra, WKWebKit is undefined even though the docs say it should be supported on 10.10+.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 21 Jun 2019 20:42:08 +0000
parents 5a88fff43d99
children 38a50e0820b1
comparison
equal deleted inserted replaced
1938:5a88fff43d99 1939:83148aaa35a5
50 #define DW_LOCAL_POOL_IN NSAutoreleasePool *localpool = nil; \ 50 #define DW_LOCAL_POOL_IN NSAutoreleasePool *localpool = nil; \
51 if(DWThread != (DWTID)-1 && pthread_self() != DWThread) \ 51 if(DWThread != (DWTID)-1 && pthread_self() != DWThread) \
52 localpool = [[NSAutoreleasePool alloc] init]; 52 localpool = [[NSAutoreleasePool alloc] init];
53 #define DW_LOCAL_POOL_OUT if(localpool) [localpool drain]; 53 #define DW_LOCAL_POOL_OUT if(localpool) [localpool drain];
54 54
55 /* For some reason WKWebView is undefined on some versions that supposed to support it */
56 #ifdef WKWebView
57 #define DWWebView WKWebView
58 #else
59 #define DWWebView WebView
60 #endif
61
55 /* Handle deprecation of several constants in 10.10... 62 /* Handle deprecation of several constants in 10.10...
56 * the replacements are not available in earlier versions. 63 * the replacements are not available in earlier versions.
57 */ 64 */
58 #if defined(MAC_OS_X_VERSION_10_10) && ((defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10) || !defined(MAC_OS_X_VERSION_MAX_ALLOWED)) 65 #if defined(MAC_OS_X_VERSION_10_10) && ((defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10) || !defined(MAC_OS_X_VERSION_MAX_ALLOWED))
59 #define DWModalResponseOK NSModalResponseOK 66 #define DWModalResponseOK NSModalResponseOK
60 #define DWModalResponseCancel NSModalResponseCancel 67 #define DWModalResponseCancel NSModalResponseCancel
61 #define DWPaperOrientationPortrait NSPaperOrientationPortrait 68 #define DWPaperOrientationPortrait NSPaperOrientationPortrait
62 #define DWWebView WKWebView
63 #define BUILDING_FOR_YOSEMITE 69 #define BUILDING_FOR_YOSEMITE
64 #else 70 #else
65 #define DWModalResponseOK NSOKButton 71 #define DWModalResponseOK NSOKButton
66 #define DWModalResponseCancel NSCancelButton 72 #define DWModalResponseCancel NSCancelButton
67 #define DWPaperOrientationPortrait NSPortraitOrientation 73 #define DWPaperOrientationPortrait NSPortraitOrientation
68 #define DWWebView WebView
69 #endif 74 #endif
70 75
71 /* Handle deprecation of several constants in 10.12... 76 /* Handle deprecation of several constants in 10.12...
72 * the replacements are not available in earlier versions. 77 * the replacements are not available in earlier versions.
73 */ 78 */
8179 * 0 on success. 8184 * 0 on success.
8180 */ 8185 */
8181 int API dw_html_raw(HWND handle, char *string) 8186 int API dw_html_raw(HWND handle, char *string)
8182 { 8187 {
8183 DWWebView *html = handle; 8188 DWWebView *html = handle;
8184 #ifdef BUILDING_FOR_YOSEMITE 8189 #ifdef WKWebKit
8185 [html loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; 8190 [html loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil];
8186 #else 8191 #else
8187 [[html mainFrame] loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; 8192 [[html mainFrame] loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil];
8188 #endif 8193 #endif
8189 return 0; 8194 return 0;
8199 * 0 on success. 8204 * 0 on success.
8200 */ 8205 */
8201 int API dw_html_url(HWND handle, char *url) 8206 int API dw_html_url(HWND handle, char *url)
8202 { 8207 {
8203 DWWebView *html = handle; 8208 DWWebView *html = handle;
8204 #ifdef BUILDING_FOR_YOSEMITE 8209 #ifdef WKWebKit
8205 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; 8210 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]];
8206 #else 8211 #else
8207 [[html mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; 8212 [[html mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]];
8208 #endif 8213 #endif
8209 return 0; 8214 return 0;