Please, all, try again with this. Works for me on qt and xforms.
Kornel, if you still have the currency problem, please post -dbg key
again (and to the list not privately ...)
regards
john
Index: lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.385
diff -u -r1.385 lyxfunc.C
--- lyxfunc.C 27 Nov 2002 10:30:10 -0000 1.385
+++ lyxfunc.C 7 Dec 2002 21:29:47 -0000
@@ -171,6 +171,7 @@
}
if (keysym->isModifier()) {
+ lyxerr[Debug::KEY] << "isModifier true" << endl;
return;
}
@@ -214,16 +215,16 @@
owner->message(keyseq.print());
}
+
if (action == LFUN_UNKNOWN_ACTION) {
- // It is unknown, but what if we remove all
- // the modifiers? (Lgb)
- action = keyseq.addkey(keysym, key_modifier::none);
-
- lyxerr[Debug::KEY] << "Removing modifiers...\n"
- << "Action now set to ["
- << action << ']' << endl;
-
- if (action == LFUN_UNKNOWN_ACTION) {
+ // Hmm, we didn't match any of the keysequences. See
+ // if it's normal insertable text not already covered
+ // by a binding
+ if (keysym->isText() && keyseq.length() == 1) {
+ lyxerr[Debug::KEY] << "isText() is true, inserting." << endl;
+ action = LFUN_SELFINSERT;
+ } else {
+ lyxerr[Debug::KEY] << "Unknown, !isText() - giving up" << endl;
owner->message(_("Unknown function."));
return;
}
@@ -233,6 +234,7 @@
char c = keysym->getISOEncoded();
string argument;
+ // FIXME: why ...
if (c != 0)
argument = c;
Index: frontends/qt2/QLyXKeySym.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLyXKeySym.h,v
retrieving revision 1.8
diff -u -r1.8 QLyXKeySym.h
--- frontends/qt2/QLyXKeySym.h 20 Oct 2002 01:48:27 -0000 1.8
+++ frontends/qt2/QLyXKeySym.h 7 Dec 2002 21:29:47 -0000
@@ -50,6 +50,9 @@
/// return the LyX symbolic name
virtual string getSymbolName() const;
+ /// Is this normal insertable text ? (last ditch attempt only)
+ virtual bool isText() const;
+
/**
* Return the value of the keysym into the local ISO encoding.
* This converts the LyXKeySym to a 8-bit encoded character.
Index: frontends/qt2/qlkey.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/qlkey.h,v
retrieving revision 1.16
diff -u -r1.16 qlkey.h
--- frontends/qt2/qlkey.h 4 Dec 2002 11:06:03 -0000 1.16
+++ frontends/qt2/qlkey.h 7 Dec 2002 21:29:54 -0000
@@ -34,10 +34,6 @@
case Qt::Key_Meta:
case Qt::Key_Alt:
return true;
-
- // AltGr becomes Key_unknown on at least one keyboard
- case Qt::Key_unknown:
- return true;
}
return false;
}
Index: frontends/qt2/QLyXKeySym.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLyXKeySym.C,v
retrieving revision 1.11
diff -u -r1.11 QLyXKeySym.C
--- frontends/qt2/QLyXKeySym.C 4 Dec 2002 17:40:16 -0000 1.11
+++ frontends/qt2/QLyXKeySym.C 7 Dec 2002 21:29:54 -0000
@@ -34,6 +34,7 @@
{
key_ = ev->key();
text_ = ev->text();
+ lyxerr[Debug::KEY] << "Setting key to " << key_ << ", " << text_ << endl;
}
@@ -47,13 +48,17 @@
bool QLyXKeySym::isOK() const
{
- return ! key_ == 0;
+ bool const ok(!(text_.isEmpty() && key_ == Qt::Key_unknown));
+ lyxerr[Debug::KEY] << "isOK is " << ok << endl;
+ return ok;
}
-
+
bool QLyXKeySym::isModifier() const
{
- return q_is_modifier(key_);
+ bool const mod(q_is_modifier(key_));
+ lyxerr[Debug::KEY] << "isMod is " << mod << endl;
+ return mod;
}
@@ -78,6 +83,20 @@
}
+bool QLyXKeySym::isText() const
+{
+ if (text_.isEmpty()) {
+ lyxerr[Debug::KEY] << "text_ empty, isText() == false" << endl;
+ return false;
+ }
+
+ QChar const c(text_[0]);
+ lyxerr[Debug::KEY] << "isText for key " << key_
+ << " isPrint is " << c.isPrint() << endl;
+ return c.isPrint();
+}
+
+
bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
{
// note we ignore text_ here (non-strict ==), because
Index: frontends/LyXKeySym.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/LyXKeySym.h,v
retrieving revision 1.6
diff -u -r1.6 LyXKeySym.h
--- frontends/LyXKeySym.h 21 Oct 2002 14:58:58 -0000 1.6
+++ frontends/LyXKeySym.h 7 Dec 2002 21:29:54 -0000
@@ -36,6 +36,9 @@
/// Is this a modifier key only?
virtual bool isModifier() const = 0;
+ /// Is this normal insertable text ? (last ditch attempt only)
+ virtual bool isText() const { return false; }
+
/// What is the symbolic name of this key? F.ex. "Return" or "c"
virtual string getSymbolName() const = 0;