-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 1c17172..89937cf 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -252,143 +252,145 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
252 | p.drawLine(x, y, x, y + keyHeight); | 252 | p.drawLine(x, y, x, y + keyHeight); |
253 | 253 | ||
254 | x += keyWidthPix; | 254 | x += keyWidthPix; |
255 | } | 255 | } |
256 | 256 | ||
257 | 257 | ||
258 | } | 258 | } |
259 | p.drawLine(0, height() - 1, width(), height() - 1); | 259 | p.drawLine(0, height() - 1, width(), height() - 1); |
260 | p.drawLine(width() - 1, 0, width() - 1, height()); | 260 | p.drawLine(width() - 1, 0, width() - 1, height()); |
261 | } | 261 | } |
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | 265 | ||
266 | /* Keyboard::mousePressEvent {{{1 */ | 266 | /* Keyboard::mousePressEvent {{{1 */ |
267 | void Keyboard::mousePressEvent(QMouseEvent *e) | 267 | void Keyboard::mousePressEvent(QMouseEvent *e) |
268 | { | 268 | { |
269 | int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; | 269 | int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; |
270 | if (row > 5) row = 5; | 270 | if (row > 5) row = 5; |
271 | 271 | ||
272 | // figure out the column | 272 | // figure out the column |
273 | int col = 0; | 273 | int col = 0; |
274 | for (int w = 0; e->x() >= w; col++) | 274 | for (int w = 0; e->x() >= w; col++) |
275 | if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys | 275 | if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys |
276 | w += keys->width(row,col) * defaultKeyWidth; | 276 | w += keys->width(row,col) * defaultKeyWidth; |
277 | else break; | 277 | else break; |
278 | 278 | ||
279 | if (col <= 0) return; | 279 | if (col <= 0) return; |
280 | 280 | ||
281 | col --; // rewind one... | 281 | col --; // rewind one... |
282 | 282 | ||
283 | qkeycode = keys->qcode(row, col); | 283 | qkeycode = keys->qcode(row, col); |
284 | unicode = keys->uni(row, col); | 284 | unicode = keys->uni(row, col); |
285 | 285 | ||
286 | // might need to repaint if two or more of the same keys. | 286 | // might need to repaint if two or more of the same keys. |
287 | // should be faster if just paint one key even though multiple keys exist. | 287 | // should be faster if just paint one key even though multiple keys exist. |
288 | bool need_repaint = FALSE; | 288 | bool need_repaint = FALSE; |
289 | 289 | ||
290 | if (unicode == 0) { // either Qt char, or nothing | 290 | if (unicode == 0) { // either Qt char, or nothing |
291 | 291 | ||
292 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard | 292 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard |
293 | 293 | ||
294 | if ( configdlg ) { | 294 | if ( configdlg ) { |
295 | delete (ConfigDlg *) configdlg; | 295 | delete (ConfigDlg *) configdlg; |
296 | configdlg = 0; | 296 | configdlg = 0; |
297 | } | 297 | } |
298 | else { | 298 | else { |
299 | configdlg = new ConfigDlg (); | 299 | configdlg = new ConfigDlg (); |
300 | connect(configdlg, SIGNAL(setMapToDefault()), | 300 | connect(configdlg, SIGNAL(setMapToDefault()), |
301 | this, SLOT(setMapToDefault())); | 301 | this, SLOT(setMapToDefault())); |
302 | connect(configdlg, SIGNAL(setMapToFile(QString)), | 302 | connect(configdlg, SIGNAL(setMapToFile(QString)), |
303 | this, SLOT(setMapToFile(QString))); | 303 | this, SLOT(setMapToFile(QString))); |
304 | connect(configdlg, SIGNAL(pickboardToggled(bool)), | 304 | connect(configdlg, SIGNAL(pickboardToggled(bool)), |
305 | this, SLOT(togglePickboard(bool))); | 305 | this, SLOT(togglePickboard(bool))); |
306 | connect(configdlg, SIGNAL(repeatToggled(bool)), | 306 | connect(configdlg, SIGNAL(repeatToggled(bool)), |
307 | this, SLOT(toggleRepeat(bool))); | 307 | this, SLOT(toggleRepeat(bool))); |
308 | connect(configdlg, SIGNAL(reloadKeyboard()), | 308 | connect(configdlg, SIGNAL(reloadKeyboard()), |
309 | this, SLOT(reloadKeyboard())); | 309 | this, SLOT(reloadKeyboard())); |
310 | configdlg->showMaximized(); | 310 | configdlg->showMaximized(); |
311 | configdlg->show(); | 311 | configdlg->show(); |
312 | configdlg->raise(); | 312 | configdlg->raise(); |
313 | } | 313 | } |
314 | 314 | ||
315 | } else if (qkeycode == Qt::Key_Control) { | 315 | } else if (qkeycode == Qt::Key_Control) { |
316 | need_repaint = TRUE; | ||
316 | 317 | ||
317 | if (ctrl) { | 318 | if (ctrl) { |
318 | 319 | ||
319 | *ctrl = 0; | 320 | *ctrl = 0; |
320 | ctrl = 0; | 321 | ctrl = 0; |
321 | 322 | ||
322 | } else { | 323 | } else { |
323 | 324 | ||
324 | ctrl = keys->pressedPtr(row, col); | 325 | ctrl = keys->pressedPtr(row, col); |
325 | need_repaint = TRUE; | 326 | need_repaint = TRUE; |
326 | *ctrl = !keys->pressed(row, col); | 327 | *ctrl = !keys->pressed(row, col); |
327 | 328 | ||
328 | } | 329 | } |
329 | 330 | ||
330 | } else if (qkeycode == Qt::Key_Alt) { | 331 | } else if (qkeycode == Qt::Key_Alt) { |
332 | need_repaint = TRUE; | ||
331 | 333 | ||
332 | if (alt) { | 334 | if (alt) { |
333 | *alt = 0; | 335 | *alt = 0; |
334 | alt = 0; | 336 | alt = 0; |
335 | 337 | ||
336 | } else { | 338 | } else { |
337 | 339 | ||
338 | alt = keys->pressedPtr(row, col); | 340 | alt = keys->pressedPtr(row, col); |
339 | need_repaint = TRUE; | 341 | need_repaint = TRUE; |
340 | *alt = !keys->pressed(row, col); | 342 | *alt = !keys->pressed(row, col); |
341 | } | 343 | } |
342 | 344 | ||
343 | } else if (qkeycode == Qt::Key_Shift) { | 345 | } else if (qkeycode == Qt::Key_Shift) { |
344 | need_repaint = TRUE; | 346 | need_repaint = TRUE; |
345 | 347 | ||
346 | if (shift) { | 348 | if (shift) { |
347 | *shift = 0; | 349 | *shift = 0; |
348 | shift = 0; | 350 | shift = 0; |
349 | } | 351 | } |
350 | else { | 352 | else { |
351 | shift = keys->pressedPtr(row, col); | 353 | shift = keys->pressedPtr(row, col); |
352 | *shift = 1; | 354 | *shift = 1; |
353 | if (lock) { | 355 | if (lock) { |
354 | *lock = 0; | 356 | *lock = 0; |
355 | lock = 0; | 357 | lock = 0; |
356 | } | 358 | } |
357 | } | 359 | } |
358 | if (meta) { | 360 | if (meta) { |
359 | 361 | ||
360 | *meta = 0; | 362 | *meta = 0; |
361 | meta = 0; | 363 | meta = 0; |
362 | } | 364 | } |
363 | 365 | ||
364 | } else if (qkeycode == Qt::Key_CapsLock) { | 366 | } else if (qkeycode == Qt::Key_CapsLock) { |
365 | need_repaint = TRUE; | 367 | need_repaint = TRUE; |
366 | 368 | ||
367 | if (lock) { | 369 | if (lock) { |
368 | *lock = 0; | 370 | *lock = 0; |
369 | lock = 0; | 371 | lock = 0; |
370 | } | 372 | } |
371 | else { | 373 | else { |
372 | lock = keys->pressedPtr(row, col);; | 374 | lock = keys->pressedPtr(row, col);; |
373 | *lock = 1; | 375 | *lock = 1; |
374 | if (shift) { | 376 | if (shift) { |
375 | *shift = 0; | 377 | *shift = 0; |
376 | shift = 0; | 378 | shift = 0; |
377 | } | 379 | } |
378 | } | 380 | } |
379 | if (meta) { | 381 | if (meta) { |
380 | 382 | ||
381 | *meta = 0; | 383 | *meta = 0; |
382 | meta = 0; | 384 | meta = 0; |
383 | } | 385 | } |
384 | 386 | ||
385 | } else if (qkeycode == Qt::Key_Meta) { | 387 | } else if (qkeycode == Qt::Key_Meta) { |
386 | need_repaint = TRUE; | 388 | need_repaint = TRUE; |
387 | 389 | ||
388 | if (meta) { | 390 | if (meta) { |
389 | *meta = 0; | 391 | *meta = 0; |
390 | meta = 0; | 392 | meta = 0; |
391 | 393 | ||
392 | } else { | 394 | } else { |
393 | 395 | ||
394 | meta = keys->pressedPtr(row, col); | 396 | meta = keys->pressedPtr(row, col); |