зеркало из https://github.com/mozilla/gecko-dev.git
crashes clicking on menubar while popup displayed (OS X 10.3 only) [@ FadeMenuWindows]. cocoa widgets fix. b=351230 r=mento
This commit is contained in:
Родитель
cbc835c248
Коммит
c7d84bb473
|
@ -84,26 +84,6 @@ static nsCursorManager *gInstance;
|
||||||
+ (nsMacCursor *) createNSCursor: (SEL) aPantherCursor orImageCursor: (NSString *) aImageName withHotspot: (NSPoint) aPoint;
|
+ (nsMacCursor *) createNSCursor: (SEL) aPantherCursor orImageCursor: (NSString *) aImageName withHotspot: (NSPoint) aPoint;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*! @function isPantherOrLater
|
|
||||||
@abstract Determine whether we are running on Panther (Mac OS X 10.3) or later
|
|
||||||
@result YES if the current operating system version is 10.3 or later, else NO
|
|
||||||
*/
|
|
||||||
static BOOL isPantherOrLater();
|
|
||||||
|
|
||||||
static BOOL isPantherOrLater()
|
|
||||||
{
|
|
||||||
static PRBool gInitVer = PR_FALSE;
|
|
||||||
static PRBool gOnPantherOrLater = PR_FALSE;
|
|
||||||
if(!gInitVer)
|
|
||||||
{
|
|
||||||
long version;
|
|
||||||
OSErr err = ::Gestalt(gestaltSystemVersion, &version);
|
|
||||||
gOnPantherOrLater = (err == noErr && version >= 0x00001030);
|
|
||||||
gInitVer = PR_TRUE;
|
|
||||||
}
|
|
||||||
return gOnPantherOrLater;
|
|
||||||
}
|
|
||||||
|
|
||||||
@implementation nsCursorManager
|
@implementation nsCursorManager
|
||||||
|
|
||||||
+ (nsCursorManager *) sharedInstance
|
+ (nsCursorManager *) sharedInstance
|
||||||
|
@ -216,14 +196,12 @@ static BOOL isPantherOrLater()
|
||||||
|
|
||||||
+ (nsMacCursor *) createNSCursor: (SEL) aPantherCursor orThemeCursor: (ThemeCursor) aJaguarCursor
|
+ (nsMacCursor *) createNSCursor: (SEL) aPantherCursor orThemeCursor: (ThemeCursor) aJaguarCursor
|
||||||
{
|
{
|
||||||
return isPantherOrLater() ? [nsMacCursor cursorWithCursor: [NSCursor performSelector: aPantherCursor]] :
|
return [nsMacCursor cursorWithCursor:[NSCursor performSelector:aPantherCursor]];
|
||||||
[nsMacCursor cursorWithThemeCursor: aJaguarCursor];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (nsMacCursor *) createNSCursor: (SEL) aPantherCursor orImageCursor: (NSString *) aImageName withHotspot: (NSPoint) aPoint
|
+ (nsMacCursor *) createNSCursor: (SEL) aPantherCursor orImageCursor: (NSString *) aImageName withHotspot: (NSPoint) aPoint
|
||||||
{
|
{
|
||||||
return isPantherOrLater() ? [nsMacCursor cursorWithCursor: [NSCursor performSelector: aPantherCursor]] :
|
return [nsMacCursor cursorWithCursor:[NSCursor performSelector:aPantherCursor]];
|
||||||
[nsMacCursor cursorWithImageNamed: aImageName hotSpot: aPoint];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include "nsIMenuItem.h"
|
#include "nsIMenuItem.h"
|
||||||
#include "nsIMenuListener.h"
|
#include "nsIMenuListener.h"
|
||||||
#include "nsIMenuCommandDispatcher.h"
|
#include "nsIMenuCommandDispatcher.h"
|
||||||
|
#include "nsToolkit.h"
|
||||||
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
|
@ -1150,7 +1151,10 @@ static pascal OSStatus MyMenuEventHandler(EventHandlerCallRef myHandler, EventRe
|
||||||
else if (kind == kEventMenuOpening || kind == kEventMenuClosed) {
|
else if (kind == kEventMenuOpening || kind == kEventMenuClosed) {
|
||||||
if (kind == kEventMenuOpening && gRollupListener != nsnull && gRollupWidget != nsnull) {
|
if (kind == kEventMenuOpening && gRollupListener != nsnull && gRollupWidget != nsnull) {
|
||||||
gRollupListener->Rollup();
|
gRollupListener->Rollup();
|
||||||
return userCanceledErr;
|
// We can only return userCanceledErr on Tiger or later because it crashes on Panther.
|
||||||
|
// See bug 351230.
|
||||||
|
if (nsToolkit::OSXVersion() >= MAC_OS_X_VERSION_10_4_HEX)
|
||||||
|
return userCanceledErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsISupports* supports = reinterpret_cast<nsISupports*>(userData);
|
nsISupports* supports = reinterpret_cast<nsISupports*>(userData);
|
||||||
|
|
|
@ -65,11 +65,21 @@
|
||||||
|
|
||||||
struct PRThread;
|
struct PRThread;
|
||||||
|
|
||||||
|
#define MAC_OS_X_VERSION_10_0_HEX 0x00001000
|
||||||
|
#define MAC_OS_X_VERSION_10_1_HEX 0x00001010
|
||||||
|
#define MAC_OS_X_VERSION_10_2_HEX 0x00001020
|
||||||
|
#define MAC_OS_X_VERSION_10_3_HEX 0x00001030
|
||||||
|
#define MAC_OS_X_VERSION_10_4_HEX 0x00001040
|
||||||
|
|
||||||
class nsToolkit : public nsToolkitBase
|
class nsToolkit : public nsToolkitBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsToolkit();
|
nsToolkit();
|
||||||
virtual ~nsToolkit();
|
virtual ~nsToolkit();
|
||||||
|
|
||||||
|
// Returns the OS X version as returned from
|
||||||
|
// Gestalt(gestaltSystemVersion, ...)
|
||||||
|
static long OSXVersion();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
#include "nsToolkit.h"
|
#include "nsToolkit.h"
|
||||||
|
|
||||||
|
#include <Gestalt.h>
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -70,3 +72,18 @@ nsToolkitBase* NS_CreateToolkitInstance()
|
||||||
{
|
{
|
||||||
return new nsToolkit();
|
return new nsToolkit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
long nsToolkit::OSXVersion()
|
||||||
|
{
|
||||||
|
static long gOSXVersion = 0x0;
|
||||||
|
if (gOSXVersion == 0x0) {
|
||||||
|
OSErr err = ::Gestalt(gestaltSystemVersion, &gOSXVersion);
|
||||||
|
if (err != noErr) {
|
||||||
|
NS_ERROR("Couldn't determine OS X version, assuming 10.3");
|
||||||
|
gOSXVersion = MAC_OS_X_VERSION_10_3_HEX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gOSXVersion;
|
||||||
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче