forked from enlightenment/terminology
send ctrl[1-0] to term if "going to tab#" is not possible. Closes T2723
This commit is contained in:
parent
d844278723
commit
e8bd673f20
116
src/bin/keyin.c
116
src/bin/keyin.c
|
@ -7,6 +7,7 @@
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "termcmd.h"
|
#include "termcmd.h"
|
||||||
#include "keyin.h"
|
#include "keyin.h"
|
||||||
|
#include "win.h"
|
||||||
|
|
||||||
typedef struct _Tty_Key Tty_Key;
|
typedef struct _Tty_Key Tty_Key;
|
||||||
typedef struct _Key_Values Key_Values;
|
typedef struct _Key_Values Key_Values;
|
||||||
|
@ -352,25 +353,28 @@ keyin_handle_up(Keys_Handler *khdl, Evas_Event_Key_Up *ev)
|
||||||
/* {{{ Callbacks */
|
/* {{{ Callbacks */
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_prev(Evas_Object *term)
|
cb_term_prev(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(term, "prev", NULL);
|
evas_object_smart_callback_call(termio_obj, "prev", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_next(Evas_Object *term)
|
cb_term_next(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(term, "next", NULL);
|
evas_object_smart_callback_call(termio_obj, "next", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CB_TAB(N)\
|
#define CB_TAB(N) \
|
||||||
static Eina_Bool \
|
static Eina_Bool \
|
||||||
cb_tab_##N(Evas_Object *term) \
|
cb_tab_##N(Evas_Object *termio_obj) \
|
||||||
{ \
|
{ \
|
||||||
evas_object_smart_callback_call(term, "tab,"#N, NULL); \
|
int n = (N == 0) ? 9 : N - 1; \
|
||||||
return EINA_TRUE; \
|
Term *term = termio_term_get(termio_obj); \
|
||||||
|
if (!term) \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
return term_tab_go(term, n); \
|
||||||
}
|
}
|
||||||
|
|
||||||
CB_TAB(0)
|
CB_TAB(0)
|
||||||
|
@ -386,94 +390,94 @@ CB_TAB(9)
|
||||||
#undef CB_TAB
|
#undef CB_TAB
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_cmd_box(Evas_Object *term)
|
cb_cmd_box(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(term, "cmdbox", NULL);
|
evas_object_smart_callback_call(termio_obj, "cmdbox", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_split_h(Evas_Object *term)
|
cb_split_h(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(term, "split,h", NULL);
|
evas_object_smart_callback_call(termio_obj, "split,h", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_split_v(Evas_Object *term)
|
cb_split_v(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(term, "split,v", NULL);
|
evas_object_smart_callback_call(termio_obj, "split,v", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_tab_new(Evas_Object *term)
|
cb_tab_new(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(term, "new", NULL);
|
evas_object_smart_callback_call(termio_obj, "new", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_exited(Evas_Object *term)
|
cb_exited(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(term, "exited", NULL);
|
evas_object_smart_callback_call(termio_obj, "exited", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_tab_select(Evas_Object *term)
|
cb_tab_select(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(term, "select", NULL);
|
evas_object_smart_callback_call(termio_obj, "select", NULL);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_copy_clipboard(Evas_Object *term)
|
cb_copy_clipboard(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Termpty *ty = termio_pty_get(term);
|
Termpty *ty = termio_pty_get(termio_obj);
|
||||||
|
|
||||||
if (!ty || !ty->selection.is_active)
|
if (!ty || !ty->selection.is_active)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
termio_take_selection(term, ELM_SEL_TYPE_CLIPBOARD);
|
termio_take_selection(termio_obj, ELM_SEL_TYPE_CLIPBOARD);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_paste_clipboard(Evas_Object *term)
|
cb_paste_clipboard(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
termio_paste_selection(term, ELM_SEL_TYPE_CLIPBOARD);
|
termio_paste_selection(termio_obj, ELM_SEL_TYPE_CLIPBOARD);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_paste_primary(Evas_Object *term)
|
cb_paste_primary(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
termio_paste_selection(term, ELM_SEL_TYPE_PRIMARY);
|
termio_paste_selection(termio_obj, ELM_SEL_TYPE_PRIMARY);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_copy_primary(Evas_Object *term)
|
cb_copy_primary(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Termpty *ty = termio_pty_get(term);
|
Termpty *ty = termio_pty_get(termio_obj);
|
||||||
|
|
||||||
if (!ty || !ty->selection.is_active)
|
if (!ty || !ty->selection.is_active)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
termio_take_selection(term, ELM_SEL_TYPE_PRIMARY);
|
termio_take_selection(termio_obj, ELM_SEL_TYPE_PRIMARY);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_miniview(Evas_Object *term)
|
cb_miniview(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
term_miniview_toggle(termio_term_get(term));
|
term_miniview_toggle(termio_term_get(termio_obj));
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_win_fullscreen(Evas_Object *term)
|
cb_win_fullscreen(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Evas_Object *win = termio_win_get(term);
|
Evas_Object *win = termio_win_get(termio_obj);
|
||||||
Eina_Bool fullscreen;
|
Eina_Bool fullscreen;
|
||||||
|
|
||||||
if (!win)
|
if (!win)
|
||||||
|
@ -484,78 +488,78 @@ cb_win_fullscreen(Evas_Object *term)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_increase_font_size(Evas_Object *term)
|
cb_increase_font_size(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
termcmd_do(term, NULL, NULL, "f+");
|
termcmd_do(termio_obj, NULL, NULL, "f+");
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_decrease_font_size(Evas_Object *term)
|
cb_decrease_font_size(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
termcmd_do(term, NULL, NULL, "f-");
|
termcmd_do(termio_obj, NULL, NULL, "f-");
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_reset_font_size(Evas_Object *term)
|
cb_reset_font_size(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
termcmd_do(term, NULL, NULL, "f");
|
termcmd_do(termio_obj, NULL, NULL, "f");
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_big_font_size(Evas_Object *term)
|
cb_big_font_size(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
termcmd_do(term, NULL, NULL, "fb");
|
termcmd_do(termio_obj, NULL, NULL, "fb");
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_scroll_up_page(Evas_Object *term)
|
cb_scroll_up_page(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Termpty *ty = termio_pty_get(term);
|
Termpty *ty = termio_pty_get(termio_obj);
|
||||||
|
|
||||||
if (!ty || ty->altbuf)
|
if (!ty || ty->altbuf)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
termio_scroll_delta(term, 1, 1);
|
termio_scroll_delta(termio_obj, 1, 1);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_scroll_down_page(Evas_Object *term)
|
cb_scroll_down_page(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Termpty *ty = termio_pty_get(term);
|
Termpty *ty = termio_pty_get(termio_obj);
|
||||||
|
|
||||||
if (!ty || ty->altbuf)
|
if (!ty || ty->altbuf)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
termio_scroll_delta(term, -1, 1);
|
termio_scroll_delta(termio_obj, -1, 1);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_scroll_up_line(Evas_Object *term)
|
cb_scroll_up_line(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Termpty *ty = termio_pty_get(term);
|
Termpty *ty = termio_pty_get(termio_obj);
|
||||||
|
|
||||||
if (!ty || ty->altbuf)
|
if (!ty || ty->altbuf)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
termio_scroll_delta(term, 1, 0);
|
termio_scroll_delta(termio_obj, 1, 0);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_scroll_down_line(Evas_Object *term)
|
cb_scroll_down_line(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
Termpty *ty = termio_pty_get(term);
|
Termpty *ty = termio_pty_get(termio_obj);
|
||||||
|
|
||||||
if (!ty || ty->altbuf)
|
if (!ty || ty->altbuf)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
termio_scroll_delta(term, -1, 0);
|
termio_scroll_delta(termio_obj, -1, 0);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1708,8 +1708,8 @@ _tabbar_fill(Tabs *tabs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
Eina_Bool
|
||||||
_tab_go(Term *term, int tnum)
|
term_tab_go(Term *term, int tnum)
|
||||||
{
|
{
|
||||||
Term_Container *tc = term->container,
|
Term_Container *tc = term->container,
|
||||||
*child = tc;
|
*child = tc;
|
||||||
|
@ -1733,33 +1733,13 @@ _tab_go(Term *term, int tnum)
|
||||||
tc = tc->parent;
|
tc = tc->parent;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tab_item == tabs->current)
|
if (tab_item != tabs->current)
|
||||||
return;
|
tab_item->tc->focus(tab_item->tc, child);
|
||||||
tab_item->tc->focus(tab_item->tc, child);
|
return EINA_TRUE;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CB_TAB(TAB) \
|
|
||||||
static void \
|
|
||||||
_cb_tab_##TAB(void *data, Evas_Object *obj EINA_UNUSED, \
|
|
||||||
void *event EINA_UNUSED) \
|
|
||||||
{ \
|
|
||||||
_tab_go(data, TAB - 1); \
|
|
||||||
}
|
|
||||||
|
|
||||||
CB_TAB(1)
|
|
||||||
CB_TAB(2)
|
|
||||||
CB_TAB(3)
|
|
||||||
CB_TAB(4)
|
|
||||||
CB_TAB(5)
|
|
||||||
CB_TAB(6)
|
|
||||||
CB_TAB(7)
|
|
||||||
CB_TAB(8)
|
|
||||||
CB_TAB(9)
|
|
||||||
CB_TAB(10)
|
|
||||||
#undef CB_TAB
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_tabs_selector_cb_selected(void *data,
|
_tabs_selector_cb_selected(void *data,
|
||||||
Evas_Object *obj EINA_UNUSED,
|
Evas_Object *obj EINA_UNUSED,
|
||||||
|
@ -4092,16 +4072,6 @@ term_new(Win *wn, Config *config, const char *cmd,
|
||||||
evas_object_smart_callback_add(o, "split,v", _cb_split_v, term);
|
evas_object_smart_callback_add(o, "split,v", _cb_split_v, term);
|
||||||
evas_object_smart_callback_add(o, "title,change", _cb_title, term);
|
evas_object_smart_callback_add(o, "title,change", _cb_title, term);
|
||||||
evas_object_smart_callback_add(o, "icon,change", _cb_icon, term);
|
evas_object_smart_callback_add(o, "icon,change", _cb_icon, term);
|
||||||
evas_object_smart_callback_add(o, "tab,1", _cb_tab_1, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,2", _cb_tab_2, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,3", _cb_tab_3, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,4", _cb_tab_4, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,5", _cb_tab_5, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,6", _cb_tab_6, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,7", _cb_tab_7, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,8", _cb_tab_8, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,9", _cb_tab_9, term);
|
|
||||||
evas_object_smart_callback_add(o, "tab,0", _cb_tab_10, term);
|
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
|
|
|
@ -15,6 +15,7 @@ Evas_Object *term_termio_get(Term *term);
|
||||||
Evas_Object *term_miniview_get(Term *term);
|
Evas_Object *term_miniview_get(Term *term);
|
||||||
void term_miniview_toggle(Term *term);
|
void term_miniview_toggle(Term *term);
|
||||||
void term_miniview_hide(Term *term);
|
void term_miniview_hide(Term *term);
|
||||||
|
Eina_Bool term_tab_go(Term *term, int tnum);
|
||||||
|
|
||||||
void split_horizontally(Evas_Object *win, Evas_Object *term, const char *cmd);
|
void split_horizontally(Evas_Object *win, Evas_Object *term, const char *cmd);
|
||||||
void split_vertically(Evas_Object *win, Evas_Object *term, const char *cmd);
|
void split_vertically(Evas_Object *win, Evas_Object *term, const char *cmd);
|
||||||
|
|
Loading…
Reference in New Issue