зеркало из https://github.com/mozilla/gecko-dev.git
Bug 520341: Implement a way to detect a pre-Fremantle Nokia Maemo tablet, r=roc
This commit is contained in:
Родитель
dbf9df698d
Коммит
92ba26fdf5
|
@ -137,12 +137,26 @@ public:
|
|||
return sPlatformDPI;
|
||||
}
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
static PRInt32 GetMaemoClassic() {
|
||||
if (sMaemoClassic < 0) {
|
||||
gfxPlatformGtk::GetPlatform()->InitDisplayCaps();
|
||||
}
|
||||
NS_ASSERTION(sMaemoClassic > 0, "Something is wrong");
|
||||
return sMaemoClassic == 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void InitDisplayCaps();
|
||||
|
||||
static PRInt32 sPlatformDPI;
|
||||
static gfxFontconfigUtils *sFontconfigUtils;
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
static PRInt32 sMaemoClassic;
|
||||
#endif
|
||||
|
||||
private:
|
||||
virtual qcms_profile *GetPlatformCMSOutputProfile();
|
||||
};
|
||||
|
|
|
@ -96,6 +96,8 @@
|
|||
#include "nsILocalFile.h"
|
||||
#include "nsILineInputStream.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
PRInt32 gfxPlatformGtk::sMaemoClassic = -1;
|
||||
#endif
|
||||
|
||||
PRInt32 gfxPlatformGtk::sPlatformDPI = -1;
|
||||
|
@ -540,7 +542,7 @@ gfxPlatformGtk::InitDisplayCaps()
|
|||
gfxPlatformGtk::sPlatformDPI = 96;
|
||||
}
|
||||
|
||||
#if defined(MOZ_PLATFORM_HILDON)
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
// Check the cached value
|
||||
if (gfxPlatform::sDPI == -1) {
|
||||
nsresult rv;
|
||||
|
@ -558,11 +560,13 @@ gfxPlatformGtk::InitDisplayCaps()
|
|||
if (lineStream && NS_SUCCEEDED(lineStream->ReadLine(buffer, &isMore))) {
|
||||
if (StringEndsWith(buffer, NS_LITERAL_CSTRING("RX-51"))) {
|
||||
gfxPlatform::sDPI = 265; // It's an N900
|
||||
gfxPlatformGtk::sMaemoClassic = 0;
|
||||
}
|
||||
else if (StringEndsWith(buffer, NS_LITERAL_CSTRING("RX-44")) ||
|
||||
StringEndsWith(buffer, NS_LITERAL_CSTRING("RX-48")) ||
|
||||
StringEndsWith(buffer, NS_LITERAL_CSTRING("RX-34"))) {
|
||||
gfxPlatform::sDPI = 225; // It's an N810/N800
|
||||
gfxPlatformGtk::sMaemoClassic = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -859,6 +859,11 @@ InitSystemMetrics()
|
|||
sSystemMetrics->AppendElement(do_GetAtom("touch-enabled"));
|
||||
}
|
||||
|
||||
rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MaemoClassic, metricResult);
|
||||
if (NS_SUCCEEDED(rv) && metricResult) {
|
||||
sSystemMetrics->AppendElement(do_GetAtom("maemo-classic"));
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -270,6 +270,15 @@ public:
|
|||
*/
|
||||
eMetric_MacGraphiteTheme,
|
||||
|
||||
/*
|
||||
* A Boolean value to determine whether Mameo is using the new Fremantle
|
||||
* theme.
|
||||
*
|
||||
* The value of this metric is not used on other platforms. These platforms
|
||||
* should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
|
||||
*/
|
||||
eMetric_MaemoClassic,
|
||||
|
||||
/*
|
||||
* eMetric_AlertNotificationOrigin indicates from which corner of the
|
||||
* screen alerts slide in, and from which direction (horizontal/vertical).
|
||||
|
|
|
@ -432,6 +432,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case eMetric_MacGraphiteTheme:
|
||||
case eMetric_MaemoClassic:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
|
|
@ -435,6 +435,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|||
case eMetric_WindowsClassic:
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
case eMetric_TouchEnabled:
|
||||
case eMetric_MaemoClassic:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
|
|
@ -43,6 +43,10 @@
|
|||
|
||||
#include "gtkdrawing.h"
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
#include "gfxPlatformGtk.h"
|
||||
#endif
|
||||
|
||||
#define GDK_COLOR_TO_NS_RGB(c) \
|
||||
((nscolor) NS_RGB(c.red>>8, c.green>>8, c.blue>>8))
|
||||
|
||||
|
@ -582,6 +586,14 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|||
#else
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
break;
|
||||
case eMetric_MaemoClassic:
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
aMetric = gfxPlatformGtk::GetMaemoClassic();
|
||||
#else
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
break;
|
||||
case eMetric_MacGraphiteTheme:
|
||||
|
|
|
@ -383,6 +383,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case eMetric_MacGraphiteTheme:
|
||||
case eMetric_MaemoClassic:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
|
|
@ -371,6 +371,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case eMetric_MacGraphiteTheme:
|
||||
case eMetric_MaemoClassic:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
|
|
@ -478,6 +478,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID,PRInt32 &aMetric)
|
|||
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
case eMetric_TouchEnabled:
|
||||
case eMetric_MaemoClassic:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
|
|
@ -545,6 +545,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|||
}
|
||||
break;
|
||||
case eMetric_MacGraphiteTheme:
|
||||
case eMetric_MaemoClassic:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче