author | ibotty <ibotty> | 2002-10-13 16:56:54 (UTC) |
---|---|---|
committer | ibotty <ibotty> | 2002-10-13 16:56:54 (UTC) |
commit | 495abbf351f29328b52cb055566ef8bec6f466f0 (patch) (unidiff) | |
tree | 7b462124c88f6127bf3f789339ebde9e4a089e35 | |
parent | 19cf7d4ff5a64aff90e31b29072ce30db6a046ec (diff) | |
download | opie-495abbf351f29328b52cb055566ef8bec6f466f0.zip opie-495abbf351f29328b52cb055566ef8bec6f466f0.tar.gz opie-495abbf351f29328b52cb055566ef8bec6f466f0.tar.bz2 |
key presses should be now visible.
-rw-r--r-- | noncore/apps/opie-console/widget_layer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp index 0364e66..6682708 100644 --- a/noncore/apps/opie-console/widget_layer.cpp +++ b/noncore/apps/opie-console/widget_layer.cpp | |||
@@ -9,74 +9,79 @@ | |||
9 | 9 | ||
10 | 10 | ||
11 | #include "widget_layer.h" | 11 | #include "widget_layer.h" |
12 | 12 | ||
13 | #include <qclipboard.h> | 13 | #include <qclipboard.h> |
14 | #include <qregexp.h> | 14 | #include <qregexp.h> |
15 | #include <qglobal.h> | 15 | #include <qglobal.h> |
16 | 16 | ||
17 | #include <string.h> | 17 | #include <string.h> |
18 | //#include < | 18 | //#include < |
19 | 19 | ||
20 | #include "common.h" | 20 | #include "common.h" |
21 | 21 | ||
22 | 22 | ||
23 | 23 | ||
24 | WidgetLayer::WidgetLayer( const Profile &config, QWidget *parent, const char *name ) : QFrame( parent, name ) | 24 | WidgetLayer::WidgetLayer( const Profile &config, QWidget *parent, const char *name ) : QFrame( parent, name ) |
25 | { | 25 | { |
26 | // get the clipboard | 26 | // get the clipboard |
27 | m_clipboard = QApplication::clipboard(); | 27 | m_clipboard = QApplication::clipboard(); |
28 | 28 | ||
29 | // when data on clipboard changes, clear selection | 29 | // when data on clipboard changes, clear selection |
30 | QObject::connect( (QObject*) m_clipboard, SIGNAL( dataChanged() ), | 30 | QObject::connect( (QObject*) m_clipboard, SIGNAL( dataChanged() ), |
31 | (QObject*)this, SLOT( onClearSelection() ) ); | 31 | (QObject*)this, SLOT( onClearSelection() ) ); |
32 | 32 | ||
33 | // initialize vars: | 33 | // initialize vars: |
34 | m_lines = 1; | 34 | m_lines = 1; |
35 | m_columns = 1; | 35 | m_columns = 1; |
36 | m_resizing = false; | 36 | m_resizing = false; |
37 | 37 | ||
38 | // just for demonstrating | 38 | // just for demonstrating |
39 | //m_image = QArray<Character>( m_lines * m_columns ); | 39 | //m_image = QArray<Character>( m_lines * m_columns ); |
40 | m_image = QArray<Character>( 1 ); | 40 | m_image = QArray<Character>( 1 ); |
41 | |||
42 | // we need to install an event filter, | ||
43 | // to emit keypresses. | ||
44 | qApp->installEventFilter( this ); | ||
41 | 45 | ||
42 | } | 46 | } |
43 | 47 | ||
44 | 48 | ||
45 | WidgetLayer::~WidgetLayer() | 49 | WidgetLayer::~WidgetLayer() |
46 | { | 50 | { |
47 | // clean up | 51 | // clean up |
48 | delete m_image; | 52 | delete m_image; |
49 | } | 53 | } |
50 | 54 | ||
55 | |||
51 | /* --------------------------------- audio ---------------------------------- */ | 56 | /* --------------------------------- audio ---------------------------------- */ |
52 | 57 | ||
53 | void WidgetLayer::bell() | 58 | void WidgetLayer::bell() |
54 | { | 59 | { |
55 | QApplication::beep(); | 60 | QApplication::beep(); |
56 | } | 61 | } |
57 | 62 | ||
58 | bool WidgetLayer::eventFilter( QObject *obj, QEvent *e ) | 63 | bool WidgetLayer::eventFilter( QObject *obj, QEvent *e ) |
59 | { | 64 | { |
60 | if ( (e->type() == QEvent::Accel || | 65 | if ( (e->type() == QEvent::Accel || |
61 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { | 66 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { |
62 | static_cast<QKeyEvent *>( e )->ignore(); | 67 | static_cast<QKeyEvent *>( e )->ignore(); |
63 | return true; | 68 | return true; |
64 | } | 69 | } |
65 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) | 70 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) |
66 | return FALSE; // not us | 71 | return FALSE; // not us |
67 | 72 | ||
68 | #ifdef FAKE_CTRL_AND_ALT | 73 | #ifdef FAKE_CTRL_AND_ALT |
69 | static bool control = FALSE; | 74 | static bool control = FALSE; |
70 | static bool alt = FALSE; | 75 | static bool alt = FALSE; |
71 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 76 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); |
72 | bool dele=FALSE; | 77 | bool dele=FALSE; |
73 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 78 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
74 | QKeyEvent* ke = (QKeyEvent*)e; | 79 | QKeyEvent* ke = (QKeyEvent*)e; |
75 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 80 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
76 | switch (ke->key()) { | 81 | switch (ke->key()) { |
77 | case Key_F9: // let this be "Control" | 82 | case Key_F9: // let this be "Control" |
78 | control = keydown; | 83 | control = keydown; |
79 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 84 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
80 | dele=TRUE; | 85 | dele=TRUE; |
81 | break; | 86 | break; |
82 | case Key_F13: // let this be "Alt" | 87 | case Key_F13: // let this be "Alt" |