зеркало из 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;
|
||||
@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
|
||||
|
||||
+ (nsCursorManager *) sharedInstance
|
||||
|
@ -216,14 +196,12 @@ static BOOL isPantherOrLater()
|
|||
|
||||
+ (nsMacCursor *) createNSCursor: (SEL) aPantherCursor orThemeCursor: (ThemeCursor) aJaguarCursor
|
||||
{
|
||||
return isPantherOrLater() ? [nsMacCursor cursorWithCursor: [NSCursor performSelector: aPantherCursor]] :
|
||||
[nsMacCursor cursorWithThemeCursor: aJaguarCursor];
|
||||
return [nsMacCursor cursorWithCursor:[NSCursor performSelector:aPantherCursor]];
|
||||
}
|
||||
|
||||
+ (nsMacCursor *) createNSCursor: (SEL) aPantherCursor orImageCursor: (NSString *) aImageName withHotspot: (NSPoint) aPoint
|
||||
{
|
||||
return isPantherOrLater() ? [nsMacCursor cursorWithCursor: [NSCursor performSelector: aPantherCursor]] :
|
||||
[nsMacCursor cursorWithImageNamed: aImageName hotSpot: aPoint];
|
||||
return [nsMacCursor cursorWithCursor:[NSCursor performSelector:aPantherCursor]];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "nsIMenuItem.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsIMenuCommandDispatcher.h"
|
||||
#include "nsToolkit.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
@ -1150,6 +1151,9 @@ static pascal OSStatus MyMenuEventHandler(EventHandlerCallRef myHandler, EventRe
|
|||
else if (kind == kEventMenuOpening || kind == kEventMenuClosed) {
|
||||
if (kind == kEventMenuOpening && gRollupListener != nsnull && gRollupWidget != nsnull) {
|
||||
gRollupListener->Rollup();
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,12 +65,22 @@
|
|||
|
||||
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
|
||||
{
|
||||
public:
|
||||
nsToolkit();
|
||||
virtual ~nsToolkit();
|
||||
|
||||
// Returns the OS X version as returned from
|
||||
// Gestalt(gestaltSystemVersion, ...)
|
||||
static long OSXVersion();
|
||||
|
||||
protected:
|
||||
|
||||
virtual nsresult InitEventQueue(PRThread * aThread);
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
#include "nsToolkit.h"
|
||||
|
||||
#include <Gestalt.h>
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -70,3 +72,18 @@ nsToolkitBase* NS_CreateToolkitInstance()
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче