Bug 1036003 - "Clean up formatting in nsScreenWin.cpp and nsScreenManagerWin.cpp". r=jmathies f=mconley

This commit is contained in:
Mike Conley 2014-07-14 09:52:00 +02:00
Родитель 6240993aa3
Коммит 2fd13cec8d
2 изменённых файлов: 36 добавлений и 36 удалений

Просмотреть файл

@ -9,9 +9,9 @@
#include "nsIWidget.h"
BOOL CALLBACK CountMonitors ( HMONITOR, HDC, LPRECT, LPARAM ioCount ) ;
BOOL CALLBACK CountMonitors(HMONITOR, HDC, LPRECT, LPARAM ioCount);
nsScreenManagerWin :: nsScreenManagerWin ( )
nsScreenManagerWin::nsScreenManagerWin()
: mNumberOfScreens(0)
{
// nothing to do. I guess we could cache a bunch of information
@ -20,7 +20,7 @@ nsScreenManagerWin :: nsScreenManagerWin ( )
}
nsScreenManagerWin :: ~nsScreenManagerWin()
nsScreenManagerWin::~nsScreenManagerWin()
{
}
@ -38,22 +38,22 @@ NS_IMPL_ISUPPORTS(nsScreenManagerWin, nsIScreenManager)
// screen. This should change when a multi-monitor impl is done.
//
nsIScreen*
nsScreenManagerWin :: CreateNewScreenObject ( HMONITOR inScreen )
nsScreenManagerWin::CreateNewScreenObject(HMONITOR inScreen)
{
nsIScreen* retScreen = nullptr;
// look through our screen list, hoping to find it. If it's not there,
// add it and return the new one.
for ( unsigned i = 0; i < mScreenList.Length(); ++i ) {
for (unsigned i = 0; i < mScreenList.Length(); ++i) {
ScreenListItem& curr = mScreenList[i];
if ( inScreen == curr.mMon ) {
if (inScreen == curr.mMon) {
NS_IF_ADDREF(retScreen = curr.mScreen.get());
return retScreen;
}
} // for each screen.
retScreen = new nsScreenWin(inScreen);
mScreenList.AppendElement ( ScreenListItem ( inScreen, retScreen ) );
mScreenList.AppendElement(ScreenListItem(inScreen, retScreen));
NS_IF_ADDREF(retScreen);
return retScreen;
@ -86,12 +86,12 @@ nsScreenManagerWin::ScreenForId(uint32_t aId, nsIScreen **outScreen)
// The coordinates are in pixels (not twips) and in logical screen coordinates.
//
NS_IMETHODIMP
nsScreenManagerWin :: ScreenForRect ( int32_t inLeft, int32_t inTop, int32_t inWidth, int32_t inHeight,
nsIScreen **outScreen )
nsScreenManagerWin::ScreenForRect(int32_t inLeft, int32_t inTop, int32_t inWidth, int32_t inHeight,
nsIScreen **outScreen)
{
if ( !(inWidth || inHeight) ) {
NS_WARNING ( "trying to find screen for sizeless window, using primary monitor" );
*outScreen = CreateNewScreenObject ( nullptr ); // addrefs
if (!(inWidth || inHeight)) {
NS_WARNING("trying to find screen for sizeless window, using primary monitor");
*outScreen = CreateNewScreenObject(nullptr); // addrefs
return NS_OK;
}
@ -107,10 +107,10 @@ nsScreenManagerWin :: ScreenForRect ( int32_t inLeft, int32_t inTop, int32_t inW
NSToIntRound(dpiScale * (inTop + inHeight))
};
HMONITOR genScreen = ::MonitorFromRect( &globalWindowBounds, MONITOR_DEFAULTTOPRIMARY );
*outScreen = CreateNewScreenObject ( genScreen ); // addrefs
HMONITOR genScreen = ::MonitorFromRect(&globalWindowBounds, MONITOR_DEFAULTTOPRIMARY);
*outScreen = CreateNewScreenObject(genScreen); // addrefs
return NS_OK;
} // ScreenForRect
@ -123,9 +123,9 @@ nsScreenManagerWin :: ScreenForRect ( int32_t inLeft, int32_t inTop, int32_t inW
// often.
//
NS_IMETHODIMP
nsScreenManagerWin :: GetPrimaryScreen(nsIScreen** aPrimaryScreen)
nsScreenManagerWin::GetPrimaryScreen(nsIScreen** aPrimaryScreen)
{
*aPrimaryScreen = CreateNewScreenObject ( nullptr ); // addrefs
*aPrimaryScreen = CreateNewScreenObject(nullptr); // addrefs
return NS_OK;
} // GetPrimaryScreen
@ -139,7 +139,7 @@ nsScreenManagerWin :: GetPrimaryScreen(nsIScreen** aPrimaryScreen)
// count up to this point.
//
BOOL CALLBACK
CountMonitors ( HMONITOR, HDC, LPRECT, LPARAM ioParam )
CountMonitors(HMONITOR, HDC, LPRECT, LPARAM ioParam)
{
uint32_t* countPtr = reinterpret_cast<uint32_t*>(ioParam);
++(*countPtr);
@ -155,9 +155,9 @@ CountMonitors ( HMONITOR, HDC, LPRECT, LPARAM ioParam )
// Returns how many physical screens are available.
//
NS_IMETHODIMP
nsScreenManagerWin :: GetNumberOfScreens(uint32_t *aNumberOfScreens)
nsScreenManagerWin::GetNumberOfScreens(uint32_t *aNumberOfScreens)
{
if ( mNumberOfScreens )
if (mNumberOfScreens)
*aNumberOfScreens = mNumberOfScreens;
else {
uint32_t count = 0;
@ -179,9 +179,9 @@ nsScreenManagerWin::GetSystemDefaultScale(float *aDefaultScale)
}
NS_IMETHODIMP
nsScreenManagerWin :: ScreenForNativeWidget(void *aWidget, nsIScreen **outScreen)
nsScreenManagerWin::ScreenForNativeWidget(void *aWidget, nsIScreen **outScreen)
{
HMONITOR mon = MonitorFromWindow ((HWND) aWidget, MONITOR_DEFAULTTOPRIMARY);
*outScreen = CreateNewScreenObject (mon);
HMONITOR mon = MonitorFromWindow((HWND) aWidget, MONITOR_DEFAULTTOPRIMARY);
*outScreen = CreateNewScreenObject(mon);
return NS_OK;
}

Просмотреть файл

@ -10,14 +10,14 @@
static uint32_t sScreenId;
nsScreenWin :: nsScreenWin ( HMONITOR inScreen )
nsScreenWin::nsScreenWin(HMONITOR inScreen)
: mScreen(inScreen)
, mId(++sScreenId)
{
#ifdef DEBUG
HDC hDCScreen = ::GetDC(nullptr);
NS_ASSERTION(hDCScreen,"GetDC Failure");
NS_ASSERTION ( ::GetDeviceCaps(hDCScreen, TECHNOLOGY) == DT_RASDISPLAY, "Not a display screen");
NS_ASSERTION(::GetDeviceCaps(hDCScreen, TECHNOLOGY) == DT_RASDISPLAY, "Not a display screen");
::ReleaseDC(nullptr,hDCScreen);
#endif
@ -27,7 +27,7 @@ nsScreenWin :: nsScreenWin ( HMONITOR inScreen )
}
nsScreenWin :: ~nsScreenWin()
nsScreenWin::~nsScreenWin()
{
// nothing to see here.
}
@ -42,14 +42,14 @@ nsScreenWin::GetId(uint32_t *outId)
NS_IMETHODIMP
nsScreenWin :: GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
nsScreenWin::GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
{
BOOL success = FALSE;
if ( mScreen ) {
if (mScreen) {
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
success = ::GetMonitorInfoW( mScreen, &info );
if ( success ) {
success = ::GetMonitorInfoW(mScreen, &info);
if (success) {
*outLeft = info.rcMonitor.left;
*outTop = info.rcMonitor.top;
*outWidth = info.rcMonitor.right - info.rcMonitor.left;
@ -72,15 +72,15 @@ nsScreenWin :: GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int
NS_IMETHODIMP
nsScreenWin :: GetAvailRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
nsScreenWin::GetAvailRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
{
BOOL success = FALSE;
if ( mScreen ) {
if (mScreen) {
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
success = ::GetMonitorInfoW( mScreen, &info );
if ( success ) {
success = ::GetMonitorInfoW(mScreen, &info);
if (success) {
*outLeft = info.rcWork.left;
*outTop = info.rcWork.top;
*outWidth = info.rcWork.right - info.rcWork.left;
@ -168,7 +168,7 @@ nsScreenWin :: GetPixelDepth(int32_t *aPixelDepth)
NS_IMETHODIMP
nsScreenWin :: GetColorDepth(int32_t *aColorDepth)
nsScreenWin::GetColorDepth(int32_t *aColorDepth)
{
return GetPixelDepth(aColorDepth);