mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 503042 - Implement a way to detect a touch enabled device. r=vlad, sr=dbaron
This commit is contained in:
parent
987fb22706
commit
f694038dde
@ -853,6 +853,11 @@ InitSystemMetrics()
|
||||
if (NS_SUCCEEDED(rv) && metricResult) {
|
||||
sSystemMetrics->AppendElement(do_GetAtom("windows-classic"));
|
||||
}
|
||||
|
||||
rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TouchEnabled, metricResult);
|
||||
if (NS_SUCCEEDED(rv) && metricResult) {
|
||||
sSystemMetrics->AppendElement(do_GetAtom("touch-enabled"));
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -261,6 +261,15 @@ public:
|
||||
*/
|
||||
eMetric_WindowsClassic,
|
||||
|
||||
/*
|
||||
* A Boolean value to determine whether the device is a touch enabled
|
||||
* device. Currently this is only supported by the Windows 7 Touch API.
|
||||
*
|
||||
* Platforms that do not support this metric should return
|
||||
* NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
|
||||
*/
|
||||
eMetric_TouchEnabled,
|
||||
|
||||
/*
|
||||
* A Boolean value to determine whether the Mac graphite theme is
|
||||
* being used.
|
||||
|
@ -427,6 +427,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_DWMCompositor:
|
||||
case eMetric_WindowsClassic:
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
case eMetric_TouchEnabled:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -605,6 +605,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_DWMCompositor:
|
||||
case eMetric_WindowsClassic:
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
case eMetric_TouchEnabled:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -572,6 +572,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_DWMCompositor:
|
||||
case eMetric_WindowsClassic:
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
case eMetric_TouchEnabled:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -378,6 +378,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_DWMCompositor:
|
||||
case eMetric_WindowsClassic:
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
case eMetric_TouchEnabled:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -366,6 +366,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_DWMCompositor:
|
||||
case eMetric_WindowsClassic:
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
case eMetric_TouchEnabled:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -477,6 +477,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID,PRInt32 &aMetric)
|
||||
break;
|
||||
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
case eMetric_TouchEnabled:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -491,6 +491,17 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
aMetric = !nsUXThemeData::IsAppThemed();
|
||||
#else
|
||||
aMetric = 0;
|
||||
#endif
|
||||
break;
|
||||
case eMetric_TouchEnabled:
|
||||
aMetric = 0;
|
||||
#ifndef WINCE
|
||||
PRInt32 touchCapabilities;
|
||||
touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
|
||||
if ((touchCapabilities & NID_READY) &&
|
||||
(touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH))) {
|
||||
aMetric = 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case eMetric_WindowsDefaultTheme:
|
||||
|
@ -41,6 +41,20 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
/*
|
||||
* Gesture System Metrics
|
||||
*/
|
||||
#ifndef SM_DIGITIZER
|
||||
#define SM_DIGITIZER 94
|
||||
#define TABLET_CONFIG_NONE 0x00000000
|
||||
#define NID_INTEGRATED_TOUCH 0x00000001
|
||||
#define NID_EXTERNAL_TOUCH 0x00000002
|
||||
#define NID_INTEGRATED_PEN 0x00000004
|
||||
#define NID_EXTERNAL_PEN 0x00000008
|
||||
#define NID_MULTI_INPUT 0x00000040
|
||||
#define NID_READY 0x00000080
|
||||
#endif
|
||||
|
||||
class nsLookAndFeel: public nsXPLookAndFeel {
|
||||
public:
|
||||
nsLookAndFeel();
|
||||
|
Loading…
Reference in New Issue
Block a user