mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
235581 fix warnings in widget/src/mac
patch by Ludovic Hirlimann <qa-mozilla@hirlimann.net> r=pinkerton sr=sfraser
This commit is contained in:
parent
b92f4b21e5
commit
e76b1a5a6c
@ -363,7 +363,7 @@ nsClipboard :: GetNativeClipboardData ( nsITransferable * aTransferable, PRInt32
|
||||
loadResult = GetDataOffClipboard ( 'styl', &clipboardData, &dataSize );
|
||||
if (NS_SUCCEEDED(loadResult) &&
|
||||
clipboardData &&
|
||||
(dataSize >= (sizeof(ScrpSTElement) + 2))) {
|
||||
((PRUint32)dataSize >= (sizeof(ScrpSTElement) + 2))) {
|
||||
StScrpRec *scrpRecP = (StScrpRec *) clipboardData;
|
||||
ScrpSTElement *styl = scrpRecP->scrpStyleTab;
|
||||
ScriptCode script = styl ? ::FontToScript(styl->scrpFont) : smCurrentScript;
|
||||
@ -475,8 +475,6 @@ nsClipboard :: GetDataOffClipboard ( ResType inMacFlavor, void** outData, PRInt3
|
||||
if ( outDataSize )
|
||||
*outDataSize = 0;
|
||||
|
||||
// check if it is on the clipboard
|
||||
long offsetUnused = 0;
|
||||
|
||||
#if TARGET_CARBON
|
||||
ScrapRef scrap;
|
||||
@ -630,7 +628,7 @@ nsClipboard :: CheckIfFlavorPresent ( ResType inMacFlavor )
|
||||
if ( flavorList ) {
|
||||
err = ::GetScrapFlavorInfoList ( scrap, &flavorCount, flavorList );
|
||||
if ( !err && flavorList ) {
|
||||
for ( int i = 0; i < flavorCount; ++i ) {
|
||||
for ( unsigned int i = 0; i < flavorCount; ++i ) {
|
||||
if ( flavorList[i].flavorType == inMacFlavor )
|
||||
retval = PR_TRUE;
|
||||
}
|
||||
|
@ -273,8 +273,8 @@ nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode, nsISupportsArray * aTran
|
||||
// see it if you're paying attention, but who pays such close attention?
|
||||
Rect dragRect;
|
||||
::GetRegionBounds(theDragRgn, &dragRect);
|
||||
theEvent.where.v = rint(dragRect.top + (dragRect.bottom - dragRect.top) / 2);
|
||||
theEvent.where.h = rint(dragRect.left + (dragRect.right - dragRect.left) / 2);
|
||||
theEvent.where.v = dragRect.top + ((dragRect.bottom - dragRect.top) / 2);
|
||||
theEvent.where.h = dragRect.left + ((dragRect.right - dragRect.left) / 2);
|
||||
|
||||
// register drag send proc which will call us back when asked for the actual
|
||||
// flavor data (instead of placing it all into the drag manager)
|
||||
@ -548,7 +548,7 @@ nsDragService::GetData ( nsITransferable * aTransferable, PRUint32 aItemIndex )
|
||||
FlavorFlags unused;
|
||||
PRBool dataFound = PR_FALSE;
|
||||
void* dataBuff = nsnull;
|
||||
PRInt32 dataSize = 0;
|
||||
PRUint32 dataSize = 0;
|
||||
if ( macOSFlavor && ::GetFlavorFlags(mDragRef, itemRef, macOSFlavor, &unused) == noErr ) {
|
||||
nsresult loadResult = ExtractDataFromOS(mDragRef, itemRef, macOSFlavor, &dataBuff, &dataSize);
|
||||
if ( NS_SUCCEEDED(loadResult) && dataBuff )
|
||||
|
@ -203,7 +203,7 @@ void nsFilePicker::HandleShowPopupMenuSelect(NavCBRecPtr callBackParms)
|
||||
{ // Special case Nav Services prior to 2.0
|
||||
// Make sure the menu item selected was one of ours
|
||||
if ((menuItemSpec.menuType != menuItemSpec.menuCreator) ||
|
||||
(menuItemSpec.menuType < mTypeOffset) ||
|
||||
((PRInt32)menuItemSpec.menuType < mTypeOffset) ||
|
||||
(menuItemSpec.menuType > numMenuItems))
|
||||
{ // Doesn't appear to be one of our items selected so force it to be
|
||||
NavMenuItemSpec menuItem;
|
||||
|
@ -2398,7 +2398,7 @@ nsresult nsMacEventHandler::UnicodeHandleUpdateInputArea(const PRUnichar* text,
|
||||
// so instead we iterate over the range list and map each range individually. it's probably faster than
|
||||
// trying to do collapse all the ranges into a single offset list
|
||||
//
|
||||
PRUint32 i;
|
||||
PRInt32 i;
|
||||
for(i = 0; i < rangeArray->fNumOfRanges; i++) {
|
||||
// 2.2.2.1 check each range item in NS_ASSERTION
|
||||
NS_ASSERTION(
|
||||
|
@ -156,40 +156,6 @@ extern nsIWidget * gRollupWidget;
|
||||
#endif //DEBUG
|
||||
|
||||
|
||||
//======================================================================================
|
||||
|
||||
static Boolean KeyDown(const UInt8 theKey)
|
||||
{
|
||||
KeyMap map;
|
||||
GetKeys(map);
|
||||
return ((*((UInt8 *)map + (theKey >> 3)) >> (theKey & 7)) & 1) != 0;
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
|
||||
static long ConvertOSMenuResultToPPMenuResult(long menuResult)
|
||||
{
|
||||
// Convert MacOS menu item to PowerPlant menu item because
|
||||
// in our sample app, we use Constructor for resource editing
|
||||
long menuID = HiWord(menuResult);
|
||||
long menuItem = LoWord(menuResult);
|
||||
SInt16** theMcmdH = (SInt16**) ::GetResource('Mcmd', menuID);
|
||||
if (theMcmdH != nil)
|
||||
{
|
||||
if (::GetHandleSize((Handle)theMcmdH) > 0)
|
||||
{
|
||||
SInt16 numCommands = (*theMcmdH)[0];
|
||||
if (numCommands >= menuItem)
|
||||
{
|
||||
SInt32* theCommandNums = (SInt32*)(&(*theMcmdH)[1]);
|
||||
menuItem = theCommandNums[menuItem-1];
|
||||
}
|
||||
}
|
||||
::ReleaseResource((Handle) theMcmdH);
|
||||
}
|
||||
menuResult = (menuID << 16) + menuItem;
|
||||
return (menuResult);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#if TARGET_CARBON && !XP_MACOSX
|
||||
@ -858,20 +824,8 @@ void nsMacMessagePump::DoMouseMove(EventRecord &anEvent)
|
||||
//-------------------------------------------------------------------------
|
||||
void nsMacMessagePump::DoKey(EventRecord &anEvent)
|
||||
{
|
||||
char theChar = (char)(anEvent.message & charCodeMask);
|
||||
//if ((anEvent.what == keyDown) && ((anEvent.modifiers & cmdKey) != 0))
|
||||
//{
|
||||
// do a menu key command
|
||||
// long menuResult = ::MenuKey(theChar);
|
||||
// if (HiWord(menuResult) != 0)
|
||||
// {
|
||||
// menuResult = ConvertOSMenuResultToPPMenuResult(menuResult);
|
||||
// DoMenu(anEvent, menuResult);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
{
|
||||
PRBool handled = DispatchOSEventToRaptor(anEvent, GetFrontApplicationWindow());
|
||||
DispatchOSEventToRaptor(anEvent, GetFrontApplicationWindow());
|
||||
#if USE_MENUSELECT
|
||||
/* we want to call this if cmdKey is pressed and no other modifier keys are pressed */
|
||||
if((!handled) && (anEvent.what == keyDown) && (anEvent.modifiers == cmdKey) )
|
||||
|
@ -62,7 +62,6 @@
|
||||
#include <Menus.h>
|
||||
#include <TextUtils.h>
|
||||
#include <Balloons.h>
|
||||
#include <Traps.h>
|
||||
#include <Resources.h>
|
||||
#include <Appearance.h>
|
||||
#include <Gestalt.h>
|
||||
@ -89,7 +88,7 @@ EventHandlerUPP nsMenuBarX::sCommandEventHandler = nsnull;
|
||||
// nsMenuBarX constructor
|
||||
//
|
||||
nsMenuBarX::nsMenuBarX()
|
||||
: mNumMenus(0), mParent(nsnull), mIsMenuBarAdded(PR_FALSE), mDocument(nsnull), mCurrentCommandID(1)
|
||||
: mNumMenus(0), mParent(nsnull), mIsMenuBarAdded(PR_FALSE), mCurrentCommandID(1), mDocument(nsnull)
|
||||
{
|
||||
OSStatus status = ::CreateNewMenu(0, 0, &mRootMenu);
|
||||
NS_ASSERTION(status == noErr, "nsMenuBarX::nsMenuBarX: creation of root menu failed.");
|
||||
@ -575,6 +574,7 @@ NS_METHOD nsMenuBarX::AddMenu(nsIMenu * aMenu)
|
||||
mNumMenus = 1;
|
||||
::InsertMenuItem(mRootMenu, "\pA", mNumMenus);
|
||||
OSStatus status = ::SetMenuItemHierarchicalMenu(mRootMenu, 1, sAppleMenu);
|
||||
NS_ASSERTION(status == noErr, "OS problem with SetMenuItemHierarchicalMenu");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,6 @@ protected:
|
||||
|
||||
nsHashtable mObserverTable; // stores observers for content change notification
|
||||
nsHashtable mCommandMapTable; // maps CommandIDs to content nodes for CarbonEvent item selection
|
||||
PRUint32 mCurrentCommandID; // unique command id (per menu-bar) to give to next item that asks
|
||||
|
||||
PRUint32 mNumMenus;
|
||||
nsSupportsArray mMenusArray; // holds refs
|
||||
@ -149,8 +148,9 @@ protected:
|
||||
// been removed from the menubar
|
||||
nsCOMPtr<nsIContent> mQuitItemContent; // as above, but for quit
|
||||
nsIWidget* mParent; // weak ref
|
||||
|
||||
PRBool mIsMenuBarAdded;
|
||||
PRUint32 mCurrentCommandID; // unique command id (per menu-bar) to give to next item that asks
|
||||
|
||||
|
||||
nsWeakPtr mWebShellWeakRef; // weak ref to webshell
|
||||
nsIDocument* mDocument; // pointer to document
|
||||
|
@ -425,7 +425,7 @@ NS_METHOD nsMenuX::RemoveAll()
|
||||
// clear command id's
|
||||
nsCOMPtr<nsIMenuCommandDispatcher> dispatcher ( do_QueryInterface(mManager) );
|
||||
if ( dispatcher ) {
|
||||
for ( int i = 1; i <= mNumMenuItems; ++i ) {
|
||||
for ( unsigned int i = 1; i <= mNumMenuItems; ++i ) {
|
||||
PRUint32 commandID = 0L;
|
||||
OSErr err = ::GetMenuItemCommandID(mMacMenuHandle, i, (unsigned long*)&commandID);
|
||||
if ( !err )
|
||||
@ -1180,7 +1180,7 @@ nsMenuX::GetMenuPopupContent(nsIContent** aResult)
|
||||
|
||||
PRUint32 count = mMenuContent->GetChildCount();
|
||||
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
PRInt32 dummy;
|
||||
nsIContent *child = mMenuContent->GetChildAt(i);
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
|
@ -147,7 +147,6 @@ nsNativeScrollbar::DoScrollAction(ControlPartCode part)
|
||||
PRUint32 oldPos, newPos;
|
||||
PRUint32 incr;
|
||||
PRUint32 visibleImageSize;
|
||||
PRInt32 scrollBarMessage = 0;
|
||||
GetPosition(&oldPos);
|
||||
GetLineIncrement(&incr);
|
||||
GetViewSize(&visibleImageSize);
|
||||
@ -247,7 +246,7 @@ nsNativeScrollbar::DoScrollAction(ControlPartCode part)
|
||||
void
|
||||
nsNativeScrollbar::UpdateContentPosition(PRUint32 inNewPos)
|
||||
{
|
||||
if ( inNewPos == mValue || !mContent ) // break any possible recursion
|
||||
if ( (PRInt32)inNewPos == mValue || !mContent ) // break any possible recursion
|
||||
return;
|
||||
|
||||
// guarantee |inNewPos| is in the range of [0, mMaxValue] so it's correctly unsigned
|
||||
|
@ -398,12 +398,14 @@ PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
||||
StartDraw();
|
||||
ActivateControl(mControl);
|
||||
OSErr err = SetKeyboardFocus(mWindowPtr, mControl, kControlFocusNextPart);
|
||||
if (err == noErr ) {
|
||||
nsRect rect = mBounds;
|
||||
rect.x = rect.y = 0;
|
||||
Rect macRect;
|
||||
nsRectToMacRect(rect, macRect);
|
||||
::InsetRect(&macRect, 2, 2);
|
||||
::DrawThemeFocusRect(&macRect, true);
|
||||
}
|
||||
EndDraw();
|
||||
StartIdling();
|
||||
break;
|
||||
@ -414,12 +416,14 @@ PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
||||
StopIdling();
|
||||
StartDraw();
|
||||
OSErr err = SetKeyboardFocus(mWindowPtr, mControl, kControlFocusNoPart);
|
||||
if ( err == noErr ) {
|
||||
nsRect rect = mBounds;
|
||||
rect.x = rect.y = 0;
|
||||
Rect macRect;
|
||||
nsRectToMacRect(rect, macRect);
|
||||
::InsetRect(&macRect, 2, 2);
|
||||
::DrawThemeFocusRect(&macRect, false);
|
||||
}
|
||||
DeactivateControl(mControl);
|
||||
EndDraw();
|
||||
break;
|
||||
@ -606,7 +610,7 @@ NS_METHOD nsTextWidget::InsertText(const nsString &aText, PRUint32 aStartPos, P
|
||||
if (retVal != NS_OK)
|
||||
return retVal;
|
||||
|
||||
if ((aStartPos == -1L) && (aEndPos == -1L))
|
||||
if (((PRInt32)aStartPos == -1L) && ((PRInt32)aEndPos == -1L))
|
||||
{
|
||||
textStr.Append(aText);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user