summaryrefslogtreecommitdiff
path: root/src/bin/keyin.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-09-14 23:01:32 +0200
committerBoris Faure <billiob@gmail.com>2015-09-14 23:01:32 +0200
commite8bd673f209b4c96390510d801ccd96e7ecf48cf (patch)
treee910045421819519613498a59242ec019a77484f /src/bin/keyin.c
parentd844278723d7f15f5b7a43b0ee93f3378beeaf08 (diff)
send ctrl[1-0] to term if "going to tab#" is not possible. Closes T2723
Diffstat (limited to 'src/bin/keyin.c')
-rw-r--r--src/bin/keyin.c116
1 files changed, 60 insertions, 56 deletions
diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index b17f4fa..4de4006 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -7,6 +7,7 @@
7#include "termio.h" 7#include "termio.h"
8#include "termcmd.h" 8#include "termcmd.h"
9#include "keyin.h" 9#include "keyin.h"
10#include "win.h"
10 11
11typedef struct _Tty_Key Tty_Key; 12typedef struct _Tty_Key Tty_Key;
12typedef struct _Key_Values Key_Values; 13typedef struct _Key_Values Key_Values;
@@ -352,25 +353,28 @@ keyin_handle_up(Keys_Handler *khdl, Evas_Event_Key_Up *ev)
352/* {{{ Callbacks */ 353/* {{{ Callbacks */
353 354
354static Eina_Bool 355static Eina_Bool
355cb_term_prev(Evas_Object *term) 356cb_term_prev(Evas_Object *termio_obj)
356{ 357{
357 evas_object_smart_callback_call(term, "prev", NULL); 358 evas_object_smart_callback_call(termio_obj, "prev", NULL);
358 return EINA_TRUE; 359 return EINA_TRUE;
359} 360}
360 361
361static Eina_Bool 362static Eina_Bool
362cb_term_next(Evas_Object *term) 363cb_term_next(Evas_Object *termio_obj)
363{ 364{
364 evas_object_smart_callback_call(term, "next", NULL); 365 evas_object_smart_callback_call(termio_obj, "next", NULL);
365 return EINA_TRUE; 366 return EINA_TRUE;
366} 367}
367 368
368#define CB_TAB(N)\ 369#define CB_TAB(N) \
369static Eina_Bool \ 370static Eina_Bool \
370cb_tab_##N(Evas_Object *term) \ 371cb_tab_##N(Evas_Object *termio_obj) \
371{ \ 372{ \
372 evas_object_smart_callback_call(term, "tab,"#N, NULL); \ 373 int n = (N == 0) ? 9 : N - 1; \
373 return EINA_TRUE; \ 374 Term *term = termio_term_get(termio_obj); \
375 if (!term) \
376 return EINA_FALSE; \
377 return term_tab_go(term, n); \
374} 378}
375 379
376CB_TAB(0) 380CB_TAB(0)
@@ -386,94 +390,94 @@ CB_TAB(9)
386#undef CB_TAB 390#undef CB_TAB
387 391
388static Eina_Bool 392static Eina_Bool
389cb_cmd_box(Evas_Object *term) 393cb_cmd_box(Evas_Object *termio_obj)
390{ 394{
391 evas_object_smart_callback_call(term, "cmdbox", NULL); 395 evas_object_smart_callback_call(termio_obj, "cmdbox", NULL);
392 return EINA_TRUE; 396 return EINA_TRUE;
393} 397}
394 398
395static Eina_Bool 399static Eina_Bool
396cb_split_h(Evas_Object *term) 400cb_split_h(Evas_Object *termio_obj)
397{ 401{
398 evas_object_smart_callback_call(term, "split,h", NULL); 402 evas_object_smart_callback_call(termio_obj, "split,h", NULL);
399 return EINA_TRUE; 403 return EINA_TRUE;
400} 404}
401 405
402static Eina_Bool 406static Eina_Bool
403cb_split_v(Evas_Object *term) 407cb_split_v(Evas_Object *termio_obj)
404{ 408{
405 evas_object_smart_callback_call(term, "split,v", NULL); 409 evas_object_smart_callback_call(termio_obj, "split,v", NULL);
406 return EINA_TRUE; 410 return EINA_TRUE;
407} 411}
408 412
409static Eina_Bool 413static Eina_Bool
410cb_tab_new(Evas_Object *term) 414cb_tab_new(Evas_Object *termio_obj)
411{ 415{
412 evas_object_smart_callback_call(term, "new", NULL); 416 evas_object_smart_callback_call(termio_obj, "new", NULL);
413 return EINA_TRUE; 417 return EINA_TRUE;
414} 418}
415 419
416static Eina_Bool 420static Eina_Bool
417cb_exited(Evas_Object *term) 421cb_exited(Evas_Object *termio_obj)
418{ 422{
419 evas_object_smart_callback_call(term, "exited", NULL); 423 evas_object_smart_callback_call(termio_obj, "exited", NULL);
420 return EINA_TRUE; 424 return EINA_TRUE;
421} 425}
422 426
423static Eina_Bool 427static Eina_Bool
424cb_tab_select(Evas_Object *term) 428cb_tab_select(Evas_Object *termio_obj)
425{ 429{
426 evas_object_smart_callback_call(term, "select", NULL); 430 evas_object_smart_callback_call(termio_obj, "select", NULL);
427 return EINA_TRUE; 431 return EINA_TRUE;
428} 432}
429 433
430static Eina_Bool 434static Eina_Bool
431cb_copy_clipboard(Evas_Object *term) 435cb_copy_clipboard(Evas_Object *termio_obj)
432{ 436{
433 Termpty *ty = termio_pty_get(term); 437 Termpty *ty = termio_pty_get(termio_obj);
434 438
435 if (!ty || !ty->selection.is_active) 439 if (!ty || !ty->selection.is_active)
436 return EINA_FALSE; 440 return EINA_FALSE;
437 termio_take_selection(term, ELM_SEL_TYPE_CLIPBOARD); 441 termio_take_selection(termio_obj, ELM_SEL_TYPE_CLIPBOARD);
438 return EINA_TRUE; 442 return EINA_TRUE;
439} 443}
440 444
441static Eina_Bool 445static Eina_Bool
442cb_paste_clipboard(Evas_Object *term) 446cb_paste_clipboard(Evas_Object *termio_obj)
443{ 447{
444 termio_paste_selection(term, ELM_SEL_TYPE_CLIPBOARD); 448 termio_paste_selection(termio_obj, ELM_SEL_TYPE_CLIPBOARD);
445 return EINA_TRUE; 449 return EINA_TRUE;
446} 450}
447 451
448static Eina_Bool 452static Eina_Bool
449cb_paste_primary(Evas_Object *term) 453cb_paste_primary(Evas_Object *termio_obj)
450{ 454{
451 termio_paste_selection(term, ELM_SEL_TYPE_PRIMARY); 455 termio_paste_selection(termio_obj, ELM_SEL_TYPE_PRIMARY);
452 return EINA_TRUE; 456 return EINA_TRUE;
453} 457}
454 458
455static Eina_Bool 459static Eina_Bool
456cb_copy_primary(Evas_Object *term) 460cb_copy_primary(Evas_Object *termio_obj)
457{ 461{
458 Termpty *ty = termio_pty_get(term); 462 Termpty *ty = termio_pty_get(termio_obj);
459 463
460 if (!ty || !ty->selection.is_active) 464 if (!ty || !ty->selection.is_active)
461 return EINA_FALSE; 465 return EINA_FALSE;
462 termio_take_selection(term, ELM_SEL_TYPE_PRIMARY); 466 termio_take_selection(termio_obj, ELM_SEL_TYPE_PRIMARY);
463 return EINA_TRUE; 467 return EINA_TRUE;
464} 468}
465 469
466static Eina_Bool 470static Eina_Bool
467cb_miniview(Evas_Object *term) 471cb_miniview(Evas_Object *termio_obj)
468{ 472{
469 term_miniview_toggle(termio_term_get(term)); 473 term_miniview_toggle(termio_term_get(termio_obj));
470 return EINA_TRUE; 474 return EINA_TRUE;
471} 475}
472 476
473static Eina_Bool 477static Eina_Bool
474cb_win_fullscreen(Evas_Object *term) 478cb_win_fullscreen(Evas_Object *termio_obj)
475{ 479{
476 Evas_Object *win = termio_win_get(term); 480 Evas_Object *win = termio_win_get(termio_obj);
477 Eina_Bool fullscreen; 481 Eina_Bool fullscreen;
478 482
479 if (!win) 483 if (!win)
@@ -484,78 +488,78 @@ cb_win_fullscreen(Evas_Object *term)
484} 488}
485 489
486static Eina_Bool 490static Eina_Bool
487cb_increase_font_size(Evas_Object *term) 491cb_increase_font_size(Evas_Object *termio_obj)
488{ 492{
489 termcmd_do(term, NULL, NULL, "f+"); 493 termcmd_do(termio_obj, NULL, NULL, "f+");
490 return EINA_TRUE; 494 return EINA_TRUE;
491} 495}
492 496
493static Eina_Bool 497static Eina_Bool
494cb_decrease_font_size(Evas_Object *term) 498cb_decrease_font_size(Evas_Object *termio_obj)
495{ 499{
496 termcmd_do(term, NULL, NULL, "f-"); 500 termcmd_do(termio_obj, NULL, NULL, "f-");
497 return EINA_TRUE; 501 return EINA_TRUE;
498} 502}
499 503
500static Eina_Bool 504static Eina_Bool
501cb_reset_font_size(Evas_Object *term) 505cb_reset_font_size(Evas_Object *termio_obj)
502{ 506{
503 termcmd_do(term, NULL, NULL, "f"); 507 termcmd_do(termio_obj, NULL, NULL, "f");
504 return EINA_TRUE; 508 return EINA_TRUE;
505} 509}
506 510
507static Eina_Bool 511static Eina_Bool
508cb_big_font_size(Evas_Object *term) 512cb_big_font_size(Evas_Object *termio_obj)
509{ 513{
510 termcmd_do(term, NULL, NULL, "fb"); 514 termcmd_do(termio_obj, NULL, NULL, "fb");
511 return EINA_TRUE; 515 return EINA_TRUE;
512} 516}
513 517
514static Eina_Bool 518static Eina_Bool
515cb_scroll_up_page(Evas_Object *term) 519cb_scroll_up_page(Evas_Object *termio_obj)
516{ 520{
517 Termpty *ty = termio_pty_get(term); 521 Termpty *ty = termio_pty_get(termio_obj);
518 522
519 if (!ty || ty->altbuf) 523 if (!ty || ty->altbuf)
520 return EINA_FALSE; 524 return EINA_FALSE;
521 525
522 termio_scroll_delta(term, 1, 1); 526 termio_scroll_delta(termio_obj, 1, 1);
523 return EINA_TRUE; 527 return EINA_TRUE;
524} 528}
525 529
526static Eina_Bool 530static Eina_Bool
527cb_scroll_down_page(Evas_Object *term) 531cb_scroll_down_page(Evas_Object *termio_obj)
528{ 532{
529 Termpty *ty = termio_pty_get(term); 533 Termpty *ty = termio_pty_get(termio_obj);
530 534
531 if (!ty || ty->altbuf) 535 if (!ty || ty->altbuf)
532 return EINA_FALSE; 536 return EINA_FALSE;
533 537
534 termio_scroll_delta(term, -1, 1); 538 termio_scroll_delta(termio_obj, -1, 1);
535 return EINA_TRUE; 539 return EINA_TRUE;
536} 540}
537 541
538static Eina_Bool 542static Eina_Bool
539cb_scroll_up_line(Evas_Object *term) 543cb_scroll_up_line(Evas_Object *termio_obj)
540{ 544{
541 Termpty *ty = termio_pty_get(term); 545 Termpty *ty = termio_pty_get(termio_obj);
542 546
543 if (!ty || ty->altbuf) 547 if (!ty || ty->altbuf)
544 return EINA_FALSE; 548 return EINA_FALSE;
545 549
546 termio_scroll_delta(term, 1, 0); 550 termio_scroll_delta(termio_obj, 1, 0);
547 return EINA_TRUE; 551 return EINA_TRUE;
548} 552}
549 553
550static Eina_Bool 554static Eina_Bool
551cb_scroll_down_line(Evas_Object *term) 555cb_scroll_down_line(Evas_Object *termio_obj)
552{ 556{
553 Termpty *ty = termio_pty_get(term); 557 Termpty *ty = termio_pty_get(termio_obj);
554 558
555 if (!ty || ty->altbuf) 559 if (!ty || ty->altbuf)
556 return EINA_FALSE; 560 return EINA_FALSE;
557 561
558 termio_scroll_delta(term, -1, 0); 562 termio_scroll_delta(termio_obj, -1, 0);
559 return EINA_TRUE; 563 return EINA_TRUE;
560} 564}
561 565