summaryrefslogtreecommitdiff
path: root/src/bin/keyin.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-11-13 23:48:05 +0100
committerBoris Faure <billiob@gmail.com>2018-01-05 00:27:25 +0100
commit39fb41024be68f71d04f6f3a6ef234d2c08d40a3 (patch)
tree9e45df6cc947f6995319e140f315dd6365db9758 /src/bin/keyin.c
parent878def120e38916c7eb6cfce250d4aaf4701ca56 (diff)
early work on multi-input support
Diffstat (limited to 'src/bin/keyin.c')
-rw-r--r--src/bin/keyin.c88
1 files changed, 70 insertions, 18 deletions
diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index 900d289..78601af 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -343,18 +343,62 @@ keyin_handle_up(Keys_Handler *khdl, Evas_Event_Key_Up *ev)
343 { 343 {
344 Ecore_IMF_Event_Key_Up imf_ev; 344 Ecore_IMF_Event_Key_Up imf_ev;
345 ecore_imf_evas_event_key_up_wrap(ev, &imf_ev); 345 ecore_imf_evas_event_key_up_wrap(ev, &imf_ev);
346 if (ecore_imf_context_filter_event 346 ecore_imf_context_filter_event
347 (khdl->imf, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&imf_ev)) 347 (khdl->imf, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&imf_ev);
348 return;
349 } 348 }
350} 349}
351 350
352/* }}} */ 351/* }}} */
353/* {{{ Callbacks */ 352/* {{{ Callbacks */
353#define RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED \
354 Win *wn; \
355 Term *term = termio_term_get(termio_obj); \
356 if (!term) \
357 return EINA_FALSE; \
358 wn = term_win_get(term); \
359 if (!wn) \
360 return EINA_FALSE; \
361 if (win_is_group_action_handled(wn)) \
362 return EINA_FALSE; \
363
364#define RETURN_FALSE_ON_GROUP_INPUT \
365 Win *wn; \
366 Term *term = termio_term_get(termio_obj); \
367 if (!term) \
368 return EINA_FALSE; \
369 wn = term_win_get(term); \
370 if (!wn) \
371 return EINA_FALSE; \
372 if (win_is_group_input(wn)) \
373 return EINA_FALSE; \
374
375static Eina_Bool
376cb_all_group(Evas_Object *termio_obj)
377{
378 RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
379
380 win_toggle_all_group(wn);
381
382 ERR("ALL GROUP");
383 return EINA_TRUE;
384}
385
386static Eina_Bool
387cb_visible_group(Evas_Object *termio_obj)
388{
389 RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
390
391 win_toggle_visible_group(wn);
392
393 ERR("VISIBLE GROUP");
394 return EINA_TRUE;
395}
354 396
355static Eina_Bool 397static Eina_Bool
356cb_term_prev(Evas_Object *termio_obj) 398cb_term_prev(Evas_Object *termio_obj)
357{ 399{
400 RETURN_FALSE_ON_GROUP_INPUT;
401
358 evas_object_smart_callback_call(termio_obj, "prev", NULL); 402 evas_object_smart_callback_call(termio_obj, "prev", NULL);
359 return EINA_TRUE; 403 return EINA_TRUE;
360} 404}
@@ -362,6 +406,8 @@ cb_term_prev(Evas_Object *termio_obj)
362static Eina_Bool 406static Eina_Bool
363cb_term_next(Evas_Object *termio_obj) 407cb_term_next(Evas_Object *termio_obj)
364{ 408{
409 RETURN_FALSE_ON_GROUP_INPUT;
410
365 evas_object_smart_callback_call(termio_obj, "next", NULL); 411 evas_object_smart_callback_call(termio_obj, "next", NULL);
366 return EINA_TRUE; 412 return EINA_TRUE;
367} 413}
@@ -369,9 +415,8 @@ cb_term_next(Evas_Object *termio_obj)
369static Eina_Bool 415static Eina_Bool
370cb_term_up(Evas_Object *termio_obj) 416cb_term_up(Evas_Object *termio_obj)
371{ 417{
372 Term *term = termio_term_get(termio_obj); 418 RETURN_FALSE_ON_GROUP_INPUT;
373 if (!term) 419
374 return EINA_FALSE;
375 term_up(term); 420 term_up(term);
376 return EINA_TRUE; 421 return EINA_TRUE;
377} 422}
@@ -379,9 +424,8 @@ cb_term_up(Evas_Object *termio_obj)
379static Eina_Bool 424static Eina_Bool
380cb_term_down(Evas_Object *termio_obj) 425cb_term_down(Evas_Object *termio_obj)
381{ 426{
382 Term *term = termio_term_get(termio_obj); 427 RETURN_FALSE_ON_GROUP_INPUT;
383 if (!term) 428
384 return EINA_FALSE;
385 term_down(term); 429 term_down(term);
386 return EINA_TRUE; 430 return EINA_TRUE;
387} 431}
@@ -389,9 +433,8 @@ cb_term_down(Evas_Object *termio_obj)
389static Eina_Bool 433static Eina_Bool
390cb_term_left(Evas_Object *termio_obj) 434cb_term_left(Evas_Object *termio_obj)
391{ 435{
392 Term *term = termio_term_get(termio_obj); 436 RETURN_FALSE_ON_GROUP_INPUT;
393 if (!term) 437
394 return EINA_FALSE;
395 term_left(term); 438 term_left(term);
396 return EINA_TRUE; 439 return EINA_TRUE;
397} 440}
@@ -399,9 +442,8 @@ cb_term_left(Evas_Object *termio_obj)
399static Eina_Bool 442static Eina_Bool
400cb_term_right(Evas_Object *termio_obj) 443cb_term_right(Evas_Object *termio_obj)
401{ 444{
402 Term *term = termio_term_get(termio_obj); 445 RETURN_FALSE_ON_GROUP_INPUT;
403 if (!term) 446
404 return EINA_FALSE;
405 term_right(term); 447 term_right(term);
406 return EINA_TRUE; 448 return EINA_TRUE;
407} 449}
@@ -409,6 +451,8 @@ cb_term_right(Evas_Object *termio_obj)
409static Eina_Bool 451static Eina_Bool
410cb_term_new(Evas_Object *termio_obj) 452cb_term_new(Evas_Object *termio_obj)
411{ 453{
454 RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
455
412 char path[PATH_MAX], cwd[PATH_MAX], *cmd; 456 char path[PATH_MAX], cwd[PATH_MAX], *cmd;
413 const char *template = "%s -d %s"; 457 const char *template = "%s -d %s";
414 int length; 458 int length;
@@ -450,10 +494,8 @@ cb_tab_set_title(Evas_Object *termio_obj)
450static Eina_Bool \ 494static Eina_Bool \
451cb_tab_##N(Evas_Object *termio_obj) \ 495cb_tab_##N(Evas_Object *termio_obj) \
452{ \ 496{ \
497 RETURN_FALSE_ON_GROUP_INPUT; \
453 int n = (N == 0) ? 9 : N - 1; \ 498 int n = (N == 0) ? 9 : N - 1; \
454 Term *term = termio_term_get(termio_obj); \
455 if (!term) \
456 return EINA_FALSE; \
457 return term_tab_go(term, n); \ 499 return term_tab_go(term, n); \
458} 500}
459 501
@@ -472,6 +514,7 @@ CB_TAB(9)
472static Eina_Bool 514static Eina_Bool
473cb_cmd_box(Evas_Object *termio_obj) 515cb_cmd_box(Evas_Object *termio_obj)
474{ 516{
517 RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
475 evas_object_smart_callback_call(termio_obj, "cmdbox", NULL); 518 evas_object_smart_callback_call(termio_obj, "cmdbox", NULL);
476 return EINA_TRUE; 519 return EINA_TRUE;
477} 520}
@@ -479,6 +522,7 @@ cb_cmd_box(Evas_Object *termio_obj)
479static Eina_Bool 522static Eina_Bool
480cb_split_h(Evas_Object *termio_obj) 523cb_split_h(Evas_Object *termio_obj)
481{ 524{
525 RETURN_FALSE_ON_GROUP_INPUT;
482 evas_object_smart_callback_call(termio_obj, "split,h", NULL); 526 evas_object_smart_callback_call(termio_obj, "split,h", NULL);
483 return EINA_TRUE; 527 return EINA_TRUE;
484} 528}
@@ -486,6 +530,7 @@ cb_split_h(Evas_Object *termio_obj)
486static Eina_Bool 530static Eina_Bool
487cb_split_v(Evas_Object *termio_obj) 531cb_split_v(Evas_Object *termio_obj)
488{ 532{
533 RETURN_FALSE_ON_GROUP_INPUT;
489 evas_object_smart_callback_call(termio_obj, "split,v", NULL); 534 evas_object_smart_callback_call(termio_obj, "split,v", NULL);
490 return EINA_TRUE; 535 return EINA_TRUE;
491} 536}
@@ -493,6 +538,7 @@ cb_split_v(Evas_Object *termio_obj)
493static Eina_Bool 538static Eina_Bool
494cb_tab_new(Evas_Object *termio_obj) 539cb_tab_new(Evas_Object *termio_obj)
495{ 540{
541 RETURN_FALSE_ON_GROUP_INPUT;
496 evas_object_smart_callback_call(termio_obj, "new", NULL); 542 evas_object_smart_callback_call(termio_obj, "new", NULL);
497 return EINA_TRUE; 543 return EINA_TRUE;
498} 544}
@@ -500,6 +546,7 @@ cb_tab_new(Evas_Object *termio_obj)
500static Eina_Bool 546static Eina_Bool
501cb_close(Evas_Object *termio_obj) 547cb_close(Evas_Object *termio_obj)
502{ 548{
549 RETURN_FALSE_ON_GROUP_INPUT;
503 evas_object_smart_callback_call(termio_obj, "close", NULL); 550 evas_object_smart_callback_call(termio_obj, "close", NULL);
504 return EINA_TRUE; 551 return EINA_TRUE;
505} 552}
@@ -507,6 +554,7 @@ cb_close(Evas_Object *termio_obj)
507static Eina_Bool 554static Eina_Bool
508cb_tab_select(Evas_Object *termio_obj) 555cb_tab_select(Evas_Object *termio_obj)
509{ 556{
557 RETURN_FALSE_ON_GROUP_INPUT;
510 evas_object_smart_callback_call(termio_obj, "select", NULL); 558 evas_object_smart_callback_call(termio_obj, "select", NULL);
511 return EINA_TRUE; 559 return EINA_TRUE;
512} 560}
@@ -557,6 +605,7 @@ cb_miniview(Evas_Object *termio_obj)
557static Eina_Bool 605static Eina_Bool
558cb_win_fullscreen(Evas_Object *termio_obj) 606cb_win_fullscreen(Evas_Object *termio_obj)
559{ 607{
608 RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
560 Evas_Object *win = termio_win_get(termio_obj); 609 Evas_Object *win = termio_win_get(termio_obj);
561 Eina_Bool fullscreen; 610 Eina_Bool fullscreen;
562 611
@@ -707,6 +756,9 @@ static Shortcut_Action _actions[] =
707 {"tab_9", gettext_noop("Switch to terminal tab 9"), cb_tab_9}, 756 {"tab_9", gettext_noop("Switch to terminal tab 9"), cb_tab_9},
708 {"tab_10", gettext_noop("Switch to terminal tab 10"), cb_tab_0}, 757 {"tab_10", gettext_noop("Switch to terminal tab 10"), cb_tab_0},
709 {"tab_title", gettext_noop("Change title"), cb_tab_set_title}, 758 {"tab_title", gettext_noop("Change title"), cb_tab_set_title},
759 {"visible_group", gettext_noop("Toggle whether input goes to all visible terminals"), cb_visible_group},
760 {"all_group", gettext_noop("Toggle whether input goes to all visible terminals"), cb_all_group},
761
710 762
711 {"group", gettext_noop("Font size"), NULL}, 763 {"group", gettext_noop("Font size"), NULL},
712 {"increase_font_size", gettext_noop("Font size up 1"), cb_increase_font_size}, 764 {"increase_font_size", gettext_noop("Font size up 1"), cb_increase_font_size},