summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
Side-by-side diff
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (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 1c17172..89937cf 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -268,111 +268,113 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
{
int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1;
if (row > 5) row = 5;
// figure out the column
int col = 0;
for (int w = 0; e->x() >= w; col++)
if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys
w += keys->width(row,col) * defaultKeyWidth;
else break;
if (col <= 0) return;
col --; // rewind one...
qkeycode = keys->qcode(row, col);
unicode = keys->uni(row, col);
// might need to repaint if two or more of the same keys.
// should be faster if just paint one key even though multiple keys exist.
bool need_repaint = FALSE;
if (unicode == 0) { // either Qt char, or nothing
if (qkeycode == Qt::Key_F1) { // toggle the pickboard
if ( configdlg ) {
delete (ConfigDlg *) configdlg;
configdlg = 0;
}
else {
configdlg = new ConfigDlg ();
connect(configdlg, SIGNAL(setMapToDefault()),
this, SLOT(setMapToDefault()));
connect(configdlg, SIGNAL(setMapToFile(QString)),
this, SLOT(setMapToFile(QString)));
connect(configdlg, SIGNAL(pickboardToggled(bool)),
this, SLOT(togglePickboard(bool)));
connect(configdlg, SIGNAL(repeatToggled(bool)),
this, SLOT(toggleRepeat(bool)));
connect(configdlg, SIGNAL(reloadKeyboard()),
this, SLOT(reloadKeyboard()));
configdlg->showMaximized();
configdlg->show();
configdlg->raise();
}
} else if (qkeycode == Qt::Key_Control) {
+ need_repaint = TRUE;
if (ctrl) {
*ctrl = 0;
ctrl = 0;
} else {
ctrl = keys->pressedPtr(row, col);
need_repaint = TRUE;
*ctrl = !keys->pressed(row, col);
}
} else if (qkeycode == Qt::Key_Alt) {
+ need_repaint = TRUE;
if (alt) {
*alt = 0;
alt = 0;
} else {
alt = keys->pressedPtr(row, col);
need_repaint = TRUE;
*alt = !keys->pressed(row, col);
}
} else if (qkeycode == Qt::Key_Shift) {
need_repaint = TRUE;
if (shift) {
*shift = 0;
shift = 0;
}
else {
shift = keys->pressedPtr(row, col);
*shift = 1;
if (lock) {
*lock = 0;
lock = 0;
}
}
if (meta) {
*meta = 0;
meta = 0;
}
} else if (qkeycode == Qt::Key_CapsLock) {
need_repaint = TRUE;
if (lock) {
*lock = 0;
lock = 0;
}
else {
lock = keys->pressedPtr(row, col);;
*lock = 1;
if (shift) {
*shift = 0;
shift = 0;
}
}