Bug 729246: Fix clang warnings in Cocoa widgets. r=smichaud

This commit is contained in:
Josh Aas 2012-02-21 20:44:40 -05:00
parent be847bb9bd
commit 9179ab11a7
7 changed files with 30 additions and 22 deletions

View File

@ -298,8 +298,8 @@ static const nsCursor sCustomCursor = eCursorCount;
}
// if the hotspot is nonsensical, make it 0,0
aHotspotX = (aHotspotX < 0 || aHotspotX > (PRUint32) width - 1) ? 0 :aHotspotX;
aHotspotY = (aHotspotY < 0 || aHotspotY > (PRUint32) height - 1) ? 0 :aHotspotY;
aHotspotX = (aHotspotX > (PRUint32)width - 1) ? 0 : aHotspotX;
aHotspotY = (aHotspotY > (PRUint32)height - 1) ? 0 : aHotspotY;
NSPoint hotSpot = ::NSMakePoint(aHotspotX, aHotspotY);
[self setMacCursor:[nsMacCursor cursorWithCursor:[[NSCursor alloc] initWithImage:cursorImage hotSpot:hotSpot] type:sCustomCursor]];

View File

@ -44,6 +44,9 @@ class nsIdleServiceX : public nsIdleService
public:
NS_DECL_ISUPPORTS
nsIdleServiceX() {}
virtual ~nsIdleServiceX() {}
bool PollIdleTime(PRUint32* aIdleTime);
protected:

View File

@ -566,6 +566,8 @@ nsLookAndFeel::GetFontImpl(FontID aID, nsString &aFontName,
case eFont_Widget:
font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
break;
default:
break;
}
if (!font) {

View File

@ -59,6 +59,10 @@ class nsNativeMenuServiceX : public nsINativeMenuService
{
public:
NS_DECL_ISUPPORTS
nsNativeMenuServiceX() {}
virtual ~nsNativeMenuServiceX() {}
NS_IMETHOD CreateNativeMenuBar(nsIWidget* aParent, nsIContent* aMenuBarNode);
};

View File

@ -60,7 +60,7 @@ public:
nsIContent* aContent,
NSMenuItem* aNativeMenuItem);
private:
~nsMenuItemIconX();
virtual ~nsMenuItemIconX();
public:
NS_DECL_ISUPPORTS

View File

@ -1859,12 +1859,12 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
break;
case NS_THEME_MENUPOPUP: {
HIThemeMenuDrawInfo mdi = {
version: 0,
menuType: IsDisabled(aFrame, eventState) ?
static_cast<ThemeMenuType>(kThemeMenuTypeInactive) :
static_cast<ThemeMenuType>(kThemeMenuTypePopUp)
};
HIThemeMenuDrawInfo mdi;
memset(&mdi, 0, sizeof(mdi));
mdi.version = 0;
mdi.menuType = IsDisabled(aFrame, eventState) ?
static_cast<ThemeMenuType>(kThemeMenuTypeInactive) :
static_cast<ThemeMenuType>(kThemeMenuTypePopUp);
bool isLeftOfParent = false;
if (IsSubmenu(aFrame, &isLeftOfParent) && !isLeftOfParent) {
@ -1883,14 +1883,15 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
CGContextClearRect(cgContext, macRect);
// maybe use kThemeMenuItemHierBackground or PopUpBackground instead of just Plain?
HIThemeMenuItemDrawInfo drawInfo = {
version: 0,
itemType: kThemeMenuItemPlain,
state: (IsDisabled(aFrame, eventState) ? static_cast<ThemeMenuState>(kThemeMenuDisabled) :
CheckBooleanAttr(aFrame, nsGkAtoms::menuactive) ?
static_cast<ThemeMenuState>(kThemeMenuSelected) :
static_cast<ThemeMenuState>(kThemeMenuActive))
};
HIThemeMenuItemDrawInfo drawInfo;
memset(&drawInfo, 0, sizeof(drawInfo));
drawInfo.version = 0;
drawInfo.itemType = kThemeMenuItemPlain;
drawInfo.state = (IsDisabled(aFrame, eventState) ?
static_cast<ThemeMenuState>(kThemeMenuDisabled) :
CheckBooleanAttr(aFrame, nsGkAtoms::menuactive) ?
static_cast<ThemeMenuState>(kThemeMenuSelected) :
static_cast<ThemeMenuState>(kThemeMenuActive));
// XXX pass in the menu rect instead of always using the item rect
HIRect ignored;

View File

@ -49,17 +49,15 @@
class nsScreenManagerCocoa : public nsIScreenManager
{
public:
nsScreenManagerCocoa ();
~nsScreenManagerCocoa ();
nsScreenManagerCocoa();
virtual ~nsScreenManagerCocoa();
NS_DECL_ISUPPORTS
NS_DECL_NSISCREENMANAGER
private:
nsScreenCocoa *ScreenForCocoaScreen (NSScreen *screen);
nsScreenCocoa *ScreenForCocoaScreen(NSScreen *screen);
nsTArray< nsRefPtr<nsScreenCocoa> > mScreenList;
};