diff options
Diffstat (limited to 'src/FbTk/TextBox.cc')
-rw-r--r-- | src/FbTk/TextBox.cc | 111 |
1 files changed, 38 insertions, 73 deletions
diff --git a/src/FbTk/TextBox.cc b/src/FbTk/TextBox.cc index b8cdcde..87ad609 100644 --- a/src/FbTk/TextBox.cc +++ b/src/FbTk/TextBox.cc | |||
@@ -230,31 +230,6 @@ void TextBox::keyPressEvent(XKeyEvent &event) { | |||
230 | if ((event.state & ControlMask) == ControlMask) { | 230 | if ((event.state & ControlMask) == ControlMask) { |
231 | 231 | ||
232 | switch (ks) { | 232 | switch (ks) { |
233 | case XK_b: | ||
234 | cursorBackward(); | ||
235 | break; | ||
236 | case XK_f: | ||
237 | cursorForward(); | ||
238 | break; | ||
239 | case XK_a: | ||
240 | cursorHome(); | ||
241 | break; | ||
242 | case XK_e: | ||
243 | cursorEnd(); | ||
244 | break; | ||
245 | case XK_d: | ||
246 | deleteForward(); | ||
247 | break; | ||
248 | case XK_k: | ||
249 | killToEnd(); | ||
250 | break; | ||
251 | case XK_c: | ||
252 | cursorHome(); | ||
253 | m_text = ""; | ||
254 | m_start_pos = 0; | ||
255 | m_cursor_pos = 0; | ||
256 | m_end_pos = 0; | ||
257 | break; | ||
258 | case XK_Left: { | 233 | case XK_Left: { |
259 | unsigned int pos = findEmptySpaceLeft(); | 234 | unsigned int pos = findEmptySpaceLeft(); |
260 | if (pos < m_start_pos){ | 235 | if (pos < m_start_pos){ |
@@ -311,13 +286,6 @@ void TextBox::keyPressEvent(XKeyEvent &event) { | |||
311 | } | 286 | } |
312 | break; | 287 | break; |
313 | } | 288 | } |
314 | } else if ((event.state & ShiftMask)== ShiftMask || | ||
315 | (event.state & 0x80) == 0x80) { // shif and altgr | ||
316 | if (isprint(keychar[0])) { | ||
317 | std::string val; | ||
318 | val += keychar[0]; | ||
319 | insertText(val); | ||
320 | } | ||
321 | } | 289 | } |
322 | 290 | ||
323 | } else { // no state | 291 | } else { // no state |
@@ -341,49 +309,46 @@ void TextBox::keyPressEvent(XKeyEvent &event) { | |||
341 | case XK_Delete: | 309 | case XK_Delete: |
342 | deleteForward(); | 310 | deleteForward(); |
343 | break; | 311 | break; |
344 | default: | 312 | case XK_KP_Insert: |
345 | switch (ks) { | 313 | keychar[0] = '0'; |
346 | case XK_KP_Insert: | 314 | break; |
347 | keychar[0] = '0'; | 315 | case XK_KP_End: |
348 | break; | 316 | keychar[0] = '1'; |
349 | case XK_KP_End: | 317 | break; |
350 | keychar[0] = '1'; | 318 | case XK_KP_Down: |
351 | break; | 319 | keychar[0] = '2'; |
352 | case XK_KP_Down: | 320 | break; |
353 | keychar[0] = '2'; | 321 | case XK_KP_Page_Down: |
354 | break; | 322 | keychar[0] = '3'; |
355 | case XK_KP_Page_Down: | 323 | break; |
356 | keychar[0] = '3'; | 324 | case XK_KP_Left: |
357 | break; | 325 | keychar[0] = '4'; |
358 | case XK_KP_Left: | 326 | break; |
359 | keychar[0] = '4'; | 327 | case XK_KP_Begin: |
360 | break; | 328 | keychar[0] = '5'; |
361 | case XK_KP_Begin: | 329 | break; |
362 | keychar[0] = '5'; | 330 | case XK_KP_Right: |
363 | break; | 331 | keychar[0] = '6'; |
364 | case XK_KP_Right: | 332 | break; |
365 | keychar[0] = '6'; | 333 | case XK_KP_Home: |
366 | break; | 334 | keychar[0] = '7'; |
367 | case XK_KP_Home: | 335 | break; |
368 | keychar[0] = '7'; | 336 | case XK_KP_Up: |
369 | break; | 337 | keychar[0] = '8'; |
370 | case XK_KP_Up: | 338 | break; |
371 | keychar[0] = '8'; | 339 | case XK_KP_Page_Up: |
372 | break; | 340 | keychar[0] = '9'; |
373 | case XK_KP_Page_Up: | 341 | break; |
374 | keychar[0] = '9'; | 342 | case XK_KP_Delete: |
375 | break; | 343 | keychar[0] = ','; |
376 | case XK_KP_Delete: | 344 | break; |
377 | keychar[0] = ','; | ||
378 | break; | ||
379 | }; | ||
380 | if (isprint(keychar[0])) { | ||
381 | std::string val; | ||
382 | val += keychar[0]; | ||
383 | insertText(val); | ||
384 | } | ||
385 | } | 345 | } |
386 | } | 346 | } |
347 | if (isprint(keychar[0])) { | ||
348 | std::string val; | ||
349 | val += keychar[0]; | ||
350 | insertText(val); | ||
351 | } | ||
387 | clear(); | 352 | clear(); |
388 | } | 353 | } |
389 | 354 | ||