summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/widget_layer.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp
index ab25919..afded92 100644
--- a/noncore/apps/opie-console/widget_layer.cpp
+++ b/noncore/apps/opie-console/widget_layer.cpp
@@ -46,106 +46,103 @@ WidgetLayer::~WidgetLayer()
46{ 46{
47 // clean up 47 // clean up
48 delete m_image; 48 delete m_image;
49} 49}
50 50
51 51
52QSize WidgetLayer::sizeHint() 52QSize WidgetLayer::sizeHint()
53{ 53{
54 return size(); 54 return size();
55} 55}
56 56
57 57
58/* --------------------------------- audio ---------------------------------- */ 58/* --------------------------------- audio ---------------------------------- */
59 59
60void WidgetLayer::bell() 60void WidgetLayer::bell()
61{ 61{
62 QApplication::beep(); 62 QApplication::beep();
63} 63}
64 64
65bool WidgetLayer::eventFilter( QObject *obj, QEvent *e ) 65bool WidgetLayer::eventFilter( QObject *obj, QEvent *e )
66{ 66{
67 if ( (e->type() == QEvent::Accel || 67 if ( (e->type() == QEvent::Accel ||
68 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { 68 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
69 static_cast<QKeyEvent *>( e )->ignore(); 69 static_cast<QKeyEvent *>( e )->ignore();
70 return true; 70 return true;
71 } 71 }
72 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 72 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
73 return false; // not us 73 return false; // not us
74 74
75#ifdef FAKE_CTRL_AND_ALT 75#ifdef FAKE_CTRL_AND_ALT
76 static bool control = false; 76 static bool control = false;
77 static bool alt = false; 77 static bool alt = false;
78// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
79 bool dele = false; 78 bool dele = false;
80 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 79 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
81 QKeyEvent* ke = (QKeyEvent*)e; 80 QKeyEvent* ke = (QKeyEvent*)e;
82 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 81 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
83 switch (ke->key()) { 82 switch (ke->key()) {
84 case Key_F9: // let this be "Control" 83 case Key_F9: // let this be "Control"
85 control = keydown; 84 control = keydown;
86 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 85 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
87 dele=TRUE; 86 dele=TRUE;
88 break; 87 break;
89 case Key_F13: // let this be "Alt" 88 case Key_F13: // let this be "Alt"
90 alt = keydown; 89 alt = keydown;
91 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); 90 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
92 dele=TRUE; 91 dele=TRUE;
93 break; 92 break;
94 default: 93 default:
95 if ( control ) { 94 if ( control ) {
96 int a = toupper(ke->ascii())-64; 95 int a = toupper(ke->ascii())-64;
97 if ( a >= 0 && a < ' ' ) { 96 if ( a >= 0 && a < ' ' ) {
98 e = new QKeyEvent(e->type(), ke->key(), 97 e = new QKeyEvent(e->type(), ke->key(),
99 a, ke->state()|ControlButton, 98 a, ke->state()|ControlButton,
100QChar(a,0)); 99QChar(a,0));
101 dele=TRUE; 100 dele=TRUE;
102 } 101 }
103 } 102 }
104 if ( alt ) { 103 if ( alt ) {
105 e = new QKeyEvent(e->type(), ke->key(), 104 e = new QKeyEvent(e->type(), ke->key(),
106 ke->ascii(), ke->state()|AltButton, ke->text()); 105 ke->ascii(), ke->state()|AltButton, ke->text());
107 dele=TRUE; 106 dele=TRUE;
108 } 107 }
109 } 108 }
110 } 109 }
111#endif 110#endif
112 111
113 if ( e->type() == QEvent::KeyPress ) { 112 if ( e->type() == QEvent::KeyPress ) {
114 QKeyEvent* ke = (QKeyEvent*)e; 113 QKeyEvent* ke = (QKeyEvent*)e;
115 //actSel=0; // Key stroke implies a screen update, so Widget won't 114 //actSel=0; // Key stroke implies a screen update, so Widget won't
116 // know where the current selection is. 115 // know where the current selection is.
117 116
118// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
119
120 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker 117 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
121 insertText("\\"); // expose 118 insertText("\\"); // expose
122 } else 119 } else
123 emit keyPressed( ke ); // expose 120 emit keyPressed( ke ); // expose
124 ke->accept(); 121 ke->accept();
125#ifdef FAKE_CTRL_AND_ALT 122#ifdef FAKE_CTRL_AND_ALT
126 if ( dele ) delete e; 123 if ( dele ) delete e;
127#endif 124#endif
128 return true; // stop the event 125 return true; // stop the event
129 } 126 }
130 return QFrame::eventFilter( obj, e ); 127 return QFrame::eventFilter( obj, e );
131} 128}
132 129
133 130
134/* --------------------------------- screen --------------------------------- */ 131/* --------------------------------- screen --------------------------------- */
135 132
136 133
137void WidgetLayer::propagateSize() 134void WidgetLayer::propagateSize()
138{ 135{
139 QArray<Character> oldimage = m_image.copy(); 136 QArray<Character> oldimage = m_image.copy();
140 int oldlines = m_lines; 137 int oldlines = m_lines;
141 int oldcolumns = m_columns; 138 int oldcolumns = m_columns;
142 139
143 makeImage(); 140 makeImage();
144 141
145 // copy old image, to reduce flicker 142 // copy old image, to reduce flicker
146 if ( ! oldimage.isEmpty() ) 143 if ( ! oldimage.isEmpty() )
147 { 144 {
148 int lins = QMIN( oldlines, m_lines ); 145 int lins = QMIN( oldlines, m_lines );
149 int cols = QMIN( oldcolumns, m_columns ); 146 int cols = QMIN( oldcolumns, m_columns );
150 for ( int lin = 0; lin < lins; ++lin ) 147 for ( int lin = 0; lin < lins; ++lin )
151 { 148 {