Fix the Chrome plugin to work on a Mac.
Review at http://gwt-code-reviews.appspot.com/1844803
Review by: cromwellian@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11310 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/plugins/npapi/Makefile b/plugins/npapi/Makefile
index 43ffd22..fa629a4 100644
--- a/plugins/npapi/Makefile
+++ b/plugins/npapi/Makefile
@@ -12,12 +12,17 @@
# License for the specific language governing permissions and limitations under
# the License.
+ifeq ($(shell uname),Darwin)
+# We seem to be using 32-bit plugins on the Mac, so compile this way even if host is 64-bit.
+ARCH=x86
+endif
+
include ../config.mk
ifeq ($(OS),mac)
RUN_PATH_FLAG = -executable_path
DLL_SUFFIX = .dylib
-DLLFLAGS = -bundle $(ARCHCFLAGS) -mmacosx-version-min=10.5
+DLLFLAGS = -bundle $(ARCHCFLAGS) -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
CFLAGS += -DXP_MACOSX $(ARCHCFLAGS)
CXXFLAGS += -DXP_MACOSX $(ARCHCFLAGS)
# Mac puts multiple architectures into the same files
@@ -120,7 +125,7 @@
$(CXX) $(CXXFLAGS) -c -o $@ -I. -I../common $<
common $(COMMON):
- (cd ../common && $(MAKE))
+ (cd ../common && ARCH=$(ARCH) $(MAKE))
clean:
rm -rf build
diff --git a/plugins/npapi/main.cpp b/plugins/npapi/main.cpp
index e292b87..0fb5b61 100644
--- a/plugins/npapi/main.cpp
+++ b/plugins/npapi/main.cpp
@@ -184,6 +184,31 @@
// }
instance->pdata = obj;
+#ifdef __APPLE_CC__
+ // On the Mac, we need to negotiate CoreGraphics and Cocoa even though
+ // we don't use them.
+ // See: http://code.google.com/p/chromium/issues/detail?id=134761
+
+ // select the right drawing model if necessary
+ NPBool supportsCoreGraphics = false;
+ if (browser->getvalue(instance, NPNVsupportsCoreGraphicsBool,
+ &supportsCoreGraphics) == NPERR_NO_ERROR && supportsCoreGraphics) {
+
+ browser->setvalue(instance, NPPVpluginDrawingModel,
+ (void*)NPDrawingModelCoreGraphics);
+ }
+
+ // select the Cocoa event model
+ NPBool supportsCocoaEvents = false;
+ if (browser->getvalue(instance, NPNVsupportsCocoaBool,
+ &supportsCocoaEvents) == NPERR_NO_ERROR && supportsCocoaEvents) {
+
+ browser->setvalue(instance, NPPVpluginEventModel,
+ (void*)NPEventModelCocoa);
+ }
+
+#endif
+
// Make this a windowless plugin.
return NPN_SetValue(instance, NPPVpluginWindowBool, NULL);
}
diff --git a/plugins/npapi/npapi/npapi.h b/plugins/npapi/npapi/npapi.h
index dc37367..cca69c3 100644
--- a/plugins/npapi/npapi/npapi.h
+++ b/plugins/npapi/npapi/npapi.h
@@ -258,6 +258,16 @@
} NPDrawingModel;
#endif
+// copied from newer npapi.h - skybrian
+#ifdef XP_MACOSX
+typedef enum {
+#ifndef NP_NO_CARBON
+ NPEventModelCarbon = 0,
+#endif
+ NPEventModelCocoa = 1
+} NPEventModel;
+#endif
+
typedef unsigned char NPBool;
typedef int16 NPError;
typedef int16 NPReason;
@@ -450,6 +460,15 @@
/* Used for negotiating drawing models */
, NPPVpluginDrawingModel = 1000
#endif
+
+ // copied from newer npapi.h - skybrian
+#if defined(XP_MACOSX)
+ /* Used for negotiating event models */
+ , NPPVpluginEventModel = 1001
+ /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
+ , NPPVpluginCoreAnimationLayer = 1003
+#endif
+
} NPPVariable;
/*
@@ -486,6 +505,13 @@
#endif
, NPNVsupportsCoreGraphicsBool = 2001
#endif
+ // Copied from newer npapi - skybrian
+#if defined(XP_MACOSX)
+#ifndef NP_NO_CARBON
+ , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
+#endif
+ , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
+#endif
} NPNVariable;
/*
diff --git a/plugins/npapi/prebuilt/gwt-dev-plugin/Darwin-gcc3/gwtDev.plugin/Contents/MacOS/libGwtDevPlugin.dylib b/plugins/npapi/prebuilt/gwt-dev-plugin/Darwin-gcc3/gwtDev.plugin/Contents/MacOS/libGwtDevPlugin.dylib
index b089cef..0ce4079 100755
--- a/plugins/npapi/prebuilt/gwt-dev-plugin/Darwin-gcc3/gwtDev.plugin/Contents/MacOS/libGwtDevPlugin.dylib
+++ b/plugins/npapi/prebuilt/gwt-dev-plugin/Darwin-gcc3/gwtDev.plugin/Contents/MacOS/libGwtDevPlugin.dylib
Binary files differ
diff --git a/plugins/npapi/prebuilt/gwt-dev-plugin/manifest.json b/plugins/npapi/prebuilt/gwt-dev-plugin/manifest.json
index 53a6a1a..ec25f33 100644
--- a/plugins/npapi/prebuilt/gwt-dev-plugin/manifest.json
+++ b/plugins/npapi/prebuilt/gwt-dev-plugin/manifest.json
@@ -1,6 +1,6 @@
{
"name": "GWT Developer Plugin",
- "version": "1.0.11303",
+ "version": "1.0.11305",
"manifest_version": 2,
"description": "A plugin to enable debugging with GWT's Development Mode",