From 295576f78f20175990bfe15bee1314c4caf186d7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 26 Nov 2016 17:29:27 +0100 Subject: [PATCH] Fix compilation of WebView code in wxOSX with SDK < 10.11 This was broken by 05857e66c0cb2b15e9a6c90dda089c3233c4e865 which introduced dependencies on protocols only declared in 10.11 headers. Fix build by checking if we're using 10.11 SDK and using these protocols only in this case. --- src/html/htmlctrl/webkit/webkit.mm | 12 +++++++++--- src/osx/webview_webkit.mm | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/html/htmlctrl/webkit/webkit.mm b/src/html/htmlctrl/webkit/webkit.mm index 7a7b41a55e..bfd0a466e7 100644 --- a/src/html/htmlctrl/webkit/webkit.mm +++ b/src/html/htmlctrl/webkit/webkit.mm @@ -28,6 +28,12 @@ #define DEBUG_WEBKIT_SIZING 0 +#if defined(MAC_OS_X_VERSION_10_11) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11) + #define wxWEBKIT_PROTOCOL_SINCE_10_11(proto) < proto > +#else + #define wxWEBKIT_PROTOCOL_SINCE_10_11(proto) +#endif + extern WXDLLEXPORT_DATA(const char) wxWebKitCtrlNameStr[] = "webkitctrl"; // ---------------------------------------------------------------------------- @@ -130,7 +136,7 @@ inline int wxNavTypeFromWebNavType(int type){ return wxWEBKIT_NAV_OTHER; } -@interface MyFrameLoadMonitor : NSObject +@interface MyFrameLoadMonitor : NSObject wxWEBKIT_PROTOCOL_SINCE_10_11(WebFrameLoadDelegate) { wxWebKitCtrl* webKitWindow; } @@ -139,7 +145,7 @@ inline int wxNavTypeFromWebNavType(int type){ @end -@interface MyPolicyDelegate : NSObject +@interface MyPolicyDelegate : NSObject wxWEBKIT_PROTOCOL_SINCE_10_11(WebPolicyDelegate) { wxWebKitCtrl* webKitWindow; } @@ -148,7 +154,7 @@ inline int wxNavTypeFromWebNavType(int type){ @end -@interface MyUIDelegate : NSObject +@interface MyUIDelegate : NSObject wxWEBKIT_PROTOCOL_SINCE_10_11(WebUIDelegate) { wxWebKitCtrl* webKitWindow; } diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index 1c8e4f03f9..5eb143ed84 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -41,6 +41,12 @@ #define DEBUG_WEBKIT_SIZING 0 +#if defined(MAC_OS_X_VERSION_10_11) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11) + #define wxWEBKIT_PROTOCOL_SINCE_10_11(proto) < proto > +#else + #define wxWEBKIT_PROTOCOL_SINCE_10_11(proto) +#endif + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -50,7 +56,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView); wxBEGIN_EVENT_TABLE(wxWebViewWebKit, wxControl) wxEND_EVENT_TABLE() -@interface WebViewLoadDelegate : NSObject +@interface WebViewLoadDelegate : NSObject wxWEBKIT_PROTOCOL_SINCE_10_11(WebFrameLoadDelegate) { wxWebViewWebKit* webKitWindow; } @@ -59,7 +65,7 @@ wxEND_EVENT_TABLE() @end -@interface WebViewPolicyDelegate : NSObject +@interface WebViewPolicyDelegate : NSObject wxWEBKIT_PROTOCOL_SINCE_10_11(WebPolicyDelegate) { wxWebViewWebKit* webKitWindow; } @@ -68,7 +74,7 @@ wxEND_EVENT_TABLE() @end -@interface WebViewUIDelegate : NSObject +@interface WebViewUIDelegate : NSObject wxWEBKIT_PROTOCOL_SINCE_10_11(WebUIDelegate) { wxWebViewWebKit* webKitWindow; }