summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index d8ade69..a5b19c0 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -1,9 +1,10 @@
1#include "function_keyboard.h" 1#include "function_keyboard.h"
2#include <qsizepolicy.h> 2#include <qsizepolicy.h>
3#include <qwindowsystem_qws.h> 3#include <qevent.h>
4#include <qapplication.h>
4 5
5FunctionKeyboard::FunctionKeyboard(QWidget *parent) : 6FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
6 QFrame(parent), numRows(1), numCols(11), 7 QFrame(parent), numRows(1), numCols(11),
7 pressedRow(0), pressedCol(0) { 8 pressedRow(0), pressedCol(0) {
8 9
9 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); 10 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
@@ -89,21 +90,25 @@ void FunctionKeyboard::paintKey(int row, int col) {
89 90
90} 91}
91 92
92void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { 93void FunctionKeyboard::mousePressEvent(QMouseEvent *e) {
93 94
94 pressedRow = e->y() / keyHeight; 95 pressedRow = e->y() / keyHeight;
95 pressedCol = e->x() / keyWidth; 96 pressedCol = (int) (e->x() / keyWidth);
96 97
97 paintKey(pressedRow, pressedCol); 98 paintKey(pressedRow, pressedCol);
98 99
99 // emit that sucker! 100 // emit that sucker!
100 FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; 101 FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)];
101 //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0); 102 //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0);
102 //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0); 103 //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0);
103 //qwsServer->sendKeyEvent(0x41, 0, 0, 1, 0); 104 //qwsServer->sendKeyEvent(0x41, 0, 0, 1, 0);
105
106 QKeyEvent ke(QEvent::KeyPress, k.getQ(), k.getU(), 0);
107 QApplication::sendEvent(this, &ke);
108
104} 109}
105 110
106void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { 111void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) {
107 112
108 if (pressedRow != -1 && pressedRow != -1) { 113 if (pressedRow != -1 && pressedRow != -1) {
109 114
@@ -111,12 +116,14 @@ void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) {
111 int col = pressedCol; pressedCol = -1; 116 int col = pressedCol; pressedCol = -1;
112 paintKey(row, col); 117 paintKey(row, col);
113 118
114 FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; 119 FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)];
115 //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0); 120 //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0);
116 //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0); 121 //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0);
122 QKeyEvent ke(QEvent::KeyRelease, k.getQ(), k.getU(), 0);
123 QApplication::sendEvent(this, &ke);
117 } 124 }
118 125
119} 126}
120 127
121 128
122void FunctionKeyboard::resizeEvent(QResizeEvent*) { 129void FunctionKeyboard::resizeEvent(QResizeEvent*) {