зеркало из https://github.com/mozilla/gecko-dev.git
MINIMO only. Adding device support back into build. making softkey2 act as a tab button if there is no software keyboard.
This commit is contained in:
Родитель
39d2497a4a
Коммит
c94402a6e6
|
@ -29,3 +29,4 @@ ssr
|
|||
native_ssl
|
||||
cookie
|
||||
perms
|
||||
devicesupport
|
||||
|
|
|
@ -29,3 +29,4 @@ SSRModule
|
|||
nsNativeSSLModule
|
||||
nsCookieModule
|
||||
nsPermissionsModule
|
||||
DeviceSupportModule
|
||||
|
|
|
@ -40,6 +40,7 @@ const imgICache = Components.interfaces.imgICache;
|
|||
const nsIBrowserDOMWindow = Components.interfaces.nsIBrowserDOMWindow;
|
||||
const nsIBrowserHistory = Components.interfaces.nsIBrowserHistory;
|
||||
const nsIClipboard = Components.interfaces.nsIClipboard;
|
||||
const nsIDeviceSupport = Components.interfaces.nsIDeviceSupport;
|
||||
const nsIDOMChromeWindow = Components.interfaces.nsIDOMChromeWindow;
|
||||
const nsIDOMDocument = Components.interfaces.nsIDOMDocument;
|
||||
const nsIDOMWindow = Components.interfaces.nsIDOMWindow;
|
||||
|
@ -1060,13 +1061,20 @@ function DoSNavToggle()
|
|||
function DoToggleSoftwareKeyboard()
|
||||
{
|
||||
try {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(nsIPrefBranch);
|
||||
pref.setBoolPref("skey.enabled", !pref.getBoolPref("skey.enabled"));
|
||||
|
||||
var device = Components.classes["@mozilla.org/device/support;1"].getService(nsIDeviceSupport);
|
||||
|
||||
if (device.has("hasSoftwareKeyboard") == "yes") {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(nsIPrefBranch);
|
||||
pref.setBoolPref("skey.enabled", !pref.getBoolPref("skey.enabled"));
|
||||
}
|
||||
else {
|
||||
document.commandDispatcher.advanceFocus();
|
||||
}
|
||||
}
|
||||
catch(ex) { alert(ex); }
|
||||
}
|
||||
|
||||
|
||||
function DoFullScreen()
|
||||
{
|
||||
gFullScreen = !gFullScreen;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "string.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
#include "nsIDeviceSupport.h"
|
||||
|
||||
|
@ -85,6 +86,44 @@ NS_IMETHODIMP nsDeviceSupport::RotateScreen(PRBool aLandscapeMode)
|
|||
}
|
||||
|
||||
|
||||
static BOOL IsSmartphone()
|
||||
{
|
||||
unsigned short platform[64];
|
||||
|
||||
if (TRUE == SystemParametersInfo(SPI_GETPLATFORMTYPE,
|
||||
sizeof(platform),
|
||||
platform,
|
||||
0))
|
||||
{
|
||||
if (0 == _wcsicmp(L"Smartphone", platform))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDeviceSupport::Has(const char* aProperty, char **aValue)
|
||||
{
|
||||
*aValue = nsnull;
|
||||
|
||||
if (!strcmp(aProperty, "hasSoftwareKeyboard"))
|
||||
{
|
||||
*aValue = (char*) nsMemory::Alloc(4);
|
||||
|
||||
if (!IsSmartphone())
|
||||
strcpy(*aValue, "yes");
|
||||
else
|
||||
strcpy(*aValue, "no");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// XPCOM REGISTRATION BELOW
|
||||
|
|
|
@ -42,4 +42,6 @@
|
|||
interface nsIDeviceSupport : nsISupports
|
||||
{
|
||||
void rotateScreen(in boolean aLandscapeMode);
|
||||
|
||||
string has(in string property);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче