Patch from Ben M.: do not accept key events if we do not know what these keys

stand for.

This fixes bug #6043: Windows multimedia keys intercepted



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30389 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-07-06 16:14:20 +00:00
parent 14c5adf034
commit 5784b88f65
3 changed files with 11 additions and 6 deletions

View File

@ -141,10 +141,11 @@ void ShortcutWidget::appendToSequence(QKeyEvent * e)
{
KeySymbol sym;
setKeySymbol(&sym, e);
KeyModifier mod = lyx::q_key_state(e->modifiers());
keysequence_.addkey(sym, mod, lyx::NoModifier);
if (sym.isOK()) {
KeyModifier mod = lyx::q_key_state(e->modifiers());
keysequence_.addkey(sym, mod, lyx::NoModifier);
}
}

View File

@ -638,7 +638,7 @@ void KeySymbol::init(string const & symbolname)
bool KeySymbol::isOK() const
{
bool const ok = !(text_.empty() && key_ == Qt::Key_unknown);
bool const ok = !(text_.empty() && qkey_to_string(key_).empty());
LYXERR(Debug::KEY, "isOK is " << ok);
return ok;
}

View File

@ -902,8 +902,12 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
KeySymbol sym;
setKeySymbol(&sym, ev);
processKeySym(sym, q_key_state(ev->modifiers()));
ev->accept();
if (sym.isOK()) {
processKeySym(sym, q_key_state(ev->modifiers()));
ev->accept();
} else {
ev->ignore();
}
}