mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Various 64-bit fixes for Mac OS X widget and plugin code. b=509947 r=mstange
This commit is contained in:
parent
86b1e0bafb
commit
a62bb5d726
@ -508,18 +508,24 @@ nsNPAPIPlugin::CreatePlugin(const char* aFilePath, PRLibrary* aLibrary,
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#ifndef __LP64__
|
||||
short appRefNum = ::CurResFile();
|
||||
short pluginRefNum;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsILocalFile> pluginPath;
|
||||
NS_NewNativeLocalFile(nsDependentCString(aFilePath), PR_TRUE,
|
||||
getter_AddRefs(pluginPath));
|
||||
|
||||
nsPluginFile pluginFile(pluginPath);
|
||||
|
||||
#ifndef __LP64__
|
||||
pluginRefNum = pluginFile.OpenPluginResource();
|
||||
#endif
|
||||
|
||||
nsNPAPIPlugin* plugin = new nsNPAPIPlugin(nsnull, aLibrary, nsnull);
|
||||
#ifndef __LP64__
|
||||
::UseResFile(appRefNum);
|
||||
#endif
|
||||
if (!plugin)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -531,8 +537,10 @@ nsNPAPIPlugin::CreatePlugin(const char* aFilePath, PRLibrary* aLibrary,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifndef __LP64__
|
||||
plugin->SetPluginRefNum(pluginRefNum);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef XP_BEOS
|
||||
// I just copied UNIX version.
|
||||
@ -2110,8 +2118,7 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
|
||||
#ifdef XP_MACOSX
|
||||
case NPPVpluginDrawingModel: {
|
||||
if (inst) {
|
||||
int dModelValue = (int)result;
|
||||
inst->SetDrawingModel((NPDrawingModel)dModelValue);
|
||||
inst->SetDrawingModel((NPDrawingModel)NS_PTR_TO_INT32(result));
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
else {
|
||||
|
@ -305,6 +305,7 @@ static char* GetNextPluginStringFromHandle(Handle h, short *index)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef __LP64__
|
||||
static char* GetPluginString(short id, short index)
|
||||
{
|
||||
Str255 str;
|
||||
@ -359,6 +360,7 @@ public:
|
||||
private:
|
||||
short mRefNum;
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Obtains all of the information currently available for this plugin.
|
||||
@ -372,9 +374,12 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||
|
||||
// First open up resource we can use to get plugin info.
|
||||
|
||||
#ifndef __LP64__
|
||||
// Try to open a resource fork.
|
||||
nsAutoCloseResourceObject resourceObject(mPlugin);
|
||||
bool resourceOpened = resourceObject.ResourceOpened();
|
||||
#endif
|
||||
|
||||
// Try to get a bundle reference.
|
||||
nsCAutoString path;
|
||||
if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
|
||||
@ -400,10 +405,12 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||
if (name && ::CFGetTypeID(name) == ::CFStringGetTypeID())
|
||||
info.fName = CFStringRefToUTF8Buffer(static_cast<CFStringRef>(name));
|
||||
}
|
||||
#ifndef __LP64__
|
||||
if (!info.fName && resourceOpened) {
|
||||
// 'STR#', 126, 2 => plugin name.
|
||||
info.fName = GetPluginString(126, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get fDescription
|
||||
if (bundle) {
|
||||
@ -411,10 +418,12 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||
if (description && ::CFGetTypeID(description) == ::CFStringGetTypeID())
|
||||
info.fDescription = CFStringRefToUTF8Buffer(static_cast<CFStringRef>(description));
|
||||
}
|
||||
#ifndef __LP64__
|
||||
if (!info.fDescription && resourceOpened) {
|
||||
// 'STR#', 126, 1 => plugin description.
|
||||
info.fDescription = GetPluginString(126, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get fVersion
|
||||
if (bundle) {
|
||||
@ -465,6 +474,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __LP64__
|
||||
// Try to get data from the resource fork
|
||||
if (!info.fVariantCount && resourceObject.ResourceOpened()) {
|
||||
mi.typeStrings = ::Get1Resource('STR#', 128);
|
||||
@ -483,6 +493,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||
::HLock(mi.infoStrings);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Fill in the info struct based on the data in the BPSupportedMIMETypes struct
|
||||
int variantCount = info.fVariantCount;
|
||||
|
@ -382,7 +382,7 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect &aRect,
|
||||
contentRect.origin.y -= (newWindowFrame.size.height - aRect.size.height);
|
||||
|
||||
if (mWindowType != eWindowType_popup)
|
||||
contentRect.origin.y -= ::GetMBarHeight();
|
||||
contentRect.origin.y -= [[NSApp mainMenu] menuBarHeight];
|
||||
}
|
||||
|
||||
// NSLog(@"Top-level window being created at Cocoa rect: %f, %f, %f, %f\n",
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
NS_DECL_NSITOOLKIT
|
||||
|
||||
// Returns the OS X version as returned from Gestalt(gestaltSystemVersion, ...)
|
||||
static long OSXVersion();
|
||||
static PRInt32 OSXVersion();
|
||||
|
||||
// Convenience functions to check the OS version
|
||||
static PRBool OnLeopardOrLater();
|
||||
|
@ -381,15 +381,15 @@ NS_IMETHODIMP NS_GetCurrentToolkit(nsIToolkit* *aResult)
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
long nsToolkit::OSXVersion()
|
||||
PRInt32 nsToolkit::OSXVersion()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
static long gOSXVersion = 0x0;
|
||||
static PRInt32 gOSXVersion = 0x0;
|
||||
if (gOSXVersion == 0x0) {
|
||||
OSErr err = ::Gestalt(gestaltSystemVersion, &gOSXVersion);
|
||||
OSErr err = ::Gestalt(gestaltSystemVersion, (SInt32*)&gOSXVersion);
|
||||
if (err != noErr) {
|
||||
//This should probably be changed when our minimum version changes
|
||||
// This should probably be changed when our minimum version changes
|
||||
NS_ERROR("Couldn't determine OS X version, assuming 10.4");
|
||||
gOSXVersion = MAC_OS_X_VERSION_10_4_HEX;
|
||||
}
|
||||
@ -441,9 +441,13 @@ nsresult nsToolkit::SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
|
||||
if (!original || !posed)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef __LP64__
|
||||
method_exchangeImplementations(original, posed);
|
||||
#else
|
||||
IMP aMethodImp = original->method_imp;
|
||||
original->method_imp = posed->method_imp;
|
||||
posed->method_imp = aMethodImp;
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user