terminology: remove trailing whitespace

SVN revision: 72053
This commit is contained in:
Jihoon Kim 2012-06-13 00:26:00 +00:00
parent 42eed700ad
commit d27a42884b
4 changed files with 113 additions and 113 deletions

View File

@ -5,8 +5,8 @@
const char *cmd = NULL; const char *cmd = NULL;
static Evas_Object *win, *bg, *term; static Evas_Object *win, *bg, *term;
static Evas_Object static Evas_Object
*op_frame, *op_box, *op_toolbar, *op_opbox, *op_frame, *op_box, *op_toolbar, *op_opbox,
*op_fontslider, *op_fontlist; *op_fontslider, *op_fontlist;
static Eina_Bool op_out = EINA_FALSE; static Eina_Bool op_out = EINA_FALSE;
@ -28,10 +28,10 @@ static void
_cb_size_hint(void *data, Evas *e, Evas_Object *obj, void *event) _cb_size_hint(void *data, Evas *e, Evas_Object *obj, void *event)
{ {
Evas_Coord mw, mh, rw, rh, w = 0, h = 0; Evas_Coord mw, mh, rw, rh, w = 0, h = 0;
evas_object_size_hint_min_get(obj, &mw, &mh); evas_object_size_hint_min_get(obj, &mw, &mh);
evas_object_size_hint_request_get(obj, &rw, &rh); evas_object_size_hint_request_get(obj, &rw, &rh);
edje_object_size_min_calc(bg, &w, &h); edje_object_size_min_calc(bg, &w, &h);
evas_object_size_hint_min_set(bg, w, h); evas_object_size_hint_min_set(bg, w, h);
elm_win_size_base_set(win, w - mw, h - mh); elm_win_size_base_set(win, w - mw, h - mh);
@ -58,7 +58,7 @@ static void
_update_sizing(void) _update_sizing(void)
{ {
Evas_Coord ow = 0, oh = 0, mw = 1, mh = 1, w, h; Evas_Coord ow = 0, oh = 0, mw = 1, mh = 1, w, h;
evas_object_data_del(term, "sizedone"); evas_object_data_del(term, "sizedone");
termio_config_update(term); termio_config_update(term);
evas_object_geometry_get(term, NULL, NULL, &ow, &oh); evas_object_geometry_get(term, NULL, NULL, &ow, &oh);
@ -106,7 +106,7 @@ _cb_op_font(void *data, Evas_Object *obj, void *event)
char buf[4096], *file, *fname, *s; char buf[4096], *file, *fname, *s;
Eina_List *files, *fontlist, *l; Eina_List *files, *fontlist, *l;
Font *f; Font *f;
EINA_LIST_FREE(fonts, f) EINA_LIST_FREE(fonts, f)
{ {
eina_stringshare_del(f->name); eina_stringshare_del(f->name);
@ -118,7 +118,7 @@ _cb_op_font(void *data, Evas_Object *obj, void *event)
fonthash = NULL; fonthash = NULL;
} }
elm_box_clear(op_opbox); elm_box_clear(op_opbox);
op_fontslider = o = elm_slider_add(win); op_fontslider = o = elm_slider_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
@ -129,14 +129,14 @@ _cb_op_font(void *data, Evas_Object *obj, void *event)
elm_slider_value_set(o, config->font.size); elm_slider_value_set(o, config->font.size);
elm_box_pack_end(op_opbox, o); elm_box_pack_end(op_opbox, o);
evas_object_show(o); evas_object_show(o);
evas_object_smart_callback_add(o, "delay,changed", evas_object_smart_callback_add(o, "delay,changed",
_cb_op_fontsize_sel, NULL); _cb_op_fontsize_sel, NULL);
op_fontlist = o = elm_list_add(win); op_fontlist = o = elm_list_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_event_freeze(evas_object_evas_get(win)); evas_event_freeze(evas_object_evas_get(win));
edje_freeze(); edje_freeze();
@ -151,7 +151,7 @@ _cb_op_font(void *data, Evas_Object *obj, void *event)
elm_list_item_append(o, f->name, NULL, NULL, _cb_op_font_sel, f); elm_list_item_append(o, f->name, NULL, NULL, _cb_op_font_sel, f);
free(file); free(file);
} }
fontlist = evas_font_available_list(evas_object_evas_get(win)); fontlist = evas_font_available_list(evas_object_evas_get(win));
fonthash = eina_hash_string_superfast_new(NULL); fonthash = eina_hash_string_superfast_new(NULL);
@ -175,9 +175,9 @@ _cb_op_font(void *data, Evas_Object *obj, void *event)
} }
if (fontlist) if (fontlist)
evas_font_available_list_free(evas_object_evas_get(win), fontlist); evas_font_available_list_free(evas_object_evas_get(win), fontlist);
elm_list_go(o); elm_list_go(o);
edje_thaw(); edje_thaw();
evas_event_thaw(evas_object_evas_get(win)); evas_event_thaw(evas_object_evas_get(win));
@ -211,18 +211,18 @@ _cb_options(void *data, Evas_Object *obj, void *event)
if (!op_frame) if (!op_frame)
{ {
Elm_Object_Item *it_fn, *it_th, *it_bh; Elm_Object_Item *it_fn, *it_th, *it_bh;
op_frame = o = elm_frame_add(win); op_frame = o = elm_frame_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(o, "Options"); elm_object_text_set(o, "Options");
op_box = o = elm_box_add(win); op_box = o = elm_box_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_content_set(op_frame, o); elm_object_content_set(op_frame, o);
evas_object_show(o); evas_object_show(o);
op_toolbar = o = elm_toolbar_add(win); op_toolbar = o = elm_toolbar_add(win);
elm_object_style_set(o, "item_horizontal"); elm_object_style_set(o, "item_horizontal");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
@ -232,14 +232,14 @@ _cb_options(void *data, Evas_Object *obj, void *event)
elm_toolbar_select_mode_set(o, ELM_OBJECT_SELECT_MODE_DEFAULT); elm_toolbar_select_mode_set(o, ELM_OBJECT_SELECT_MODE_DEFAULT);
elm_toolbar_menu_parent_set(o, win); elm_toolbar_menu_parent_set(o, win);
elm_toolbar_homogeneous_set(o, EINA_FALSE); elm_toolbar_homogeneous_set(o, EINA_FALSE);
it_fn = elm_toolbar_item_append(o, "preferences-desktop-font", "Font", it_fn = elm_toolbar_item_append(o, "preferences-desktop-font", "Font",
_cb_op_font, NULL); _cb_op_font, NULL);
it_th = elm_toolbar_item_append(o, "preferences-desktop-theme", "Theme", it_th = elm_toolbar_item_append(o, "preferences-desktop-theme", "Theme",
_cb_op_theme, NULL); _cb_op_theme, NULL);
it_bh = elm_toolbar_item_append(o, "system-run", "Behavior", it_bh = elm_toolbar_item_append(o, "system-run", "Behavior",
_cb_op_behavior, NULL); _cb_op_behavior, NULL);
elm_box_pack_end(op_box, o); elm_box_pack_end(op_box, o);
evas_object_show(o); evas_object_show(o);
@ -248,9 +248,9 @@ _cb_options(void *data, Evas_Object *obj, void *event)
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(op_box, o); elm_box_pack_end(op_box, o);
evas_object_show(o); evas_object_show(o);
elm_toolbar_item_selected_set(it_fn, EINA_TRUE); elm_toolbar_item_selected_set(it_fn, EINA_TRUE);
evas_smart_objects_calculate(evas_object_evas_get(win)); evas_smart_objects_calculate(evas_object_evas_get(win));
edje_object_part_swallow(bg, "terminology.options", op_frame); edje_object_part_swallow(bg, "terminology.options", op_frame);
evas_object_show(o); evas_object_show(o);
@ -289,7 +289,7 @@ elm_main(int argc, char **argv)
cmd = argv[i]; cmd = argv[i];
} }
} }
win = tg_win_add(); win = tg_win_add();
bg = o = edje_object_add(evas_object_evas_get(win)); bg = o = edje_object_add(evas_object_evas_get(win));
@ -300,7 +300,7 @@ elm_main(int argc, char **argv)
edje_object_file_set(o, buf, "terminology/background"); edje_object_file_set(o, buf, "terminology/background");
elm_win_resize_object_add(win, o); elm_win_resize_object_add(win, o);
evas_object_show(o); evas_object_show(o);
term = o = termio_add(win, cmd, 80, 24); term = o = termio_add(win, cmd, 80, 24);
termio_win_set(o, win); termio_win_set(o, win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -314,9 +314,9 @@ elm_main(int argc, char **argv)
evas_object_smart_callback_add(win, "focus,in", _cb_focus_in, term); evas_object_smart_callback_add(win, "focus,in", _cb_focus_in, term);
evas_object_smart_callback_add(win, "focus,out", _cb_focus_out, term); evas_object_smart_callback_add(win, "focus,out", _cb_focus_out, term);
_cb_size_hint(win, evas_object_evas_get(win), term, NULL); _cb_size_hint(win, evas_object_evas_get(win), term, NULL);
evas_object_show(win); evas_object_show(win);
elm_run(); elm_run();
elm_shutdown(); elm_shutdown();
config_shutdown(); config_shutdown();

View File

@ -58,16 +58,16 @@ _smart_apply(Evas_Object *obj)
char txt[8]; char txt[8];
if (!sd) return; if (!sd) return;
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
if (sd->grid.array) if (sd->grid.array)
{ {
int i, j, x, y, w; int i, j, x, y, w;
i = 0; i = 0;
for (y = 0; y < sd->grid.h; y++) for (y = 0; y < sd->grid.h; y++)
{ {
Termcell *cells; Termcell *cells;
w = 0; w = 0;
cells = termpty_cellrow_get(sd->pty, y - sd->scroll, &w); cells = termpty_cellrow_get(sd->pty, y - sd->scroll, &w);
j = 0; j = 0;
@ -75,7 +75,7 @@ _smart_apply(Evas_Object *obj)
{ {
Evas_Object *bg = sd->grid.array[i].bg; Evas_Object *bg = sd->grid.array[i].bg;
Evas_Object *tx = sd->grid.array[i].tx; Evas_Object *tx = sd->grid.array[i].tx;
if ((!cells) || (x >= w)) if ((!cells) || (x >= w))
{ {
evas_object_hide(bg); evas_object_hide(bg);
@ -84,7 +84,7 @@ _smart_apply(Evas_Object *obj)
else else
{ {
Color c1, c2; Color c1, c2;
if (cells[j].att.invisible) if (cells[j].att.invisible)
{ {
evas_object_hide(tx); evas_object_hide(tx);
@ -93,13 +93,13 @@ _smart_apply(Evas_Object *obj)
else else
{ {
int cbd, cbdbg, cfg, cbg; int cbd, cbdbg, cfg, cbg;
// colors // colors
cbd = cells[j].att.bold; cbd = cells[j].att.bold;
cbdbg = 0; cbdbg = 0;
cfg = cells[j].att.fg; cfg = cells[j].att.fg;
cbg = cells[j].att.bg; cbg = cells[j].att.bg;
if (cells[j].att.inverse) if (cells[j].att.inverse)
{ {
cfg = COL_INVERSE; cfg = COL_INVERSE;
@ -147,12 +147,12 @@ _smart_apply(Evas_Object *obj)
// if (cells[j].att.blink2) {} // if (cells[j].att.blink2) {}
evas_object_color_set(tx, c1.r, c1.g, c1.b, c1.a); evas_object_color_set(tx, c1.r, c1.g, c1.b, c1.a);
evas_object_color_set(bg, c2.r, c2.g, c2.b, c2.a); evas_object_color_set(bg, c2.r, c2.g, c2.b, c2.a);
// text - convert glyph back to utf8 str seq // text - convert glyph back to utf8 str seq
if (cells[j].glyph > 0) if (cells[j].glyph > 0)
{ {
int g = cells[j].glyph; int g = cells[j].glyph;
glyph_to_utf8(g, txt); glyph_to_utf8(g, txt);
// special case for whitespace :) // special case for whitespace :)
if (cells[j].glyph == ' ') if (cells[j].glyph == ' ')
@ -184,13 +184,13 @@ _smart_apply(Evas_Object *obj)
evas_object_show(sd->cur.obj); evas_object_show(sd->cur.obj);
sd->cur.x = sd->pty->state.cx; sd->cur.x = sd->pty->state.cx;
sd->cur.y = sd->pty->state.cy; sd->cur.y = sd->pty->state.cy;
evas_object_move(sd->cur.obj, evas_object_move(sd->cur.obj,
ox + (sd->cur.x * sd->font.chw), ox + (sd->cur.x * sd->font.chw),
oy + (sd->cur.y * sd->font.chh)); oy + (sd->cur.y * sd->font.chh));
if (sd->cur.sel) if (sd->cur.sel)
{ {
int x1, y1, x2, y2; int x1, y1, x2, y2;
x1 = sd->cur.sel1.x; x1 = sd->cur.sel1.x;
y1 = sd->cur.sel1.y; y1 = sd->cur.sel1.y;
x2 = sd->cur.sel2.x; x2 = sd->cur.sel2.x;
@ -198,11 +198,11 @@ _smart_apply(Evas_Object *obj)
if ((y1 > y2) || ((y1 == y2) && (x2 < x1))) if ((y1 > y2) || ((y1 == y2) && (x2 < x1)))
{ {
int t; int t;
t = x1; x1 = x2; x2 = t; t = x1; x1 = x2; x2 = t;
t = y1; y1 = y2; y2 = t; t = y1; y1 = y2; y2 = t;
} }
if (y2 > y1) if (y2 > y1)
{ {
evas_object_move(sd->cur.selo1, evas_object_move(sd->cur.selo1,
@ -212,7 +212,7 @@ _smart_apply(Evas_Object *obj)
(sd->grid.w - x1) * sd->font.chw, (sd->grid.w - x1) * sd->font.chw,
sd->font.chh); sd->font.chh);
evas_object_show(sd->cur.selo1); evas_object_show(sd->cur.selo1);
evas_object_move(sd->cur.selo3, evas_object_move(sd->cur.selo3,
ox, oy + ((y2 + sd->scroll) * sd->font.chh)); ox, oy + ((y2 + sd->scroll) * sd->font.chh));
evas_object_resize(sd->cur.selo3, evas_object_resize(sd->cur.selo3,
@ -283,14 +283,14 @@ _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force)
if (sd->grid.array) if (sd->grid.array)
{ {
int i, x, y; int i, x, y;
i = 0; i = 0;
for (y = 0; y < sd->grid.h; y++) for (y = 0; y < sd->grid.h; y++)
{ {
for (x = 0; x < sd->grid.w; x++) for (x = 0; x < sd->grid.w; x++)
{ {
Evas_Object *bg, *tx; Evas_Object *bg, *tx;
bg = evas_object_rectangle_add(evas_object_evas_get(obj)); bg = evas_object_rectangle_add(evas_object_evas_get(obj));
tx = evas_object_text_add(evas_object_evas_get(obj)); tx = evas_object_text_add(evas_object_evas_get(obj));
evas_object_pass_events_set(bg, EINA_TRUE); evas_object_pass_events_set(bg, EINA_TRUE);
@ -316,7 +316,7 @@ _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force)
evas_object_resize(sd->cur.obj, sd->font.chw, sd->font.chh); 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_min_set(obj, sd->font.chw, sd->font.chh);
printf("req grid %ix%i\n", sd->grid.w, sd->grid.h); printf("req grid %ix%i\n", sd->grid.w, sd->grid.h);
evas_object_size_hint_request_set(obj, evas_object_size_hint_request_set(obj,
sd->font.chw * sd->grid.w, sd->font.chw * sd->grid.w,
sd->font.chh * sd->grid.h); sd->font.chh * sd->grid.h);
evas_object_raise(sd->event); evas_object_raise(sd->event);
@ -333,12 +333,12 @@ _smart_cb_delayed_size(void *data)
Termio *sd = evas_object_smart_data_get(obj); Termio *sd = evas_object_smart_data_get(obj);
Evas_Coord ow = 0, oh = 0; Evas_Coord ow = 0, oh = 0;
int w, h; int w, h;
if (!sd) return EINA_FALSE; if (!sd) return EINA_FALSE;
sd->delayed_size_timer = NULL; sd->delayed_size_timer = NULL;
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
w = ow / sd->font.chw; w = ow / sd->font.chw;
h = oh / sd->font.chh; h = oh / sd->font.chh;
_smart_size(obj, w, h, EINA_FALSE); _smart_size(obj, w, h, EINA_FALSE);
@ -362,7 +362,7 @@ _take_selection(Evas_Object *obj)
Termio *sd = evas_object_smart_data_get(obj); Termio *sd = evas_object_smart_data_get(obj);
int x1, y1, x2, y2; int x1, y1, x2, y2;
char *s; char *s;
if (!sd) return; if (!sd) return;
x1 = sd->cur.sel1.x; x1 = sd->cur.sel1.x;
y1 = sd->cur.sel1.y; y1 = sd->cur.sel1.y;
@ -371,7 +371,7 @@ _take_selection(Evas_Object *obj)
if ((y1 > y2) || ((y1 == y2) && (x2 < x1))) if ((y1 > y2) || ((y1 == y2) && (x2 < x1)))
{ {
int t; int t;
t = x1; x1 = x2; x2 = t; t = x1; x1 = x2; x2 = t;
t = y1; y1 = y2; y2 = t; t = y1; y1 = y2; y2 = t;
} }
@ -399,7 +399,7 @@ _getsel_cb(void *data, Evas_Object *obj, Elm_Selection_Data *ev)
{ {
Termio *sd = evas_object_smart_data_get(data); Termio *sd = evas_object_smart_data_get(data);
if (!sd) return EINA_FALSE; if (!sd) return EINA_FALSE;
if (ev->format == ELM_SEL_FORMAT_TEXT) if (ev->format == ELM_SEL_FORMAT_TEXT)
{ {
if (ev->len > 0) if (ev->len > 0)
@ -431,7 +431,7 @@ _smart_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event)
if (ev->keyname) if (ev->keyname)
{ {
int by = sd->grid.h - 2; int by = sd->grid.h - 2;
if (by < 1) by = 1; if (by < 1) by = 1;
if (!strcmp(ev->keyname, "Prior")) if (!strcmp(ev->keyname, "Prior"))
{ {
@ -489,7 +489,7 @@ _smart_xy_to_cursor(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *cx, int *
{ {
Termio *sd; Termio *sd;
Evas_Coord ox, oy; Evas_Coord ox, oy;
sd = evas_object_smart_data_get(obj); sd = evas_object_smart_data_get(obj);
if (!sd) if (!sd)
{ {
@ -694,7 +694,7 @@ _smart_add(Evas_Object *obj)
evas_object_smart_data_set(obj, sd); evas_object_smart_data_set(obj, sd);
sd->jump_on_change = config->jump_on_change; sd->jump_on_change = config->jump_on_change;
{ {
Evas_Object *o; Evas_Object *o;
Evas_Coord w = 2, h = 2; Evas_Coord w = 2, h = 2;
@ -718,7 +718,7 @@ _smart_add(Evas_Object *obj)
if (h < 1) h = 1; if (h < 1) h = 1;
sd->font.chw = w; sd->font.chw = w;
sd->font.chh = h; sd->font.chh = h;
o = evas_object_rectangle_add(evas_object_evas_get(obj)); o = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_pass_events_set(o, EINA_TRUE); evas_object_pass_events_set(o, EINA_TRUE);
evas_object_propagate_events_set(o, EINA_FALSE); evas_object_propagate_events_set(o, EINA_FALSE);
@ -737,7 +737,7 @@ _smart_add(Evas_Object *obj)
evas_object_smart_member_add(o, obj); evas_object_smart_member_add(o, obj);
sd->cur.selo3 = o; sd->cur.selo3 = o;
evas_object_color_set(o, 64, 64, 64, 64); evas_object_color_set(o, 64, 64, 64, 64);
o = edje_object_add(evas_object_evas_get(obj)); o = edje_object_add(evas_object_evas_get(obj));
evas_object_pass_events_set(o, EINA_TRUE); evas_object_pass_events_set(o, EINA_TRUE);
evas_object_propagate_events_set(o, EINA_FALSE); evas_object_propagate_events_set(o, EINA_FALSE);
@ -754,7 +754,7 @@ _smart_add(Evas_Object *obj)
sd->event = o; sd->event = o;
evas_object_color_set(o, 0, 0, 0, 0); evas_object_color_set(o, 0, 0, 0, 0);
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,
_smart_cb_mouse_down, obj); _smart_cb_mouse_down, obj);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
@ -821,14 +821,14 @@ _smart_calculate(Evas_Object *obj)
{ {
Termio *sd = evas_object_smart_data_get(obj); Termio *sd = evas_object_smart_data_get(obj);
Evas_Coord ox, oy, ow, oh; Evas_Coord ox, oy, ow, oh;
if (!sd) return; if (!sd) return;
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
if (sd->grid.array) if (sd->grid.array)
{ {
int i, x, y; int i, x, y;
i = 0; i = 0;
for (y = 0; y < sd->grid.h; y++) for (y = 0; y < sd->grid.h; y++)
{ {
@ -844,7 +844,7 @@ _smart_calculate(Evas_Object *obj)
} }
} }
} }
evas_object_move(sd->cur.obj, evas_object_move(sd->cur.obj,
ox + (sd->cur.x * sd->font.chw), ox + (sd->cur.x * sd->font.chw),
oy + (sd->cur.y * sd->font.chh)); oy + (sd->cur.y * sd->font.chh));
evas_object_move(sd->event, ox, oy); evas_object_move(sd->event, ox, oy);
@ -853,7 +853,7 @@ _smart_calculate(Evas_Object *obj)
static void static void
_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{ {
Termio *sd = evas_object_smart_data_get(obj); Termio *sd = evas_object_smart_data_get(obj);
if (!sd) return; if (!sd) return;
evas_object_smart_changed(obj); evas_object_smart_changed(obj);
@ -863,7 +863,7 @@ static void
_smart_init(void) _smart_init(void)
{ {
static Evas_Smart_Class sc; static Evas_Smart_Class sc;
evas_object_smart_clipped_smart_set(&_termio_sc); evas_object_smart_clipped_smart_set(&_termio_sc);
sc = _termio_sc; sc = _termio_sc;
sc.name = "termio"; sc.name = "termio";
@ -903,7 +903,7 @@ _smart_pty_scroll(void *data)
if (!sd) return; if (!sd) return;
if ((!sd->jump_on_change) && // if NOT scroll to bottom on updates if ((!sd->jump_on_change) && // if NOT scroll to bottom on updates
(sd->scroll > 0)) (sd->scroll > 0))
{ {
// adjust scroll position for added scrollback // adjust scroll position for added scrollback
sd->scroll++; sd->scroll++;
@ -972,7 +972,7 @@ termio_add(Evas_Object *parent, const char *cmd, int w, int h)
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
e = evas_object_evas_get(parent); e = evas_object_evas_get(parent);
if (!e) return NULL; if (!e) return NULL;
if (!_smart) _smart_init(); if (!_smart) _smart_init();
obj = evas_object_smart_add(e, _smart); obj = evas_object_smart_add(e, _smart);
sd = evas_object_smart_data_get(obj); sd = evas_object_smart_data_get(obj);
@ -1007,14 +1007,14 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y)
Eina_Strbuf *sb; Eina_Strbuf *sb;
char *s, txt[8]; char *s, txt[8];
int x, y; int x, y;
if (!sd) return NULL; if (!sd) return NULL;
sb = eina_strbuf_new(); sb = eina_strbuf_new();
for (y = c1y; y <= c2y; y++) for (y = c1y; y <= c2y; y++)
{ {
Termcell *cells; Termcell *cells;
int w, last0, v, x1, x2; int w, last0, v, x1, x2;
w = 0; w = 0;
last0 = -1; last0 = -1;
cells = termpty_cellrow_get(sd->pty, y - sd->scroll, &w); cells = termpty_cellrow_get(sd->pty, y - sd->scroll, &w);
@ -1076,7 +1076,7 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y)
eina_strbuf_append(sb, "\n"); eina_strbuf_append(sb, "\n");
} }
} }
s = eina_strbuf_string_steal(sb); s = eina_strbuf_string_steal(sb);
eina_strbuf_free(sb); eina_strbuf_free(sb);
return s; return s;
@ -1089,12 +1089,12 @@ termio_config_update(Evas_Object *obj)
Evas_Object *o; Evas_Object *o;
Evas_Coord w, h; Evas_Coord w, h;
char buf[4096]; char buf[4096];
if (!sd) return; if (!sd) return;
if (sd->font.name) eina_stringshare_del(sd->font.name); if (sd->font.name) eina_stringshare_del(sd->font.name);
sd->font.name = NULL; sd->font.name = NULL;
if (config->font.bitmap) if (config->font.bitmap)
{ {
snprintf(buf, sizeof(buf), "%s/fonts/%s", snprintf(buf, sizeof(buf), "%s/fonts/%s",
@ -1104,7 +1104,7 @@ termio_config_update(Evas_Object *obj)
else else
sd->font.name = eina_stringshare_add(config->font.name); sd->font.name = eina_stringshare_add(config->font.name);
sd->font.size = config->font.size; sd->font.size = config->font.size;
o = evas_object_text_add(evas_object_evas_get(obj)); o = evas_object_text_add(evas_object_evas_get(obj));
evas_object_text_font_set(o, sd->font.name, sd->font.size); evas_object_text_font_set(o, sd->font.name, sd->font.size);
evas_object_text_text_set(o, "X"); evas_object_text_text_set(o, "X");

View File

@ -22,7 +22,7 @@ _text_clear(Termpty *ty, Termcell *cells, int count, int val, Eina_Bool inherit_
{ {
int i; int i;
Termatt clear; Termatt clear;
memset(&clear, 0, sizeof(clear)); memset(&clear, 0, sizeof(clear));
if (inherit_att) if (inherit_att)
{ {
@ -52,7 +52,7 @@ static void
_text_save_top(Termpty *ty) _text_save_top(Termpty *ty)
{ {
Termsave *ts; Termsave *ts;
ts = malloc(sizeof(Termsave) + ((ty->w - 1) * sizeof(Termcell))); ts = malloc(sizeof(Termsave) + ((ty->w - 1) * sizeof(Termcell)));
ts->w = ty->w; ts->w = ty->w;
_text_copy(ty, ty->screen, ts->cell, ty->w); _text_copy(ty, ty->screen, ts->cell, ty->w);
@ -124,7 +124,7 @@ static void
_text_scroll_test(Termpty *ty) _text_scroll_test(Termpty *ty)
{ {
int e = ty->h; int e = ty->h;
if (ty->state.scroll_y2 != 0) e = ty->state.scroll_y2; if (ty->state.scroll_y2 != 0) e = ty->state.scroll_y2;
if (ty->state.cy >= e) if (ty->state.cy >= e)
{ {
@ -137,7 +137,7 @@ static void
_text_scroll_rev_test(Termpty *ty) _text_scroll_rev_test(Termpty *ty)
{ {
int b = 0; int b = 0;
if (ty->state.scroll_y2 != 0) b = ty->state.scroll_y1; if (ty->state.scroll_y2 != 0) b = ty->state.scroll_y1;
if (ty->state.cy < b) if (ty->state.cy < b)
{ {
@ -228,7 +228,7 @@ static void
_clear_screen(Termpty *ty, int mode) _clear_screen(Termpty *ty, int mode)
{ {
Termcell *cells; Termcell *cells;
cells = ty->screen; cells = ty->screen;
switch (mode) switch (mode)
{ {
@ -323,7 +323,7 @@ _csi_arg_get(char **ptr)
char *b = *ptr; char *b = *ptr;
int octal = 0; int octal = 0;
int sum = 0; int sum = 0;
while ((*b) && (!isdigit(*b))) b++; while ((*b) && (!isdigit(*b))) b++;
if (!*b) if (!*b)
{ {
@ -347,7 +347,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
{ {
int *cc, arg, first = 1, i; int *cc, arg, first = 1, i;
char buf[4096], *b; char buf[4096], *b;
cc = (int *)c; cc = (int *)c;
b = buf; b = buf;
while ((cc < ce) && (*cc >= '0') && (*cc <= '?')) while ((cc < ce) && (*cc >= '0') && (*cc <= '?'))
@ -506,7 +506,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
{ {
int pi = ty->state.insert; int pi = ty->state.insert;
int blank[1] = { ' ' }; int blank[1] = { ' ' };
ty->state.wrapnext = 0; ty->state.wrapnext = 0;
ty->state.insert = 1; ty->state.insert = 1;
for (i = 0; i < arg; i++) for (i = 0; i < arg; i++)
@ -638,7 +638,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
arg = _csi_arg_get(&b); arg = _csi_arg_get(&b);
{ {
int sy1, sy2; int sy1, sy2;
sy1 = ty->state.scroll_y1; sy1 = ty->state.scroll_y1;
sy2 = ty->state.scroll_y2; sy2 = ty->state.scroll_y2;
if (ty->state.scroll_y2 == 0) if (ty->state.scroll_y2 == 0)
@ -667,7 +667,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
{ {
Termcell *cells; Termcell *cells;
int x, lim; int x, lim;
if (arg < 1) arg = 1; if (arg < 1) arg = 1;
cells = &(ty->screen[ty->state.cy * ty->w]); cells = &(ty->screen[ty->state.cy * ty->w]);
lim = ty->w - arg; lim = ty->w - arg;
@ -722,7 +722,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
{ {
int mode = 0, priv = 0; int mode = 0, priv = 0;
int handled = 0; int handled = 0;
if (*cc == 'h') mode = 1; if (*cc == 'h') mode = 1;
if (*b == '?') if (*b == '?')
{ {
@ -737,7 +737,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
if (b) if (b)
{ {
int i, size; int i, size;
switch (arg) switch (arg)
{ {
case 1: case 1:
@ -792,7 +792,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
{ {
Termcell t; Termcell t;
t = ty->screen[i]; t = ty->screen[i];
ty->screen[i] = ty->screen2[i]; ty->screen[i] = ty->screen2[i];
ty->screen2[i] = t; ty->screen2[i] = t;
@ -856,7 +856,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
else else
{ {
int arg2; int arg2;
arg2 = _csi_arg_get(&b); arg2 = _csi_arg_get(&b);
if (!b) if (!b)
{ {
@ -890,7 +890,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce)
case 'u': // restore cursor pos case 'u': // restore cursor pos
_cursor_copy(&(ty->save), &(ty->state)); _cursor_copy(&(ty->save), &(ty->state));
break; break;
/* /*
case 'R': // report cursor case 'R': // report cursor
break; break;
case 'n': // "6n" queires cursor pos, 0n, 3n, 5n too case 'n': // "6n" queires cursor pos, 0n, 3n, 5n too
@ -925,7 +925,7 @@ _handle_esc_xterm(Termpty *ty, const int *c, int *ce)
{ {
int *cc; int *cc;
char buf[4096], *b; char buf[4096], *b;
cc = (int *)c; cc = (int *)c;
b = buf; b = buf;
while ((cc < ce) && (*cc >= ' ') && (*cc < 0x7f)) while ((cc < ce) && (*cc >= ' ') && (*cc < 0x7f))
@ -1043,7 +1043,7 @@ _handle_esc(Termpty *ty, const int *c, int *ce)
{ {
int i, size; int i, size;
Termcell *cells; Termcell *cells;
DBG("reset to init mode and clear then fill with E\n"); DBG("reset to init mode and clear then fill with E\n");
_reset_state(ty); _reset_state(ty);
ty->save = ty->state; ty->save = ty->state;
@ -1067,7 +1067,7 @@ _handle_esc(Termpty *ty, const int *c, int *ce)
case '8': // restore cursor pos case '8': // restore cursor pos
_cursor_copy(&(ty->save), &(ty->state)); _cursor_copy(&(ty->save), &(ty->state));
return 2; return 2;
/* /*
case 'G': // query gfx mode case 'G': // query gfx mode
return 3; return 3;
case 'H': // set tab at current column case 'H': // set tab at current column
@ -1088,12 +1088,12 @@ static int
_handle_seq(Termpty *ty, const int *c, int *ce) _handle_seq(Termpty *ty, const int *c, int *ce)
{ {
int *cc, len = 0; int *cc, len = 0;
if (c[0] < 0x20) if (c[0] < 0x20)
{ {
switch (c[0]) switch (c[0])
{ {
/* /*
case 0x00: // NUL case 0x00: // NUL
return 1; return 1;
case 0x01: // SOH (start of heading) case 0x01: // SOH (start of heading)
@ -1109,7 +1109,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce)
_term_txt_write(ty, "ABC\r\n"); _term_txt_write(ty, "ABC\r\n");
ty->state.had_cr = 0; ty->state.had_cr = 0;
return 1; return 1;
/* /*
case 0x06: // ACK (acknowledge) case 0x06: // ACK (acknowledge)
return 1; return 1;
*/ */
@ -1134,7 +1134,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce)
ty->state.cx = ty->w - 1; ty->state.cx = ty->w - 1;
ty->state.had_cr = 0; ty->state.had_cr = 0;
return 1; return 1;
case 0x0a: // LF '\n' (new line) case 0x0a: // LF '\n' (new line)
case 0x0b: // VT '\v' (vertical tab) case 0x0b: // VT '\v' (vertical tab)
case 0x0c: // FF '\f' (form feed) case 0x0c: // FF '\f' (form feed)
DBG("->LF\n"); DBG("->LF\n");
@ -1157,7 +1157,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce)
ty->state.cx = 0; ty->state.cx = 0;
ty->state.had_cr = 1; ty->state.had_cr = 1;
return 1; return 1;
/* /*
case 0x0e: // SO (shift out) // Maps G1 character set into GL. case 0x0e: // SO (shift out) // Maps G1 character set into GL.
return 1; return 1;
case 0x0f: // SI (shift in) // Maps G0 character set into GL. case 0x0f: // SI (shift in) // Maps G0 character set into GL.
@ -1188,7 +1188,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce)
case 0x1b: // ESC (escape) case 0x1b: // ESC (escape)
ty->state.had_cr = 0; ty->state.had_cr = 0;
return _handle_esc(ty, c, ce); return _handle_esc(ty, c, ce);
/* /*
case 0x1c: // FS (file separator) case 0x1c: // FS (file separator)
return 1; return 1;
case 0x1d: // GS (group separator) case 0x1d: // GS (group separator)
@ -1210,7 +1210,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce)
ty->state.had_cr = 0; ty->state.had_cr = 0;
return 1; return 1;
} }
cc = (int *)c; cc = (int *)c;
DBG("txt: ["); DBG("txt: [");
while ((cc < ce) && (*cc >= 0x20) && (*cc != 0xf7)) while ((cc < ce) && (*cc >= 0x20) && (*cc != 0xf7))
@ -1229,7 +1229,7 @@ static void
_handle_buf(Termpty *ty, const int *glyphs, int len) _handle_buf(Termpty *ty, const int *glyphs, int len)
{ {
int *c, *ce, n, *b, bytes; int *c, *ce, n, *b, bytes;
c = (int *)glyphs; c = (int *)glyphs;
ce = &(c[len]); ce = &(c[len]);
@ -1312,7 +1312,7 @@ static void
_pty_size(Termpty *ty) _pty_size(Termpty *ty)
{ {
struct winsize sz; struct winsize sz;
sz.ws_col = ty->w; sz.ws_col = ty->w;
sz.ws_row = ty->h; sz.ws_row = ty->h;
sz.ws_xpixel = 0; sz.ws_xpixel = 0;
@ -1325,7 +1325,7 @@ _cb_exe_exit(void *data, int type, void *event)
{ {
Ecore_Exe_Event_Del *ev = event; Ecore_Exe_Event_Del *ev = event;
Termpty *ty = data; Termpty *ty = data;
if (ev->pid != ty->pid) return ECORE_CALLBACK_PASS_ON; if (ev->pid != ty->pid) return ECORE_CALLBACK_PASS_ON;
// XXX: report via cb // XXX: report via cb
exit(ev->exit_code); exit(ev->exit_code);
@ -1351,7 +1351,7 @@ _cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler)
for (i = 0; i < len;) for (i = 0; i < len;)
{ {
int g = 0; int g = 0;
if (buf[i]) if (buf[i])
{ {
i = evas_string_char_next_get(buf, i, &g); i = evas_string_char_next_get(buf, i, &g);
@ -1390,7 +1390,7 @@ termpty_new(const char *cmd, int w, int h, int backscroll)
{ {
Termpty *ty; Termpty *ty;
const char *pty; const char *pty;
ty = calloc(1, sizeof(Termpty)); ty = calloc(1, sizeof(Termpty));
if (!ty) return NULL; if (!ty) return NULL;
ty->w = w; ty->w = w;
@ -1400,12 +1400,12 @@ termpty_new(const char *cmd, int w, int h, int backscroll)
_reset_state(ty); _reset_state(ty);
ty->save = ty->state; ty->save = ty->state;
ty->swap = ty->state; ty->swap = ty->state;
ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h); ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h);
if (!ty->screen) goto err; if (!ty->screen) goto err;
ty->screen2 = calloc(1, sizeof(Termcell) * ty->w * ty->h); ty->screen2 = calloc(1, sizeof(Termcell) * ty->w * ty->h);
if (!ty->screen2) goto err; if (!ty->screen2) goto err;
ty->fd = posix_openpt(O_RDWR | O_NOCTTY); ty->fd = posix_openpt(O_RDWR | O_NOCTTY);
if (ty->fd < 0) goto err; if (ty->fd < 0) goto err;
if (grantpt(ty->fd) != 0) goto err; if (grantpt(ty->fd) != 0) goto err;
@ -1431,13 +1431,13 @@ termpty_new(const char *cmd, int w, int h, int backscroll)
} }
ty->fd = ty->slavefd; ty->fd = ty->slavefd;
setsid(); setsid();
dup2(ty->fd, 0); dup2(ty->fd, 0);
dup2(ty->fd, 1); dup2(ty->fd, 1);
dup2(ty->fd, 2); dup2(ty->fd, 2);
if (ioctl(ty->fd, TIOCSCTTY, NULL) < 0) exit(1); if (ioctl(ty->fd, TIOCSCTTY, NULL) < 0) exit(1);
uid = getuid(); uid = getuid();
pw = getpwuid(uid); pw = getpwuid(uid);
if (!pw) shell = "/bin/sh"; if (!pw) shell = "/bin/sh";
@ -1479,7 +1479,7 @@ termpty_free(Termpty *ty)
if (ty->back) if (ty->back)
{ {
int i; int i;
for (i = 0; i < ty->backmax; i++) for (i = 0; i < ty->backmax; i++)
{ {
if (ty->back[i]) free(ty->back[i]); if (ty->back[i]) free(ty->back[i]);
@ -1497,7 +1497,7 @@ Termcell *
termpty_cellrow_get(Termpty *ty, int y, int *wret) termpty_cellrow_get(Termpty *ty, int y, int *wret)
{ {
Termsave *ts; Termsave *ts;
if (y >= 0) if (y >= 0)
{ {
if (y >= ty->h) return NULL; if (y >= ty->h) return NULL;
@ -1522,21 +1522,21 @@ termpty_resize(Termpty *ty, int w, int h)
{ {
Termcell *olds, *olds2; Termcell *olds, *olds2;
int y, ww, hh, oldw, oldh; int y, ww, hh, oldw, oldh;
if ((ty->w == w) && (ty->h == h)) return; if ((ty->w == w) && (ty->h == h)) return;
olds = ty->screen; olds = ty->screen;
olds2 = ty->screen2; olds2 = ty->screen2;
oldw = ty->w; oldw = ty->w;
oldh = ty->h; oldh = ty->h;
ty->w = w; ty->w = w;
ty->h = h; ty->h = h;
ty->state.had_cr = 0; ty->state.had_cr = 0;
_limit_coord(ty, &(ty->state)); _limit_coord(ty, &(ty->state));
_limit_coord(ty, &(ty->swap)); _limit_coord(ty, &(ty->swap));
_limit_coord(ty, &(ty->save)); _limit_coord(ty, &(ty->save));
ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h); ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h);
if (!ty->screen) if (!ty->screen)
{ {
@ -1548,7 +1548,7 @@ termpty_resize(Termpty *ty, int w, int h)
{ {
ERR("memerr"); ERR("memerr");
} }
ww = ty->w; ww = ty->w;
hh = ty->h; hh = ty->h;
if (ww > oldw) ww = oldw; if (ww > oldw) ww = oldw;
@ -1557,11 +1557,11 @@ termpty_resize(Termpty *ty, int w, int h)
for (y = 0; y < hh; y++) for (y = 0; y < hh; y++)
{ {
Termcell *c1, *c2; Termcell *c1, *c2;
c1 = &(olds[y * oldw]); c1 = &(olds[y * oldw]);
c2 = &(ty->screen[y * ty->w]); c2 = &(ty->screen[y * ty->w]);
_text_copy(ty, c1, c2, ww); _text_copy(ty, c1, c2, ww);
c1 = &(olds2[y * oldw]); c1 = &(olds2[y * oldw]);
c2 = &(ty->screen2[y * ty->w]); c2 = &(ty->screen2[y * ty->w]);
_text_copy(ty, c1, c2, ww); _text_copy(ty, c1, c2, ww);

View File

@ -7,18 +7,18 @@ tg_win_add(void)
{ {
Evas_Object *win, *o; Evas_Object *win, *o;
char buf[4096]; char buf[4096];
win = elm_win_add(NULL, "main", ELM_WIN_BASIC); win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE); elm_win_autodel_set(win, EINA_TRUE);
elm_win_title_set(win, "Terminology"); elm_win_title_set(win, "Terminology");
elm_win_icon_name_set(win, "Terminology"); elm_win_icon_name_set(win, "Terminology");
o = evas_object_image_add(evas_object_evas_get(win)); o = evas_object_image_add(evas_object_evas_get(win));
snprintf(buf, sizeof(buf), "%s/images/terminology.png", snprintf(buf, sizeof(buf), "%s/images/terminology.png",
elm_app_data_dir_get()); elm_app_data_dir_get());
evas_object_image_file_set(o, buf, NULL); evas_object_image_file_set(o, buf, NULL);
elm_win_icon_object_set(win, o); elm_win_icon_object_set(win, o);
return win; return win;
} }