forked from enlightenment/terminology
keypad numlock etc. working. shift kp-/+ to change font size. shift
kp/ for copy, shift insert for paste, shift+kp* to reset top 10pt. SVN revision: 72870
This commit is contained in:
parent
666d4223c9
commit
7903d9a81d
|
@ -131,6 +131,7 @@ static const Keyout keyout[] =
|
|||
KEY("F33", "\033[47~"),
|
||||
KEY("F34", "\033[48~"),
|
||||
KEY("F35", "\033[49~"),
|
||||
/*
|
||||
KEY("KP_F1", "\033OP"),
|
||||
KEY("KP_F2", "\033OQ"),
|
||||
KEY("KP_F3", "\033OR"),
|
||||
|
@ -143,16 +144,16 @@ static const Keyout keyout[] =
|
|||
KEY("KP_Decimal", "\033On"),
|
||||
KEY("KP_Divide", "\033Oo"),
|
||||
KEY("KP_0", "\033Op"),
|
||||
KEY("KP_0", "\033Oq"),
|
||||
KEY("KP_0", "\033Or"),
|
||||
KEY("KP_0", "\033Os"),
|
||||
KEY("KP_0", "\033Ot"),
|
||||
KEY("KP_0", "\033Ou"),
|
||||
KEY("KP_0", "\033Ov"),
|
||||
KEY("KP_0", "\033Ow"),
|
||||
KEY("KP_0", "\033Ox"),
|
||||
KEY("KP_0", "\033Oy"),
|
||||
|
||||
KEY("KP_1", "\033Oq"),
|
||||
KEY("KP_2", "\033Or"),
|
||||
KEY("KP_3", "\033Os"),
|
||||
KEY("KP_4", "\033Ot"),
|
||||
KEY("KP_5", "\033Ou"),
|
||||
KEY("KP_6", "\033Ov"),
|
||||
KEY("KP_7", "\033Ow"),
|
||||
KEY("KP_8", "\033Ox"),
|
||||
KEY("KP_9", "\033Oy"),
|
||||
*/
|
||||
KEY(NULL, "END")
|
||||
};
|
||||
|
||||
|
@ -162,14 +163,13 @@ static const Keyout kp_keyout[] =
|
|||
KEY("KP_Right", "\033[C"),
|
||||
KEY("KP_Up", "\033[A"),
|
||||
KEY("KP_Down", "\033[B"),
|
||||
KEY("KP_Home", "\033[7~"),
|
||||
KEY("KP_End", "\033[8~"),
|
||||
KEY("KP_Home", "\033[H"),
|
||||
KEY("KP_End", "\033[F"),
|
||||
KEY("KP_Prior", "\033[5~"),
|
||||
KEY("KP_Next", "\033[6~"),
|
||||
KEY("KP_Insert", "\033[2~"),
|
||||
KEY("KP_Delete", "\033[3~"),
|
||||
KEY("KP_Enter", "\r"),
|
||||
|
||||
KEY(NULL, "END")
|
||||
};
|
||||
|
||||
|
@ -222,15 +222,19 @@ keyin_handle(Termpty *ty, Evas_Event_Key_Down *ev)
|
|||
}
|
||||
if (
|
||||
((ty->state.alt_kp) &&
|
||||
(evas_key_modifier_is_set(ev->modifiers, "Shift"))) ||
|
||||
((!ty->state.alt_kp) &&
|
||||
(!evas_key_modifier_is_set(ev->modifiers, "Shift"))))
|
||||
(evas_key_modifier_is_set(ev->modifiers, "Shift")))
|
||||
// || ((!ty->state.alt_kp) &&
|
||||
// (!evas_key_modifier_is_set(ev->modifiers, "Shift")))
|
||||
)
|
||||
{
|
||||
if (_key_try(ty, kp_keyout, ev)) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_key_try(ty, kps_keyout, ev)) return;
|
||||
if (!evas_key_lock_is_set(ev->locks, "Num_Lock"))
|
||||
{
|
||||
if (_key_try(ty, kp_keyout, ev)) return;
|
||||
}
|
||||
}
|
||||
if (evas_key_modifier_is_set(ev->modifiers, "Control"))
|
||||
{
|
||||
|
|
162
src/bin/termio.c
162
src/bin/termio.c
|
@ -50,6 +50,7 @@ struct _Termio
|
|||
Ecore_IMF_Context *imf;
|
||||
Eina_Bool jump_on_change : 1;
|
||||
Eina_Bool have_sel : 1;
|
||||
Eina_Bool noreqsize : 1;
|
||||
};
|
||||
|
||||
static Evas_Smart *_smart = NULL;
|
||||
|
@ -304,9 +305,10 @@ _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force)
|
|||
sd->grid.h = h;
|
||||
evas_object_resize(sd->cur.obj, sd->font.chw, sd->font.chh);
|
||||
evas_object_size_hint_min_set(obj, sd->font.chw, sd->font.chh);
|
||||
evas_object_size_hint_request_set(obj,
|
||||
sd->font.chw * sd->grid.w,
|
||||
sd->font.chh * sd->grid.h);
|
||||
if (!sd->noreqsize)
|
||||
evas_object_size_hint_request_set(obj,
|
||||
sd->font.chw * sd->grid.w,
|
||||
sd->font.chh * sd->grid.h);
|
||||
termpty_resize(sd->pty, w, h);
|
||||
_smart_calculate(obj);
|
||||
_smart_apply(obj);
|
||||
|
@ -492,6 +494,80 @@ _smart_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
|
|||
_paste_selection(data, ELM_SEL_TYPE_CLIPBOARD);
|
||||
goto end;
|
||||
}
|
||||
else if (!strcmp(ev->keyname, "KP_Add"))
|
||||
{
|
||||
Config *config = termio_config_get(data);
|
||||
|
||||
if (config)
|
||||
{
|
||||
Evas_Coord mw = 1, mh = 1;
|
||||
int gw, gh;
|
||||
|
||||
config->temporary = EINA_TRUE;
|
||||
config->font.size += 1;
|
||||
gw = sd->grid.w;
|
||||
gh = sd->grid.h;
|
||||
evas_object_size_hint_min_get(obj, &mw, &mh);
|
||||
sd->noreqsize = 1;
|
||||
termio_config_update(data);
|
||||
sd->noreqsize = 0;
|
||||
evas_object_size_hint_min_get(data, &mw, &mh);
|
||||
evas_object_data_del(data, "sizedone");
|
||||
evas_object_size_hint_request_set(data, mw * gw, mh * gh);
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
else if (!strcmp(ev->keyname, "KP_Subtract"))
|
||||
{
|
||||
Config *config = termio_config_get(data);
|
||||
|
||||
if (config)
|
||||
{
|
||||
Evas_Coord mw = 1, mh = 1;
|
||||
int gw, gh;
|
||||
|
||||
config->temporary = EINA_TRUE;
|
||||
config->font.size -= 1;
|
||||
gw = sd->grid.w;
|
||||
gh = sd->grid.h;
|
||||
evas_object_size_hint_min_get(obj, &mw, &mh);
|
||||
sd->noreqsize = 1;
|
||||
termio_config_update(data);
|
||||
sd->noreqsize = 0;
|
||||
evas_object_size_hint_min_get(data, &mw, &mh);
|
||||
evas_object_data_del(data, "sizedone");
|
||||
evas_object_size_hint_request_set(data, mw * gw, mh * gh);
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
else if (!strcmp(ev->keyname, "KP_Multiply"))
|
||||
{
|
||||
Config *config = termio_config_get(data);
|
||||
|
||||
if (config)
|
||||
{
|
||||
Evas_Coord mw = 1, mh = 1;
|
||||
int gw, gh;
|
||||
|
||||
config->temporary = EINA_TRUE;
|
||||
config->font.size = 10;
|
||||
gw = sd->grid.w;
|
||||
gh = sd->grid.h;
|
||||
evas_object_size_hint_min_get(obj, &mw, &mh);
|
||||
sd->noreqsize = 1;
|
||||
termio_config_update(data);
|
||||
sd->noreqsize = 0;
|
||||
evas_object_size_hint_min_get(data, &mw, &mh);
|
||||
evas_object_data_del(data, "sizedone");
|
||||
evas_object_size_hint_request_set(data, mw * gw, mh * gh);
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
else if (!strcmp(ev->keyname, "KP_Divide"))
|
||||
{
|
||||
_take_selection(data, ELM_SEL_TYPE_CLIPBOARD);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if term app asked fro kbd lock - dont handle here
|
||||
|
@ -886,6 +962,69 @@ _rep_mouse_move(Evas_Object *obj, Evas_Event_Mouse_Move *ev __UNUSED__, int cx _
|
|||
// not sure what to d here right now so do nothing.
|
||||
}
|
||||
|
||||
static void
|
||||
_selection_dbl_fix(Evas_Object *obj)
|
||||
{
|
||||
Termio *sd;
|
||||
int w = 0;
|
||||
Termcell *cells;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
cells = termpty_cellrow_get(sd->pty, sd->cur.sel2.y - sd->scroll, &w);
|
||||
if (cells)
|
||||
{
|
||||
// if sel2 after sel1
|
||||
if ((sd->cur.sel2.y > sd->cur.sel1.y) ||
|
||||
((sd->cur.sel2.y == sd->cur.sel1.y) &&
|
||||
(sd->cur.sel2.x >= sd->cur.sel1.x)))
|
||||
{
|
||||
if (sd->cur.sel2.x < (w - 1))
|
||||
{
|
||||
if ((cells[sd->cur.sel2.x].codepoint != 0) &&
|
||||
(cells[sd->cur.sel2.x].att.dblwidth))
|
||||
sd->cur.sel2.x++;
|
||||
}
|
||||
}
|
||||
// else sel1 after sel 2
|
||||
else
|
||||
{
|
||||
if (sd->cur.sel2.x > 0)
|
||||
{
|
||||
if ((cells[sd->cur.sel2.x].codepoint == 0) &&
|
||||
(cells[sd->cur.sel2.x].att.dblwidth))
|
||||
sd->cur.sel2.x--;
|
||||
}
|
||||
}
|
||||
}
|
||||
cells = termpty_cellrow_get(sd->pty, sd->cur.sel1.y - sd->scroll, &w);
|
||||
if (cells)
|
||||
{
|
||||
// if sel2 after sel1
|
||||
if ((sd->cur.sel2.y > sd->cur.sel1.y) ||
|
||||
((sd->cur.sel2.y == sd->cur.sel1.y) &&
|
||||
(sd->cur.sel2.x >= sd->cur.sel1.x)))
|
||||
{
|
||||
if (sd->cur.sel1.x > 0)
|
||||
{
|
||||
if ((cells[sd->cur.sel1.x].codepoint == 0) &&
|
||||
(cells[sd->cur.sel1.x].att.dblwidth))
|
||||
sd->cur.sel1.x--;
|
||||
}
|
||||
}
|
||||
// else sel1 after sel 2
|
||||
else
|
||||
{
|
||||
if (sd->cur.sel1.x < (w - 1))
|
||||
{
|
||||
if ((cells[sd->cur.sel1.x].codepoint != 0) &&
|
||||
(cells[sd->cur.sel1.x].att.dblwidth))
|
||||
sd->cur.sel1.x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_smart_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event)
|
||||
{
|
||||
|
@ -913,7 +1052,7 @@ _smart_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__
|
|||
sd->cur.sel1.y = sd->backup.sel1.y;
|
||||
sd->cur.sel2.x = sd->backup.sel2.x;
|
||||
sd->cur.sel2.y = sd->backup.sel2.y;
|
||||
|
||||
_selection_dbl_fix(data);
|
||||
_sel_word_to(data, cx, cy - sd->scroll);
|
||||
}
|
||||
else
|
||||
|
@ -935,6 +1074,7 @@ _smart_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__
|
|||
sd->cur.sel1.y = cy - sd->scroll;
|
||||
sd->cur.sel2.x = cx;
|
||||
sd->cur.sel2.y = cy - sd->scroll;
|
||||
_selection_dbl_fix(data);
|
||||
}
|
||||
_smart_update_queue(data, sd);
|
||||
}
|
||||
|
@ -962,6 +1102,7 @@ _smart_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
|
|||
{
|
||||
sd->cur.sel2.x = cx;
|
||||
sd->cur.sel2.y = cy - sd->scroll;
|
||||
_selection_dbl_fix(data);
|
||||
_smart_update_queue(data, sd);
|
||||
_take_selection(data, ELM_SEL_TYPE_PRIMARY);
|
||||
}
|
||||
|
@ -988,8 +1129,9 @@ _smart_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__
|
|||
sd->cur.sel = 1;
|
||||
}
|
||||
sd->cur.sel2.x = cx;
|
||||
sd->cur.sel2.y = cy - sd->scroll;
|
||||
_smart_update_queue(data, sd);
|
||||
sd->cur.sel2.y = cy - sd->scroll;
|
||||
_selection_dbl_fix(data);
|
||||
_smart_update_queue(data, sd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1497,9 +1639,11 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y)
|
|||
}
|
||||
for (x = start_x; x <= end_x; x++)
|
||||
{
|
||||
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
|
||||
(x < end_x))
|
||||
x++;
|
||||
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth))
|
||||
{
|
||||
if (x < end_x) x++;
|
||||
else break;
|
||||
}
|
||||
if (x >= w) break;
|
||||
if ((cells[x].codepoint == 0) || (cells[x].codepoint == ' '))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue