[Scummvm-cvs-logs] SF.net SVN: scummvm:[48967] scummvm/trunk/gui/editable.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat May 8 20:30:00 CEST 2010
Revision: 48967
http://scummvm.svn.sourceforge.net/scummvm/?rev=48967&view=rev
Author: lordhoto
Date: 2010-05-08 18:30:00 +0000 (Sat, 08 May 2010)
Log Message:
-----------
Prevent editable widgets from adding various characters when F1-F12 is pressed by the user.
Formerly the code just casted the "ascii" value of the key event to "byte"
and thus truncating the character value. Now that would be fine, if we
would not allow values >= 256 in the ascii field, for example 322 for F8
which in turn resulted in a "B" added to the editable field. I just added
a check for the values being in the byte range before doing the cast,
which fixes this.
Modified Paths:
--------------
scummvm/trunk/gui/editable.cpp
Modified: scummvm/trunk/gui/editable.cpp
===================================================================
--- scummvm/trunk/gui/editable.cpp 2010-05-08 08:15:28 UTC (rev 48966)
+++ scummvm/trunk/gui/editable.cpp 2010-05-08 18:30:00 UTC (rev 48967)
@@ -208,7 +208,7 @@
}
void EditableWidget::defaultKeyDownHandler(Common::KeyState &state, bool &dirty, bool &forcecaret, bool &handled) {
- if (tryInsertChar((byte)state.ascii, _caretPos)) {
+ if (state.ascii < 256 && tryInsertChar((byte)state.ascii, _caretPos)) {
_caretPos++;
dirty = true;
forcecaret = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list