Adding Screen classes for Neutrino and makeing small interface changes
to catch up with new version of Photon header files that appeared during latest Patch G. PHOTON ONLY git-svn-id: svn://10.0.0.236/trunk@65112 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
#include <Pt.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* Should be defined in the Photon headers somewhere */
|
||||
extern void PdReleaseDirectContext( PdDirectContext_t *DirectContext );
|
||||
|
||||
/* The Transparency Mask of the last image Draw'd in nsRenderingContextPh */
|
||||
/* This is needed for locking and unlocking */
|
||||
extern void *Mask;
|
||||
@@ -95,7 +98,7 @@ nsDrawingSurfacePh :: ~nsDrawingSurfacePh()
|
||||
// PgSetGC(mGC);
|
||||
// PgSetRegion(mGC->rid);
|
||||
mDrawContext->gc=0;
|
||||
PdReleaseDirectContext((PdDirectContext_t *)mDrawContext); /* this function has an error! */
|
||||
PdReleaseDirectContext((PdDirectContext_t *)mDrawContext); /* this function has an error! */
|
||||
mDrawContext=0;
|
||||
}
|
||||
// free(mMC);
|
||||
|
||||
@@ -1489,7 +1489,7 @@ NS_IMETHODIMP nsRenderingContextPh :: GetWidth(const PRUnichar *aString,
|
||||
{
|
||||
PhRect_t extent;
|
||||
|
||||
if (PfExtentWideText(&extent, NULL, mPhotonFontName, (wchar_t *) aString, (aLength*2)))
|
||||
if (PfExtentWideText(&extent, NULL, mPhotonFontName, (const uint16_t *) aString, (aLength*2)))
|
||||
{
|
||||
aWidth = (int) ((extent.lr.x - extent.ul.x + 1) * mP2T);
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::GetWidth6 aWidth=<%d>mPhotonFontName=<%s>\n", aWidth, mPhotonFontName));
|
||||
|
||||
117
mozilla/gfx/src/photon/nsScreenManagerPh.cpp
Normal file
117
mozilla/gfx/src/photon/nsScreenManagerPh.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsScreenManagerPh.h"
|
||||
#include "nsScreenPh.h"
|
||||
|
||||
#include "nsPhGfxLog.h"
|
||||
|
||||
nsScreenManagerPh :: nsScreenManagerPh ( )
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsScreenManagerPh::nsScreenManagerPh Constructor called this=<%p>\n", this));
|
||||
|
||||
// nothing else to do. I guess we could cache a bunch of information
|
||||
// here, but we want to ask the device at runtime in case anything
|
||||
// has changed.
|
||||
}
|
||||
|
||||
|
||||
nsScreenManagerPh :: ~nsScreenManagerPh()
|
||||
{
|
||||
// nothing to see here.
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsScreenManagerPh::~nsScreenManagerPh Destructor called this=<%p>\n", this));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// addref, release, QI
|
||||
NS_IMPL_ISUPPORTS(nsScreenManagerPh, NS_GET_IID(nsIScreenManager))
|
||||
|
||||
|
||||
//
|
||||
// CreateNewScreenObject
|
||||
//
|
||||
// Utility routine. Creates a new screen object from the given device handle
|
||||
//
|
||||
// NOTE: For this "single-monitor" impl, we just always return the cached primary
|
||||
// screen. This should change when a multi-monitor impl is done.
|
||||
//
|
||||
nsIScreen*
|
||||
nsScreenManagerPh :: CreateNewScreenObject ( )
|
||||
{
|
||||
nsIScreen* retval = nsnull;
|
||||
if ( !mCachedMainScreen )
|
||||
mCachedMainScreen = new nsScreenPh ( );
|
||||
NS_IF_ADDREF(retval = mCachedMainScreen.get());
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ScreenForRect
|
||||
//
|
||||
// Returns the screen that contains the rectangle. If the rect overlaps
|
||||
// multiple screens, it picks the screen with the greatest area of intersection.
|
||||
//
|
||||
// The coordinates are in pixels (not twips) and in screen coordinates.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsScreenManagerPh :: ScreenForRect ( PRInt32 /*inLeft*/, PRInt32 /*inTop*/, PRInt32 /*inWidth*/,
|
||||
PRInt32 /*inHeight*/, nsIScreen **outScreen )
|
||||
{
|
||||
GetPrimaryScreen ( outScreen );
|
||||
return NS_OK;
|
||||
|
||||
} // ScreenForRect
|
||||
|
||||
|
||||
//
|
||||
// GetPrimaryScreen
|
||||
//
|
||||
// The screen with the menubar/taskbar. This shouldn't be needed very
|
||||
// often.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsScreenManagerPh :: GetPrimaryScreen(nsIScreen * *aPrimaryScreen)
|
||||
{
|
||||
*aPrimaryScreen = CreateNewScreenObject(); // addrefs
|
||||
return NS_OK;
|
||||
|
||||
} // GetPrimaryScreen
|
||||
|
||||
|
||||
//
|
||||
// GetNumberOfScreens
|
||||
//
|
||||
// Returns how many physical screens are available.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsScreenManagerPh :: GetNumberOfScreens(PRUint32 *aNumberOfScreens)
|
||||
{
|
||||
*aNumberOfScreens = 1;
|
||||
return NS_OK;
|
||||
|
||||
} // GetNumberOfScreens
|
||||
|
||||
50
mozilla/gfx/src/photon/nsScreenManagerPh.h
Normal file
50
mozilla/gfx/src/photon/nsScreenManagerPh.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsScreenManagerPh_h___
|
||||
#define nsScreenManagerPh_h___
|
||||
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsIScreen.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class nsScreenManagerPh : public nsIScreenManager
|
||||
{
|
||||
public:
|
||||
nsScreenManagerPh ( );
|
||||
virtual ~nsScreenManagerPh();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISCREENMANAGER
|
||||
|
||||
private:
|
||||
|
||||
nsIScreen* CreateNewScreenObject ( ) ;
|
||||
|
||||
// cache the primary screen object to avoid memory allocation every time
|
||||
nsCOMPtr<nsIScreen> mCachedMainScreen;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsScreenManagerPh_h___
|
||||
162
mozilla/gfx/src/photon/nsScreenPh.cpp
Normal file
162
mozilla/gfx/src/photon/nsScreenPh.cpp
Normal file
@@ -0,0 +1,162 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsScreenPh.h"
|
||||
|
||||
#include <Pt.h>
|
||||
#include "nsPhGfxLog.h"
|
||||
|
||||
nsScreenPh :: nsScreenPh ( )
|
||||
{
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
PhSysInfo_t SysInfo;
|
||||
PhRect_t rect;
|
||||
char *p = NULL;
|
||||
int inp_grp = 0;
|
||||
PhRid_t rid;
|
||||
PhRegion_t region;
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsScreenPh::nsScreenPh Constructor called this=<%p>\n", this));
|
||||
|
||||
|
||||
// nothing else to do. I guess we could cache a bunch of information
|
||||
// here, but we want to ask the device at runtime in case anything
|
||||
// has changed.
|
||||
|
||||
/* Initialize the data members */
|
||||
/* Get the Screen Size and Depth*/
|
||||
p = getenv("PHIG");
|
||||
if (p)
|
||||
{
|
||||
inp_grp = atoi(p);
|
||||
|
||||
PhQueryRids( 0, 0, inp_grp, Ph_INPUTGROUP_REGION, 0, 0, 0, &rid, 1 );
|
||||
PhRegionQuery( rid, ®ion, &rect, NULL, 0 );
|
||||
inp_grp = region.input_group;
|
||||
PhWindowQueryVisible( Ph_QUERY_INPUT_GROUP | Ph_QUERY_EXACT, 0, inp_grp, &rect );
|
||||
mWidth = rect.lr.x - rect.ul.x + 1;
|
||||
mHeight = rect.lr.y - rect.ul.y + 1;
|
||||
|
||||
/* Get the System Info for the RID */
|
||||
if (!PhQuerySystemInfo(rid, NULL, &SysInfo))
|
||||
{
|
||||
PR_LOG(PhGfxLog, PR_LOG_ERROR,("nsScreenPh::nsScreenPh with aWidget: Error getting SystemInfo\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure the "color_bits" field is valid */
|
||||
if (SysInfo.gfx.valid_fields & Ph_GFX_COLOR_BITS)
|
||||
{
|
||||
mPixelDepth = SysInfo.gfx.color_bits;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("nsScreenPh::nsScreenPh The PHIG environment variable must be set, try setting it to 1\n");
|
||||
}
|
||||
}
|
||||
|
||||
nsScreenPh :: ~nsScreenPh()
|
||||
{
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsScreenPh::~nsScreenPh Destructor called this=<%p>\n", this));
|
||||
|
||||
// nothing to see here.
|
||||
}
|
||||
|
||||
|
||||
// addref, release, QI
|
||||
NS_IMPL_ISUPPORTS(nsScreenPh, NS_GET_IID(nsIScreen))
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenPh :: GetWidth(PRInt32 *aWidth)
|
||||
{
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsScreenPh::GetWidth Constructor called this=<%p>\n", this));
|
||||
|
||||
*aWidth = mWidth;
|
||||
return NS_OK;
|
||||
|
||||
} // GetWidth
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenPh :: GetHeight(PRInt32 *aHeight)
|
||||
{
|
||||
*aHeight = mHeight;
|
||||
return NS_OK;
|
||||
|
||||
} // GetHeight
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenPh :: GetPixelDepth(PRInt32 *aPixelDepth)
|
||||
{
|
||||
*aPixelDepth = mPixelDepth;
|
||||
return NS_OK;
|
||||
|
||||
} // GetPixelDepth
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenPh :: GetColorDepth(PRInt32 *aColorDepth)
|
||||
{
|
||||
return GetPixelDepth ( aColorDepth );
|
||||
|
||||
} // GetColorDepth
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenPh :: GetAvailWidth(PRInt32 *aAvailWidth)
|
||||
{
|
||||
return GetWidth(aAvailWidth);
|
||||
|
||||
} // GetAvailWidth
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenPh :: GetAvailHeight(PRInt32 *aAvailHeight)
|
||||
{
|
||||
return GetHeight(aAvailHeight);
|
||||
|
||||
} // GetAvailHeight
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenPh :: GetAvailLeft(PRInt32 *aAvailLeft)
|
||||
{
|
||||
*aAvailLeft = 0;
|
||||
return NS_OK;
|
||||
|
||||
} // GetAvailLeft
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenPh :: GetAvailTop(PRInt32 *aAvailTop)
|
||||
{
|
||||
*aAvailTop = 0;
|
||||
return NS_OK;
|
||||
|
||||
} // GetAvailTop
|
||||
|
||||
45
mozilla/gfx/src/photon/nsScreenPh.h
Normal file
45
mozilla/gfx/src/photon/nsScreenPh.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsScreenPh_h___
|
||||
#define nsScreenPh_h___
|
||||
|
||||
#include "nsIScreen.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class nsScreenPh : public nsIScreen
|
||||
{
|
||||
public:
|
||||
nsScreenPh ( );
|
||||
virtual ~nsScreenPh();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISCREEN
|
||||
|
||||
private:
|
||||
PRInt32 mWidth;
|
||||
PRInt32 mHeight;
|
||||
PRInt32 mPixelDepth;
|
||||
};
|
||||
|
||||
#endif // nsScreenPh_h___
|
||||
Reference in New Issue
Block a user