Bug 1221947 - part 2: add TOUCH cause to IME Handling and use it to avoid checking for a keyboard, r=masayuki

--HG--
extra : commitid : 210bhfz78Nm
extra : rebase_source : a3ee068abd8cb0fc2c83be7d5e5442bf74979ecd
extra : histedit_source : 29daad4b99ad4d41663cc026983dffa7449029dc
This commit is contained in:
Gijs Kruitbosch 2015-11-12 16:36:19 +00:00
Родитель 1fbe21a49c
Коммит aaf54987f1
4 изменённых файлов: 20 добавлений и 2 удалений

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

@ -352,7 +352,9 @@ nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
InputContextAction::Cause
nsFocusManager::GetFocusMoveActionCause(uint32_t aFlags)
{
if (aFlags & nsIFocusManager::FLAG_BYMOUSE) {
if (aFlags & nsIFocusManager::FLAG_BYTOUCH) {
return InputContextAction::CAUSE_TOUCH;
} else if (aFlags & nsIFocusManager::FLAG_BYMOUSE) {
return InputContextAction::CAUSE_MOUSE;
} else if (aFlags & nsIFocusManager::FLAG_BYKEY) {
return InputContextAction::CAUSE_KEY;

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

@ -307,7 +307,9 @@ struct InputContextAction final
// The cause is user's keyboard operation.
CAUSE_KEY,
// The cause is user's mouse operation.
CAUSE_MOUSE
CAUSE_MOUSE,
// The cause is user's touch operation (implies mouse)
CAUSE_TOUCH
};
Cause mCause;

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

@ -39,6 +39,9 @@ namespace widget {
******************************************************************************/
bool IMEHandler::sPluginHasFocus = false;
InputContextAction::Cause IMEHandler::sLastContextActionCause =
InputContextAction::CAUSE_UNKNOWN;
#ifdef NS_ENABLE_TSF
bool IMEHandler::sIsInTSFMode = false;
bool IMEHandler::sIsIMMEnabled = true;
@ -349,6 +352,7 @@ IMEHandler::SetInputContext(nsWindow* aWindow,
InputContext& aInputContext,
const InputContextAction& aAction)
{
sLastContextActionCause = aAction.mCause;
// FYI: If there is no composition, this call will do nothing.
NotifyIME(aWindow, IMENotification(REQUEST_TO_COMMIT_COMPOSITION));
@ -692,6 +696,14 @@ IMEHandler::IsKeyboardPresentOnSlate()
return true;
}
// Before we check for a keyboard, we should check if the last input was touch,
// in which case we ignore whether or not a keyboard is present:
if (sLastContextActionCause == InputContextAction::CAUSE_TOUCH) {
Preferences::SetString(kOskDebugReason,
L"IKPOS: Used touch to focus control, ignoring keyboard presence");
return false;
}
const GUID KEYBOARD_CLASS_GUID =
{ 0x4D36E96B, 0xE325, 0x11CE,
{ 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } };

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

@ -113,6 +113,8 @@ public:
private:
static bool sPluginHasFocus;
static InputContextAction::Cause sLastContextActionCause;
#ifdef NS_ENABLE_TSF
static decltype(SetInputScopes)* sSetInputScopes;
static void SetInputScopeForIMM32(nsWindow* aWindow,