diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index ed5f870a5d1a..d84976072367 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -164,7 +164,7 @@ TabParent::TabParent(nsIContentParent* aManager, , mInitedByParent(false) , mTabId(aTabId) , mCreatingWindow(false) - , mCursor(nsCursor(-1)) + , mCursor(eCursorInvalid) , mTabSetsCursor(false) , mHasContentOpener(false) #ifdef DEBUG @@ -1131,7 +1131,7 @@ TabParent::SendRealMouseEvent(WidgetMouseEvent& aEvent) if (mCustomCursor) { widget->SetCursor(mCustomCursor, mCustomCursorHotspotX, mCustomCursorHotspotY); - } else if (mCursor != nsCursor(-1)) { + } else if (mCursor != eCursorInvalid) { widget->SetCursor(mCursor); } } else if (eMouseExitFromWidget == aEvent.mMessage) { @@ -1787,7 +1787,7 @@ TabParent::RecvSetCustomCursor(const nsCString& aCursorData, const uint32_t& aHotspotY, const bool& aForce) { - mCursor = nsCursor(-1); + mCursor = eCursorInvalid; nsCOMPtr widget = GetWidget(); if (widget) { diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 3f0e6e49f9a6..40070f5fb11d 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -1012,7 +1012,7 @@ PuppetWidget::SetCursor(imgIContainer* aCursor, return NS_ERROR_FAILURE; } - mCursor = nsCursor(-1); + mCursor = eCursorInvalid; mCustomCursor = aCursor; mCursorHotspotX = aHotspotX; mCursorHotspotY = aHotspotY; diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index dcb9a3fc9756..37b6aae4c3d0 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -1623,7 +1623,7 @@ nsWindow::SetCursor(imgIContainer* aCursor, return window->SetCursor(aCursor, aHotspotX, aHotspotY); } - mCursor = nsCursor(-1); + mCursor = eCursorInvalid; // Get the image's current frame GdkPixbuf* pixbuf = nsImageToPixbuf::ImageToPixbuf(aCursor); diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 73851ac64137..7b8cdcc97608 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -211,8 +211,12 @@ enum nsCursor { ///(normal cursor, usually rendered as an arrow) eCursor_ns_resize, eCursor_ew_resize, eCursor_none, - // This one better be the last one in this list. - eCursorCount + // This one is used for array sizing, and so better be the last + // one in this list... + eCursorCount, + + // ...except for this one. + eCursorInvalid = eCursorCount + 1 }; enum nsTopLevelWidgetZPlacement { // for PlaceBehind() diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 1e658c99e07f..b4d915014a18 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -3020,7 +3020,7 @@ nsWindow::SetCursor(imgIContainer* aCursor, rv = nsWindowGfx::CreateIcon(aCursor, true, aHotspotX, aHotspotY, size, &cursor); NS_ENSURE_SUCCESS(rv, rv); - mCursor = nsCursor(-1); + mCursor = eCursorInvalid; ::SetCursor(cursor); NS_IF_RELEASE(sCursorImgContainer); @@ -7179,7 +7179,7 @@ void nsWindow::OnDestroy() } // Destroy any custom cursor resources. - if (mCursor == -1) + if (mCursor == eCursorInvalid) SetCursor(eCursor_standard); if (mCompositorWidgetDelegate) {