Mercurial > dwindows
comparison mac/dw.m @ 1952:8ce5c562348f
Mac: Attempting a better WKWebKit fix, use the WK_API_ENABLED constant to determine if the API is available.
Apparently it is only available on intel 64bit regardless of the system version. Use the old API on 32bit
or older systems.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 11 Jul 2019 21:40:33 +0000 |
parents | e30164bc48fb |
children | 77d156c3f01c |
comparison
equal
deleted
inserted
replaced
1951:e30164bc48fb | 1952:8ce5c562348f |
---|---|
149 /* Handle deprecation of several constants in 10.14... | 149 /* Handle deprecation of several constants in 10.14... |
150 * the replacements are not available in earlier versions. | 150 * the replacements are not available in earlier versions. |
151 */ | 151 */ |
152 #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)) | 152 #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)) |
153 #define DWProgressIndicatorStyleBar NSProgressIndicatorStyleBar | 153 #define DWProgressIndicatorStyleBar NSProgressIndicatorStyleBar |
154 #define DWWebView WKWebView | |
155 #define BUILDING_FOR_MOJAVE | 154 #define BUILDING_FOR_MOJAVE |
156 #else | 155 #else |
157 #define DWProgressIndicatorStyleBar NSProgressIndicatorBarStyle | 156 #define DWProgressIndicatorStyleBar NSProgressIndicatorBarStyle |
157 #endif | |
158 | |
159 /* Apparently the WKWebKit API is only enabled on intel 64bit... | |
160 * Causing build failures on 32bit builds, so this should allow | |
161 * WKWebKit on intel 64 and the old WebKit on intel 32 bit and earlier. | |
162 */ | |
163 #if WK_API_ENABLED | |
164 #define DWWebView WKWebView | |
165 #else | |
158 #define DWWebView WebView | 166 #define DWWebView WebView |
159 #endif | 167 #endif |
160 | 168 |
161 unsigned long _colors[] = | 169 unsigned long _colors[] = |
162 { | 170 { |
8277 * 0 on success. | 8285 * 0 on success. |
8278 */ | 8286 */ |
8279 int API dw_html_raw(HWND handle, char *string) | 8287 int API dw_html_raw(HWND handle, char *string) |
8280 { | 8288 { |
8281 DWWebView *html = handle; | 8289 DWWebView *html = handle; |
8282 #ifdef BUILDING_FOR_MOJAVE | 8290 #if WK_API_ENABLED |
8283 [html loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; | 8291 [html loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; |
8284 #else | 8292 #else |
8285 [[html mainFrame] loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; | 8293 [[html mainFrame] loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; |
8286 #endif | 8294 #endif |
8287 return 0; | 8295 return 0; |
8297 * 0 on success. | 8305 * 0 on success. |
8298 */ | 8306 */ |
8299 int API dw_html_url(HWND handle, char *url) | 8307 int API dw_html_url(HWND handle, char *url) |
8300 { | 8308 { |
8301 DWWebView *html = handle; | 8309 DWWebView *html = handle; |
8302 #ifdef BUILDING_FOR_MOJAVE | 8310 #if WK_API_ENABLED |
8303 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; | 8311 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; |
8304 #else | 8312 #else |
8305 [[html mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; | 8313 [[html mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; |
8306 #endif | 8314 #endif |
8307 return 0; | 8315 return 0; |