summaryrefslogtreecommitdiff
path: root/inputmethods
authorhash <hash>2002-08-21 18:12:55 (UTC)
committer hash <hash>2002-08-21 18:12:55 (UTC)
commit33fb38da29cfb4b29eff08928742b8d6918eb852 (patch) (unidiff)
treedb63fcd49acf5ce9067289ae1a8aac101d43bc11 /inputmethods
parent0a61be3b42b4b152468a5ef2def4a18baeda9b4f (diff)
downloadopie-33fb38da29cfb4b29eff08928742b8d6918eb852.zip
opie-33fb38da29cfb4b29eff08928742b8d6918eb852.tar.gz
opie-33fb38da29cfb4b29eff08928742b8d6918eb852.tar.bz2
fixed segfault when no keymap is installed
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 949164a..d5a7afd 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -256,24 +256,26 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
256void Keyboard::mousePressEvent(QMouseEvent *e) 256void Keyboard::mousePressEvent(QMouseEvent *e)
257{ 257{
258 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; 258 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1;
259 if (row > 5) row = 5; 259 if (row > 5) row = 5;
260 260
261 // figure out the column 261 // figure out the column
262 int col = 0; 262 int col = 0;
263 for (int w = 0; e->x() >= w; col++) 263 for (int w = 0; e->x() >= w; col++)
264 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys 264 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys
265 w += keys->width(row,col) * defaultKeyWidth; 265 w += keys->width(row,col) * defaultKeyWidth;
266 else break; 266 else break;
267 267
268 if (col <= 0) return;
269
268 col --; // rewind one... 270 col --; // rewind one...
269 271
270 qkeycode = keys->qcode(row, col); 272 qkeycode = keys->qcode(row, col);
271 unicode = keys->uni(row, col); 273 unicode = keys->uni(row, col);
272 274
273 // might need to repaint if two or more of the same keys. 275 // might need to repaint if two or more of the same keys.
274 // should be faster if just paint one key even though multiple keys exist. 276 // should be faster if just paint one key even though multiple keys exist.
275 bool need_repaint = FALSE; 277 bool need_repaint = FALSE;
276 278
277 if (unicode == 0) { // either Qt char, or nothing 279 if (unicode == 0) { // either Qt char, or nothing
278 280
279 if (qkeycode == Qt::Key_F1) { // toggle the pickboard 281 if (qkeycode == Qt::Key_F1) { // toggle the pickboard