Reviewers: cromwellian,

Description:
Fix the Chrome plugin to work on a Mac.


Please review this at http://gwt-code-reviews.appspot.com/1844803/

Affected files:
  M plugins/npapi/Makefile
  M plugins/npapi/main.cpp
  M plugins/npapi/npapi/npapi.h
  M plugins/npapi/prebuilt/gwt-dev-plugin/manifest.json


Index: plugins/npapi/Makefile
===================================================================
--- plugins/npapi/Makefile      (revision 11305)
+++ plugins/npapi/Makefile      (working copy)
@@ -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
Index: plugins/npapi/main.cpp
===================================================================
--- plugins/npapi/main.cpp      (revision 11305)
+++ plugins/npapi/main.cpp      (working copy)
@@ -184,6 +184,24 @@
 //    }
     instance->pdata = obj;

+#ifdef __APPLE_CC__
+ // On the Mac, we need to negotiate CoreGraphics and Cocoa even though we don't use it.
+    // 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);
   }
Index: plugins/npapi/npapi/npapi.h
===================================================================
--- plugins/npapi/npapi/npapi.h (revision 11305)
+++ plugins/npapi/npapi/npapi.h (working copy)
@@ -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;

 /*
@@ -485,6 +504,13 @@
   , NPNVsupportsQuickDrawBool = 2000
 #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;

Index: plugins/npapi/prebuilt/gwt-dev-plugin/manifest.json
===================================================================
--- plugins/npapi/prebuilt/gwt-dev-plugin/manifest.json (revision 11305)
+++ plugins/npapi/prebuilt/gwt-dev-plugin/manifest.json (working copy)
@@ -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",


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to