mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 751749 part.2 Support Win key for a modifier of shortcut key and access key r=smaug, enn
This commit is contained in:
parent
141ea58a3e
commit
588dd9f9f3
@ -918,6 +918,7 @@ public:
|
||||
static const PRUint32 kControl = 2;
|
||||
static const PRUint32 kAlt = 4;
|
||||
static const PRUint32 kMeta = 8;
|
||||
static const PRUint32 kOS = 16;
|
||||
|
||||
KeyBinding() : mKey(0), mModifierMask(0) {}
|
||||
KeyBinding(PRUint32 aKey, PRUint32 aModifierMask) :
|
||||
|
@ -184,6 +184,9 @@ XULMenuitemAccessible::AccessKey() const
|
||||
case nsIDOMKeyEvent::DOM_VK_META:
|
||||
modifierKey = KeyBinding::kMeta;
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN:
|
||||
modifierKey = KeyBinding::kOS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,6 +229,8 @@ XULMenuitemAccessible::KeyboardShortcut() const
|
||||
modifierMask |= KeyBinding::kAlt;
|
||||
if (modifiersStr.Find("meta") != -1)
|
||||
modifierMask |= KeyBinding::kMeta;
|
||||
if (modifiersStr.Find("os") != -1)
|
||||
modifierMask |= KeyBinding::kOS;
|
||||
if (modifiersStr.Find("control") != -1)
|
||||
modifierMask |= KeyBinding::kControl;
|
||||
if (modifiersStr.Find("accel") != -1) {
|
||||
@ -235,6 +240,10 @@ XULMenuitemAccessible::KeyboardShortcut() const
|
||||
modifierMask |= KeyBinding::kMeta;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN:
|
||||
modifierMask |= KeyBinding::kOS;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
modifierMask |= KeyBinding::kAlt;
|
||||
break;
|
||||
|
@ -1870,6 +1870,7 @@ public:
|
||||
static void GetShiftText(nsAString& text);
|
||||
static void GetControlText(nsAString& text);
|
||||
static void GetMetaText(nsAString& text);
|
||||
static void GetOSText(nsAString& text);
|
||||
static void GetAltText(nsAString& text);
|
||||
static void GetModifierSeparatorText(nsAString& text);
|
||||
|
||||
@ -2174,6 +2175,7 @@ private:
|
||||
static nsString* sShiftText;
|
||||
static nsString* sControlText;
|
||||
static nsString* sMetaText;
|
||||
static nsString* sOSText;
|
||||
static nsString* sAltText;
|
||||
static nsString* sModifierSeparator;
|
||||
};
|
||||
|
@ -216,6 +216,7 @@ bool nsContentUtils::sAllowXULXBL_for_file = false;
|
||||
nsString* nsContentUtils::sShiftText = nsnull;
|
||||
nsString* nsContentUtils::sControlText = nsnull;
|
||||
nsString* nsContentUtils::sMetaText = nsnull;
|
||||
nsString* nsContentUtils::sOSText = nsnull;
|
||||
nsString* nsContentUtils::sAltText = nsnull;
|
||||
nsString* nsContentUtils::sModifierSeparator = nsnull;
|
||||
|
||||
@ -435,6 +436,15 @@ nsContentUtils::GetMetaText(nsAString& text)
|
||||
text.Assign(*sMetaText);
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::GetOSText(nsAString& text)
|
||||
{
|
||||
if (!sOSText) {
|
||||
InitializeModifierStrings();
|
||||
}
|
||||
text.Assign(*sOSText);
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::GetAltText(nsAString& text)
|
||||
{
|
||||
@ -467,6 +477,7 @@ nsContentUtils::InitializeModifierStrings()
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/platformKeys.properties could not be loaded");
|
||||
nsXPIDLString shiftModifier;
|
||||
nsXPIDLString metaModifier;
|
||||
nsXPIDLString osModifier;
|
||||
nsXPIDLString altModifier;
|
||||
nsXPIDLString controlModifier;
|
||||
nsXPIDLString modifierSeparator;
|
||||
@ -474,6 +485,7 @@ nsContentUtils::InitializeModifierStrings()
|
||||
//macs use symbols for each modifier key, so fetch each from the bundle, which also covers i18n
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_SHIFT").get(), getter_Copies(shiftModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_META").get(), getter_Copies(metaModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_WIN").get(), getter_Copies(osModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_ALT").get(), getter_Copies(altModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_CONTROL").get(), getter_Copies(controlModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("MODIFIER_SEPARATOR").get(), getter_Copies(modifierSeparator));
|
||||
@ -481,6 +493,7 @@ nsContentUtils::InitializeModifierStrings()
|
||||
//if any of these don't exist, we get an empty string
|
||||
sShiftText = new nsString(shiftModifier);
|
||||
sMetaText = new nsString(metaModifier);
|
||||
sOSText = new nsString(osModifier);
|
||||
sAltText = new nsString(altModifier);
|
||||
sControlText = new nsString(controlModifier);
|
||||
sModifierSeparator = new nsString(modifierSeparator);
|
||||
@ -1453,6 +1466,8 @@ nsContentUtils::Shutdown()
|
||||
sControlText = nsnull;
|
||||
delete sMetaText;
|
||||
sMetaText = nsnull;
|
||||
delete sOSText;
|
||||
sOSText = nsnull;
|
||||
delete sAltText;
|
||||
sAltText = nsnull;
|
||||
delete sModifierSeparator;
|
||||
|
@ -266,6 +266,7 @@ enum {
|
||||
#define NS_MODIFIER_CONTROL 2
|
||||
#define NS_MODIFIER_ALT 4
|
||||
#define NS_MODIFIER_META 8
|
||||
#define NS_MODIFIER_OS 16
|
||||
|
||||
static nsIDocument *
|
||||
GetDocumentFromWindow(nsIDOMWindow *aWindow)
|
||||
@ -290,6 +291,7 @@ GetAccessModifierMaskFromPref(PRInt32 aItemType)
|
||||
case nsIDOMKeyEvent::DOM_VK_CONTROL: return NS_MODIFIER_CONTROL;
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT: return NS_MODIFIER_ALT;
|
||||
case nsIDOMKeyEvent::DOM_VK_META: return NS_MODIFIER_META;
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN: return NS_MODIFIER_OS;
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
@ -1167,6 +1169,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
modifierMask |= NS_MODIFIER_ALT;
|
||||
if (keyEvent->IsMeta())
|
||||
modifierMask |= NS_MODIFIER_META;
|
||||
if (keyEvent->IsOS())
|
||||
modifierMask |= NS_MODIFIER_OS;
|
||||
|
||||
// Prevent keyboard scrolling while an accesskey modifier is in use.
|
||||
if (modifierMask && (modifierMask == sChromeAccessModifier ||
|
||||
@ -1524,6 +1528,10 @@ nsEventStateManager::GetAccessKeyLabelPrefix(nsAString& aPrefix)
|
||||
nsContentUtils::GetMetaText(modifierText);
|
||||
aPrefix.Append(modifierText + separator);
|
||||
}
|
||||
if (modifier & NS_MODIFIER_OS) {
|
||||
nsContentUtils::GetOSText(modifierText);
|
||||
aPrefix.Append(modifierText + separator);
|
||||
}
|
||||
if (modifier & NS_MODIFIER_ALT) {
|
||||
nsContentUtils::GetAltText(modifierText);
|
||||
aPrefix.Append(modifierText + separator);
|
||||
|
@ -61,13 +61,16 @@ const PRInt32 nsXBLPrototypeHandler::cShift = (1<<0);
|
||||
const PRInt32 nsXBLPrototypeHandler::cAlt = (1<<1);
|
||||
const PRInt32 nsXBLPrototypeHandler::cControl = (1<<2);
|
||||
const PRInt32 nsXBLPrototypeHandler::cMeta = (1<<3);
|
||||
const PRInt32 nsXBLPrototypeHandler::cOS = (1<<4);
|
||||
|
||||
const PRInt32 nsXBLPrototypeHandler::cShiftMask = (1<<4);
|
||||
const PRInt32 nsXBLPrototypeHandler::cAltMask = (1<<5);
|
||||
const PRInt32 nsXBLPrototypeHandler::cControlMask = (1<<6);
|
||||
const PRInt32 nsXBLPrototypeHandler::cMetaMask = (1<<7);
|
||||
const PRInt32 nsXBLPrototypeHandler::cShiftMask = (1<<5);
|
||||
const PRInt32 nsXBLPrototypeHandler::cAltMask = (1<<6);
|
||||
const PRInt32 nsXBLPrototypeHandler::cControlMask = (1<<7);
|
||||
const PRInt32 nsXBLPrototypeHandler::cMetaMask = (1<<8);
|
||||
const PRInt32 nsXBLPrototypeHandler::cOSMask = (1<<9);
|
||||
|
||||
const PRInt32 nsXBLPrototypeHandler::cAllModifiers = cShiftMask | cAltMask | cControlMask | cMetaMask;
|
||||
const PRInt32 nsXBLPrototypeHandler::cAllModifiers =
|
||||
cShiftMask | cAltMask | cControlMask | cMetaMask | cOSMask;
|
||||
|
||||
nsXBLPrototypeHandler::nsXBLPrototypeHandler(const PRUnichar* aEvent,
|
||||
const PRUnichar* aPhase,
|
||||
@ -496,6 +499,8 @@ nsXBLPrototypeHandler::DispatchXULKeyCommand(nsIDOMEvent* aEvent)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// XXX We should use widget::Modifiers for supporting all modifiers.
|
||||
|
||||
bool isAlt = false;
|
||||
bool isControl = false;
|
||||
bool isShift = false;
|
||||
@ -646,11 +651,12 @@ PRInt32 nsXBLPrototypeHandler::KeyToMask(PRInt32 key)
|
||||
{
|
||||
case nsIDOMKeyEvent::DOM_VK_META:
|
||||
return cMeta | cMetaMask;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN:
|
||||
return cOS | cOSMask;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
return cAlt | cAltMask;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_CONTROL:
|
||||
default:
|
||||
@ -757,6 +763,8 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
||||
mKeyMask |= cAlt | cAltMask;
|
||||
else if (PL_strcmp(token, "meta") == 0)
|
||||
mKeyMask |= cMeta | cMetaMask;
|
||||
else if (PL_strcmp(token, "os") == 0)
|
||||
mKeyMask |= cOS | cOSMask;
|
||||
else if (PL_strcmp(token, "control") == 0)
|
||||
mKeyMask |= cControl | cControlMask;
|
||||
else if (PL_strcmp(token, "accel") == 0)
|
||||
@ -764,7 +772,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
||||
else if (PL_strcmp(token, "access") == 0)
|
||||
mKeyMask |= KeyToMask(kMenuAccessKey);
|
||||
else if (PL_strcmp(token, "any") == 0)
|
||||
mKeyMask &= ~(mKeyMask << 4);
|
||||
mKeyMask &= ~(mKeyMask << 5);
|
||||
|
||||
token = nsCRT::strtok( newStr, ", \t", &newStr );
|
||||
}
|
||||
@ -853,32 +861,38 @@ bool
|
||||
nsXBLPrototypeHandler::ModifiersMatchMask(nsIDOMUIEvent* aEvent,
|
||||
bool aIgnoreShiftKey)
|
||||
{
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aEvent));
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aEvent));
|
||||
nsEvent* event = aEvent->GetInternalNSEvent();
|
||||
NS_ENSURE_TRUE(event && NS_IS_INPUT_EVENT(event), false);
|
||||
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(event);
|
||||
|
||||
bool keyPresent;
|
||||
if (mKeyMask & cMetaMask) {
|
||||
key ? key->GetMetaKey(&keyPresent) : mouse->GetMetaKey(&keyPresent);
|
||||
if (keyPresent != ((mKeyMask & cMeta) != 0))
|
||||
if (inputEvent->IsMeta() != ((mKeyMask & cMeta) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyMask & cOSMask) {
|
||||
if (inputEvent->IsOS() != ((mKeyMask & cOS) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyMask & cShiftMask && !aIgnoreShiftKey) {
|
||||
key ? key->GetShiftKey(&keyPresent) : mouse->GetShiftKey(&keyPresent);
|
||||
if (keyPresent != ((mKeyMask & cShift) != 0))
|
||||
if (inputEvent->IsShift() != ((mKeyMask & cShift) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyMask & cAltMask) {
|
||||
key ? key->GetAltKey(&keyPresent) : mouse->GetAltKey(&keyPresent);
|
||||
if (keyPresent != ((mKeyMask & cAlt) != 0))
|
||||
if (inputEvent->IsAlt() != ((mKeyMask & cAlt) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyMask & cControlMask) {
|
||||
key ? key->GetCtrlKey(&keyPresent) : mouse->GetCtrlKey(&keyPresent);
|
||||
if (keyPresent != ((mKeyMask & cControl) != 0))
|
||||
if (inputEvent->IsControl() != ((mKeyMask & cControl) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -889,13 +903,13 @@ nsXBLPrototypeHandler::Read(nsIScriptContext* aContext, nsIObjectInputStream* aS
|
||||
{
|
||||
nsresult rv = aStream->Read8(&mPhase);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Read8(&mKeyMask);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Read8(&mType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Read8(&mMisc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->Read32(reinterpret_cast<PRUint32*>(&mKeyMask));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint32 detail;
|
||||
rv = aStream->Read32(&detail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -931,12 +945,12 @@ nsXBLPrototypeHandler::Write(nsIScriptContext* aContext, nsIObjectOutputStream*
|
||||
nsresult rv = aStream->Write8(type);
|
||||
rv = aStream->Write8(mPhase);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write8(mKeyMask);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write8(mType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write8(mMisc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write32(static_cast<PRUint32>(mKeyMask));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write32(mDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -172,11 +172,13 @@ protected:
|
||||
static const PRInt32 cAlt;
|
||||
static const PRInt32 cControl;
|
||||
static const PRInt32 cMeta;
|
||||
static const PRInt32 cOS;
|
||||
|
||||
static const PRInt32 cShiftMask;
|
||||
static const PRInt32 cAltMask;
|
||||
static const PRInt32 cControlMask;
|
||||
static const PRInt32 cMetaMask;
|
||||
static const PRInt32 cOSMask;
|
||||
|
||||
static const PRInt32 cAllModifiers;
|
||||
|
||||
@ -193,8 +195,6 @@ protected:
|
||||
|
||||
// The following four values make up 32 bits.
|
||||
PRUint8 mPhase; // The phase (capturing, bubbling)
|
||||
PRUint8 mKeyMask; // Which modifier keys this event handler expects to have down
|
||||
// in order to be matched.
|
||||
PRUint8 mType; // The type of the handler. The handler is either a XUL key
|
||||
// handler, an XBL "command" event, or a normal XBL event with
|
||||
// accompanying JavaScript. The high bit is used to indicate
|
||||
@ -203,6 +203,9 @@ protected:
|
||||
// stores whether or not we're a key code or char code.
|
||||
// For mouse events, stores the clickCount.
|
||||
|
||||
PRInt32 mKeyMask; // Which modifier keys this event handler expects to have down
|
||||
// in order to be matched.
|
||||
|
||||
// The primary filter information for mouse/key events.
|
||||
PRInt32 mDetail; // For key events, contains a charcode or keycode. For
|
||||
// mouse events, stores the button info.
|
||||
|
@ -33,6 +33,7 @@ NS_IMPL_ISUPPORTS1(nsMenuBarListener, nsIDOMEventListener)
|
||||
#define MODIFIER_CONTROL 2
|
||||
#define MODIFIER_ALT 4
|
||||
#define MODIFIER_META 8
|
||||
#define MODIFIER_OS 16
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -86,6 +87,8 @@ void nsMenuBarListener::InitAccessKey()
|
||||
mAccessKeyMask = MODIFIER_ALT;
|
||||
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_META)
|
||||
mAccessKeyMask = MODIFIER_META;
|
||||
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_WIN)
|
||||
mAccessKeyMask = MODIFIER_OS;
|
||||
|
||||
mAccessKeyFocuses = Preferences::GetBool("ui.key.menuAccessKeyFocuses");
|
||||
}
|
||||
@ -270,23 +273,29 @@ PRUint32
|
||||
nsMenuBarListener::GetModifiers(nsIDOMKeyEvent* aKeyEvent)
|
||||
{
|
||||
PRUint32 modifiers = 0;
|
||||
bool modifier;
|
||||
nsInputEvent* inputEvent =
|
||||
static_cast<nsInputEvent*>(aKeyEvent->GetInternalNSEvent());
|
||||
MOZ_ASSERT(inputEvent);
|
||||
|
||||
aKeyEvent->GetShiftKey(&modifier);
|
||||
if (modifier)
|
||||
if (inputEvent->IsShift()) {
|
||||
modifiers |= MODIFIER_SHIFT;
|
||||
}
|
||||
|
||||
aKeyEvent->GetCtrlKey(&modifier);
|
||||
if (modifier)
|
||||
if (inputEvent->IsControl()) {
|
||||
modifiers |= MODIFIER_CONTROL;
|
||||
}
|
||||
|
||||
aKeyEvent->GetAltKey(&modifier);
|
||||
if (modifier)
|
||||
if (inputEvent->IsAlt()) {
|
||||
modifiers |= MODIFIER_ALT;
|
||||
}
|
||||
|
||||
aKeyEvent->GetMetaKey(&modifier);
|
||||
if (modifier)
|
||||
if (inputEvent->IsMeta()) {
|
||||
modifiers |= MODIFIER_META;
|
||||
}
|
||||
|
||||
if (inputEvent->IsOS()) {
|
||||
modifiers |= MODIFIER_OS;
|
||||
}
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
|
@ -1094,12 +1094,14 @@ nsMenuFrame::BuildAcceleratorText(bool aNotify)
|
||||
nsAutoString altText;
|
||||
nsAutoString metaText;
|
||||
nsAutoString controlText;
|
||||
nsAutoString osText;
|
||||
nsAutoString modifierSeparator;
|
||||
|
||||
nsContentUtils::GetShiftText(shiftText);
|
||||
nsContentUtils::GetAltText(altText);
|
||||
nsContentUtils::GetMetaText(metaText);
|
||||
nsContentUtils::GetControlText(controlText);
|
||||
nsContentUtils::GetOSText(osText);
|
||||
nsContentUtils::GetModifierSeparatorText(modifierSeparator);
|
||||
|
||||
while (token) {
|
||||
@ -1110,6 +1112,8 @@ nsMenuFrame::BuildAcceleratorText(bool aNotify)
|
||||
accelText += altText;
|
||||
else if (PL_strcmp(token, "meta") == 0)
|
||||
accelText += metaText;
|
||||
else if (PL_strcmp(token, "os") == 0)
|
||||
accelText += osText;
|
||||
else if (PL_strcmp(token, "control") == 0)
|
||||
accelText += controlText;
|
||||
else if (PL_strcmp(token, "accel") == 0) {
|
||||
@ -1119,6 +1123,10 @@ nsMenuFrame::BuildAcceleratorText(bool aNotify)
|
||||
accelText += metaText;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN:
|
||||
accelText += osText;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
accelText += altText;
|
||||
break;
|
||||
|
@ -1317,13 +1317,13 @@ pref("security.csp.debug", false);
|
||||
|
||||
// Modifier key prefs: default to Windows settings,
|
||||
// menu access key = alt, accelerator key = control.
|
||||
// Use 17 for Ctrl, 18 for Alt, 224 for Meta, 0 for none. Mac settings in macprefs.js
|
||||
// Use 17 for Ctrl, 18 for Alt, 224 for Meta, 91 for Win, 0 for none. Mac settings in macprefs.js
|
||||
pref("ui.key.accelKey", 17);
|
||||
pref("ui.key.menuAccessKey", 18);
|
||||
pref("ui.key.generalAccessKey", -1);
|
||||
|
||||
// If generalAccessKey is -1, use the following two prefs instead.
|
||||
// Use 0 for disabled, 1 for Shift, 2 for Ctrl, 4 for Alt, 8 for Meta
|
||||
// Use 0 for disabled, 1 for Shift, 2 for Ctrl, 4 for Alt, 8 for Meta, 16 for Win
|
||||
// (values can be combined, e.g. 5 for Alt+Shift)
|
||||
pref("ui.key.chromeAccess", 4);
|
||||
pref("ui.key.contentAccess", 5);
|
||||
|
@ -23,6 +23,7 @@ var keysToTest = [
|
||||
["k-v-scy", "V", { ctrlKey: true } ],
|
||||
["", "V", { altKey: true } ],
|
||||
["", "V", { metaKey: true } ],
|
||||
["", "V", { osKey: true } ],
|
||||
["k-v-scy", "V", { shiftKey: true, ctrlKey: true } ],
|
||||
["", "V", { shiftKey: true, ctrlKey: true, altKey: true } ],
|
||||
["k-e-y", "E", { } ],
|
||||
@ -30,8 +31,16 @@ var keysToTest = [
|
||||
["", "E", { ctrlKey: true } ],
|
||||
["", "E", { altKey: true } ],
|
||||
["", "E", { metaKey: true } ],
|
||||
["", "E", { osKey: true } ],
|
||||
["k-d-a", "D", { altKey: true } ],
|
||||
["k-8-m", "8", { metaKey: true } ],
|
||||
["", "8", { metaKey: true, osKey: true } ],
|
||||
["k-a-o", "A", { osKey: true } ],
|
||||
["", "A", { osKey: true, metaKey: true } ],
|
||||
["k-b-myo", "B", { osKey: true } ],
|
||||
["k-b-myo", "B", { osKey: true, metaKey: true } ],
|
||||
["k-f-oym", "F", { metaKey: true } ],
|
||||
["k-f-oym", "F", { metaKey: true, osKey: true } ],
|
||||
["k-c-scaym", "C", { metaKey: true } ],
|
||||
["k-c-scaym", "C", { shiftKey: true, ctrlKey: true, altKey: true, metaKey: true } ],
|
||||
["", "V", { shiftKey: true, ctrlKey: true, altKey: true } ],
|
||||
@ -148,6 +157,9 @@ SimpleTest.waitForFocus(runTest);
|
||||
<key id="k-v-scy" key="v" modifiers="shift any control" oncommand="checkKey(event)"/>
|
||||
<key id="k-e-y" key="e" modifiers="any" oncommand="checkKey(event)"/>
|
||||
<key id="k-8-m" key="8" modifiers="meta" oncommand="checkKey(event)"/>
|
||||
<key id="k-a-o" key="a" modifiers="os" oncommand="checkKey(event)"/>
|
||||
<key id="k-b-myo" key="b" modifiers="meta any os" oncommand="checkKey(event)"/>
|
||||
<key id="k-f-oym" key="f" modifiers="os any meta" oncommand="checkKey(event)"/>
|
||||
<key id="k-c-scaym" key="c" modifiers="shift control alt any meta" oncommand="checkKey(event)"/>
|
||||
<key id="k-h-l" key="h" modifiers="accel" oncommand="checkKey(event)"/>
|
||||
<key id="k-j-s" key="j" modifiers="access" oncommand="checkKey(event)"/>
|
||||
|
@ -12,6 +12,9 @@ VK_SHIFT=\u21e7
|
||||
#the command key - clover leaf symbol (ctrl-q)
|
||||
VK_META=\u2318
|
||||
|
||||
#the win key - never generated by native key event
|
||||
VK_WIN=win
|
||||
|
||||
#the option/alt key - splitting tracks symbol (ctrl-g)
|
||||
VK_ALT=\u2325
|
||||
|
||||
|
@ -12,6 +12,9 @@ VK_SHIFT=Shift
|
||||
#the command key
|
||||
VK_META=Meta
|
||||
|
||||
#the win key (Super key and Hyper keys are mapped to DOM Win key)
|
||||
VK_WIN=Win
|
||||
|
||||
#the alt key
|
||||
VK_ALT=Alt
|
||||
|
||||
|
@ -12,6 +12,9 @@ VK_SHIFT=Shift
|
||||
#the command key
|
||||
VK_META=Meta
|
||||
|
||||
#the win key
|
||||
VK_WIN=Win
|
||||
|
||||
#the alt key
|
||||
VK_ALT=Alt
|
||||
|
||||
|
@ -1186,9 +1186,11 @@ KeymapWrapper::InitKeypressEvent(nsKeyEvent& aKeyEvent,
|
||||
// If the event causes inputting a character, keyCode must be zero.
|
||||
aKeyEvent.keyCode = 0;
|
||||
|
||||
// If Ctrl or Alt or Meta is pressed, we need to append the key details
|
||||
// for handling shortcut key. Otherwise, we have no additional work.
|
||||
if (!aKeyEvent.IsControl() && !aKeyEvent.IsAlt() && !aKeyEvent.IsMeta()) {
|
||||
// If Ctrl or Alt or Meta or OS is pressed, we need to append the key
|
||||
// details for handling shortcut key. Otherwise, we have no additional
|
||||
// work.
|
||||
if (!aKeyEvent.IsControl() && !aKeyEvent.IsAlt() &&
|
||||
!aKeyEvent.IsMeta() && !aKeyEvent.IsOS()) {
|
||||
PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS,
|
||||
("KeymapWrapper(%p): InitKeypressEvent, "
|
||||
"keyCode=0x%02X, charCode=0x%08X",
|
||||
|
@ -1802,6 +1802,17 @@ enum nsDragDropEventStatus {
|
||||
nsDragDropEventStatus_eDrop
|
||||
};
|
||||
|
||||
#define NS_IS_INPUT_EVENT(evnt) \
|
||||
(((evnt)->eventStructType == NS_INPUT_EVENT) || \
|
||||
((evnt)->eventStructType == NS_ACCESSIBLE_EVENT) || \
|
||||
((evnt)->eventStructType == NS_MOUSE_EVENT) || \
|
||||
((evnt)->eventStructType == NS_KEY_EVENT) || \
|
||||
((evnt)->eventStructType == NS_TEXT_EVENT) || \
|
||||
((evnt)->eventStructType == NS_TOUCH_EVENT) || \
|
||||
((evnt)->eventStructType == NS_DRAG_EVENT) || \
|
||||
((evnt)->eventStructType == NS_MOUSE_SCROLL_EVENT) || \
|
||||
((evnt)->eventStructType == NS_MOZTOUCH_EVENT) || \
|
||||
((evnt)->eventStructType == NS_SIMPLE_GESTURE_EVENT))
|
||||
|
||||
#define NS_IS_MOUSE_EVENT(evnt) \
|
||||
(((evnt)->message == NS_MOUSE_BUTTON_DOWN) || \
|
||||
|
@ -6383,7 +6383,7 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
|
||||
// Enter and backspace are always handled here to avoid for example the
|
||||
// confusion between ctrl-enter and ctrl-J.
|
||||
if (DOMKeyCode == NS_VK_RETURN || DOMKeyCode == NS_VK_BACK ||
|
||||
((aModKeyState.IsControl() || aModKeyState.IsAlt())
|
||||
((aModKeyState.IsControl() || aModKeyState.IsAlt() || aModKeyState.IsWin())
|
||||
&& !isDeadKey && KeyboardLayout::IsPrintableCharKey(virtualKeyCode)))
|
||||
{
|
||||
// Remove a possible WM_CHAR or WM_SYSCHAR messages from the message queue.
|
||||
@ -6472,7 +6472,8 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
|
||||
return result;
|
||||
}
|
||||
else if (!aModKeyState.IsControl() && !aModKeyState.IsAlt() &&
|
||||
KeyboardLayout::IsPrintableCharKey(virtualKeyCode)) {
|
||||
!aModKeyState.IsWin() &&
|
||||
KeyboardLayout::IsPrintableCharKey(virtualKeyCode)) {
|
||||
// If this is simple KeyDown event but next message is not WM_CHAR,
|
||||
// this event may not input text, so we should ignore this event.
|
||||
// See bug 314130.
|
||||
|
Loading…
Reference in New Issue
Block a user