diff --git a/src/bin/main.c b/src/bin/main.c index 26f6dba4..53a0a3b4 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -5,8 +5,8 @@ const char *cmd = NULL; static Evas_Object *win, *bg, *term; -static Evas_Object - *op_frame, *op_box, *op_toolbar, *op_opbox, +static Evas_Object + *op_frame, *op_box, *op_toolbar, *op_opbox, *op_fontslider, *op_fontlist; 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) { Evas_Coord mw, mh, rw, rh, w = 0, h = 0; - + evas_object_size_hint_min_get(obj, &mw, &mh); evas_object_size_hint_request_get(obj, &rw, &rh); - + edje_object_size_min_calc(bg, &w, &h); evas_object_size_hint_min_set(bg, w, h); elm_win_size_base_set(win, w - mw, h - mh); @@ -58,7 +58,7 @@ static void _update_sizing(void) { Evas_Coord ow = 0, oh = 0, mw = 1, mh = 1, w, h; - + evas_object_data_del(term, "sizedone"); termio_config_update(term); 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; Eina_List *files, *fontlist, *l; Font *f; - + EINA_LIST_FREE(fonts, f) { eina_stringshare_del(f->name); @@ -118,7 +118,7 @@ _cb_op_font(void *data, Evas_Object *obj, void *event) fonthash = NULL; } elm_box_clear(op_opbox); - + op_fontslider = o = elm_slider_add(win); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); 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_box_pack_end(op_opbox, o); evas_object_show(o); - + evas_object_smart_callback_add(o, "delay,changed", _cb_op_fontsize_sel, NULL); - + op_fontlist = o = elm_list_add(win); 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_event_freeze(evas_object_evas_get(win)); 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); free(file); } - + fontlist = evas_font_available_list(evas_object_evas_get(win)); fonthash = eina_hash_string_superfast_new(NULL); @@ -175,9 +175,9 @@ _cb_op_font(void *data, Evas_Object *obj, void *event) } if (fontlist) evas_font_available_list_free(evas_object_evas_get(win), fontlist); - + elm_list_go(o); - + edje_thaw(); evas_event_thaw(evas_object_evas_get(win)); @@ -211,18 +211,18 @@ _cb_options(void *data, Evas_Object *obj, void *event) if (!op_frame) { Elm_Object_Item *it_fn, *it_th, *it_bh; - + op_frame = o = elm_frame_add(win); 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); elm_object_text_set(o, "Options"); - + op_box = o = elm_box_add(win); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); elm_object_content_set(op_frame, o); evas_object_show(o); - + op_toolbar = o = elm_toolbar_add(win); elm_object_style_set(o, "item_horizontal"); 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_menu_parent_set(o, win); elm_toolbar_homogeneous_set(o, EINA_FALSE); - + it_fn = elm_toolbar_item_append(o, "preferences-desktop-font", "Font", _cb_op_font, NULL); it_th = elm_toolbar_item_append(o, "preferences-desktop-theme", "Theme", _cb_op_theme, NULL); it_bh = elm_toolbar_item_append(o, "system-run", "Behavior", _cb_op_behavior, NULL); - + elm_box_pack_end(op_box, 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); elm_box_pack_end(op_box, o); evas_object_show(o); - + elm_toolbar_item_selected_set(it_fn, EINA_TRUE); - + evas_smart_objects_calculate(evas_object_evas_get(win)); edje_object_part_swallow(bg, "terminology.options", op_frame); evas_object_show(o); @@ -289,7 +289,7 @@ elm_main(int argc, char **argv) cmd = argv[i]; } } - + win = tg_win_add(); 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"); elm_win_resize_object_add(win, o); evas_object_show(o); - + term = o = termio_add(win, cmd, 80, 24); termio_win_set(o, win); 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,out", _cb_focus_out, term); _cb_size_hint(win, evas_object_evas_get(win), term, NULL); - + evas_object_show(win); - + elm_run(); elm_shutdown(); config_shutdown(); diff --git a/src/bin/termio.c b/src/bin/termio.c index 3ab73cec..0ceb3b9d 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -58,16 +58,16 @@ _smart_apply(Evas_Object *obj) char txt[8]; if (!sd) return; evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); - + if (sd->grid.array) { int i, j, x, y, w; - + i = 0; for (y = 0; y < sd->grid.h; y++) { Termcell *cells; - + w = 0; cells = termpty_cellrow_get(sd->pty, y - sd->scroll, &w); j = 0; @@ -75,7 +75,7 @@ _smart_apply(Evas_Object *obj) { Evas_Object *bg = sd->grid.array[i].bg; Evas_Object *tx = sd->grid.array[i].tx; - + if ((!cells) || (x >= w)) { evas_object_hide(bg); @@ -84,7 +84,7 @@ _smart_apply(Evas_Object *obj) else { Color c1, c2; - + if (cells[j].att.invisible) { evas_object_hide(tx); @@ -93,13 +93,13 @@ _smart_apply(Evas_Object *obj) else { int cbd, cbdbg, cfg, cbg; - + // colors cbd = cells[j].att.bold; cbdbg = 0; cfg = cells[j].att.fg; cbg = cells[j].att.bg; - + if (cells[j].att.inverse) { cfg = COL_INVERSE; @@ -147,12 +147,12 @@ _smart_apply(Evas_Object *obj) // if (cells[j].att.blink2) {} 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); - + // text - convert glyph back to utf8 str seq if (cells[j].glyph > 0) { int g = cells[j].glyph; - + glyph_to_utf8(g, txt); // special case for whitespace :) if (cells[j].glyph == ' ') @@ -184,13 +184,13 @@ _smart_apply(Evas_Object *obj) evas_object_show(sd->cur.obj); sd->cur.x = sd->pty->state.cx; 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), oy + (sd->cur.y * sd->font.chh)); if (sd->cur.sel) { int x1, y1, x2, y2; - + x1 = sd->cur.sel1.x; y1 = sd->cur.sel1.y; x2 = sd->cur.sel2.x; @@ -198,11 +198,11 @@ _smart_apply(Evas_Object *obj) if ((y1 > y2) || ((y1 == y2) && (x2 < x1))) { int t; - + t = x1; x1 = x2; x2 = t; t = y1; y1 = y2; y2 = t; } - + if (y2 > y1) { evas_object_move(sd->cur.selo1, @@ -212,7 +212,7 @@ _smart_apply(Evas_Object *obj) (sd->grid.w - x1) * sd->font.chw, sd->font.chh); evas_object_show(sd->cur.selo1); - + evas_object_move(sd->cur.selo3, ox, oy + ((y2 + sd->scroll) * sd->font.chh)); 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) { int i, x, y; - + i = 0; for (y = 0; y < sd->grid.h; y++) { for (x = 0; x < sd->grid.w; x++) { Evas_Object *bg, *tx; - + bg = evas_object_rectangle_add(evas_object_evas_get(obj)); tx = evas_object_text_add(evas_object_evas_get(obj)); 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_size_hint_min_set(obj, sd->font.chw, sd->font.chh); 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.chh * sd->grid.h); evas_object_raise(sd->event); @@ -333,12 +333,12 @@ _smart_cb_delayed_size(void *data) Termio *sd = evas_object_smart_data_get(obj); Evas_Coord ow = 0, oh = 0; int w, h; - + if (!sd) return EINA_FALSE; sd->delayed_size_timer = NULL; evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); - + w = ow / sd->font.chw; h = oh / sd->font.chh; _smart_size(obj, w, h, EINA_FALSE); @@ -362,7 +362,7 @@ _take_selection(Evas_Object *obj) Termio *sd = evas_object_smart_data_get(obj); int x1, y1, x2, y2; char *s; - + if (!sd) return; x1 = sd->cur.sel1.x; y1 = sd->cur.sel1.y; @@ -371,7 +371,7 @@ _take_selection(Evas_Object *obj) if ((y1 > y2) || ((y1 == y2) && (x2 < x1))) { int t; - + t = x1; x1 = x2; x2 = 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); if (!sd) return EINA_FALSE; - + if (ev->format == ELM_SEL_FORMAT_TEXT) { if (ev->len > 0) @@ -431,7 +431,7 @@ _smart_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event) if (ev->keyname) { int by = sd->grid.h - 2; - + if (by < 1) by = 1; 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; Evas_Coord ox, oy; - + sd = evas_object_smart_data_get(obj); if (!sd) { @@ -694,7 +694,7 @@ _smart_add(Evas_Object *obj) evas_object_smart_data_set(obj, sd); sd->jump_on_change = config->jump_on_change; - + { Evas_Object *o; Evas_Coord w = 2, h = 2; @@ -718,7 +718,7 @@ _smart_add(Evas_Object *obj) if (h < 1) h = 1; sd->font.chw = w; sd->font.chh = h; - + o = evas_object_rectangle_add(evas_object_evas_get(obj)); evas_object_pass_events_set(o, EINA_TRUE); evas_object_propagate_events_set(o, EINA_FALSE); @@ -737,7 +737,7 @@ _smart_add(Evas_Object *obj) evas_object_smart_member_add(o, obj); sd->cur.selo3 = o; evas_object_color_set(o, 64, 64, 64, 64); - + o = edje_object_add(evas_object_evas_get(obj)); evas_object_pass_events_set(o, EINA_TRUE); evas_object_propagate_events_set(o, EINA_FALSE); @@ -754,7 +754,7 @@ _smart_add(Evas_Object *obj) sd->event = o; evas_object_color_set(o, 0, 0, 0, 0); evas_object_show(o); - + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _smart_cb_mouse_down, obj); 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); Evas_Coord ox, oy, ow, oh; - + if (!sd) return; evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); if (sd->grid.array) { int i, x, y; - + i = 0; 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), oy + (sd->cur.y * sd->font.chh)); evas_object_move(sd->event, ox, oy); @@ -853,7 +853,7 @@ _smart_calculate(Evas_Object *obj) static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) -{ +{ Termio *sd = evas_object_smart_data_get(obj); if (!sd) return; evas_object_smart_changed(obj); @@ -863,7 +863,7 @@ static void _smart_init(void) { static Evas_Smart_Class sc; - + evas_object_smart_clipped_smart_set(&_termio_sc); sc = _termio_sc; sc.name = "termio"; @@ -903,7 +903,7 @@ _smart_pty_scroll(void *data) if (!sd) return; if ((!sd->jump_on_change) && // if NOT scroll to bottom on updates - (sd->scroll > 0)) + (sd->scroll > 0)) { // adjust scroll position for added scrollback 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); e = evas_object_evas_get(parent); if (!e) return NULL; - + if (!_smart) _smart_init(); obj = evas_object_smart_add(e, _smart); 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; char *s, txt[8]; int x, y; - + if (!sd) return NULL; sb = eina_strbuf_new(); for (y = c1y; y <= c2y; y++) { Termcell *cells; int w, last0, v, x1, x2; - + w = 0; last0 = -1; 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"); } } - + s = eina_strbuf_string_steal(sb); eina_strbuf_free(sb); return s; @@ -1089,12 +1089,12 @@ termio_config_update(Evas_Object *obj) Evas_Object *o; Evas_Coord w, h; char buf[4096]; - + if (!sd) return; - + if (sd->font.name) eina_stringshare_del(sd->font.name); sd->font.name = NULL; - + if (config->font.bitmap) { snprintf(buf, sizeof(buf), "%s/fonts/%s", @@ -1104,7 +1104,7 @@ termio_config_update(Evas_Object *obj) else sd->font.name = eina_stringshare_add(config->font.name); sd->font.size = config->font.size; - + 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_text_set(o, "X"); diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 8bf007cc..d5668c32 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -22,7 +22,7 @@ _text_clear(Termpty *ty, Termcell *cells, int count, int val, Eina_Bool inherit_ { int i; Termatt clear; - + memset(&clear, 0, sizeof(clear)); if (inherit_att) { @@ -52,7 +52,7 @@ static void _text_save_top(Termpty *ty) { Termsave *ts; - + ts = malloc(sizeof(Termsave) + ((ty->w - 1) * sizeof(Termcell))); ts->w = ty->w; _text_copy(ty, ty->screen, ts->cell, ty->w); @@ -124,7 +124,7 @@ static void _text_scroll_test(Termpty *ty) { int e = ty->h; - + if (ty->state.scroll_y2 != 0) e = ty->state.scroll_y2; if (ty->state.cy >= e) { @@ -137,7 +137,7 @@ static void _text_scroll_rev_test(Termpty *ty) { int b = 0; - + if (ty->state.scroll_y2 != 0) b = ty->state.scroll_y1; if (ty->state.cy < b) { @@ -228,7 +228,7 @@ static void _clear_screen(Termpty *ty, int mode) { Termcell *cells; - + cells = ty->screen; switch (mode) { @@ -323,7 +323,7 @@ _csi_arg_get(char **ptr) char *b = *ptr; int octal = 0; int sum = 0; - + while ((*b) && (!isdigit(*b))) b++; if (!*b) { @@ -347,7 +347,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce) { int *cc, arg, first = 1, i; char buf[4096], *b; - + cc = (int *)c; b = buf; 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 blank[1] = { ' ' }; - + ty->state.wrapnext = 0; ty->state.insert = 1; 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); { int sy1, sy2; - + sy1 = ty->state.scroll_y1; sy2 = ty->state.scroll_y2; if (ty->state.scroll_y2 == 0) @@ -667,7 +667,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce) { Termcell *cells; int x, lim; - + if (arg < 1) arg = 1; cells = &(ty->screen[ty->state.cy * ty->w]); lim = ty->w - arg; @@ -722,7 +722,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce) { int mode = 0, priv = 0; int handled = 0; - + if (*cc == 'h') mode = 1; if (*b == '?') { @@ -737,7 +737,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce) if (b) { int i, size; - + switch (arg) { case 1: @@ -792,7 +792,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce) for (i = 0; i < size; i++) { Termcell t; - + t = ty->screen[i]; ty->screen[i] = ty->screen2[i]; ty->screen2[i] = t; @@ -856,7 +856,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce) else { int arg2; - + arg2 = _csi_arg_get(&b); if (!b) { @@ -890,7 +890,7 @@ _handle_esc_csi(Termpty *ty, const int *c, int *ce) case 'u': // restore cursor pos _cursor_copy(&(ty->save), &(ty->state)); break; -/* +/* case 'R': // report cursor break; 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; char buf[4096], *b; - + cc = (int *)c; b = buf; while ((cc < ce) && (*cc >= ' ') && (*cc < 0x7f)) @@ -1043,7 +1043,7 @@ _handle_esc(Termpty *ty, const int *c, int *ce) { int i, size; Termcell *cells; - + DBG("reset to init mode and clear then fill with E\n"); _reset_state(ty); ty->save = ty->state; @@ -1067,7 +1067,7 @@ _handle_esc(Termpty *ty, const int *c, int *ce) case '8': // restore cursor pos _cursor_copy(&(ty->save), &(ty->state)); return 2; -/* +/* case 'G': // query gfx mode return 3; case 'H': // set tab at current column @@ -1088,12 +1088,12 @@ static int _handle_seq(Termpty *ty, const int *c, int *ce) { int *cc, len = 0; - + if (c[0] < 0x20) { switch (c[0]) { -/* +/* case 0x00: // NUL return 1; 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"); ty->state.had_cr = 0; return 1; -/* +/* case 0x06: // ACK (acknowledge) return 1; */ @@ -1134,7 +1134,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce) ty->state.cx = ty->w - 1; ty->state.had_cr = 0; return 1; - case 0x0a: // LF '\n' (new line) + case 0x0a: // LF '\n' (new line) case 0x0b: // VT '\v' (vertical tab) case 0x0c: // FF '\f' (form feed) DBG("->LF\n"); @@ -1157,7 +1157,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce) ty->state.cx = 0; ty->state.had_cr = 1; return 1; -/* +/* case 0x0e: // SO (shift out) // Maps G1 character set into GL. return 1; 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) ty->state.had_cr = 0; return _handle_esc(ty, c, ce); -/* +/* case 0x1c: // FS (file separator) return 1; case 0x1d: // GS (group separator) @@ -1210,7 +1210,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce) ty->state.had_cr = 0; return 1; } - + cc = (int *)c; DBG("txt: ["); while ((cc < ce) && (*cc >= 0x20) && (*cc != 0xf7)) @@ -1229,7 +1229,7 @@ static void _handle_buf(Termpty *ty, const int *glyphs, int len) { int *c, *ce, n, *b, bytes; - + c = (int *)glyphs; ce = &(c[len]); @@ -1312,7 +1312,7 @@ static void _pty_size(Termpty *ty) { struct winsize sz; - + sz.ws_col = ty->w; sz.ws_row = ty->h; sz.ws_xpixel = 0; @@ -1325,7 +1325,7 @@ _cb_exe_exit(void *data, int type, void *event) { Ecore_Exe_Event_Del *ev = event; Termpty *ty = data; - + if (ev->pid != ty->pid) return ECORE_CALLBACK_PASS_ON; // XXX: report via cb exit(ev->exit_code); @@ -1351,7 +1351,7 @@ _cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler) for (i = 0; i < len;) { int g = 0; - + if (buf[i]) { 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; const char *pty; - + ty = calloc(1, sizeof(Termpty)); if (!ty) return NULL; ty->w = w; @@ -1400,12 +1400,12 @@ termpty_new(const char *cmd, int w, int h, int backscroll) _reset_state(ty); ty->save = ty->state; ty->swap = ty->state; - + ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h); if (!ty->screen) goto err; ty->screen2 = calloc(1, sizeof(Termcell) * ty->w * ty->h); if (!ty->screen2) goto err; - + ty->fd = posix_openpt(O_RDWR | O_NOCTTY); if (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; setsid(); - + dup2(ty->fd, 0); dup2(ty->fd, 1); dup2(ty->fd, 2); - + if (ioctl(ty->fd, TIOCSCTTY, NULL) < 0) exit(1); - + uid = getuid(); pw = getpwuid(uid); if (!pw) shell = "/bin/sh"; @@ -1479,7 +1479,7 @@ termpty_free(Termpty *ty) if (ty->back) { int i; - + for (i = 0; i < ty->backmax; i++) { if (ty->back[i]) free(ty->back[i]); @@ -1497,7 +1497,7 @@ Termcell * termpty_cellrow_get(Termpty *ty, int y, int *wret) { Termsave *ts; - + if (y >= 0) { if (y >= ty->h) return NULL; @@ -1522,21 +1522,21 @@ termpty_resize(Termpty *ty, int w, int h) { Termcell *olds, *olds2; int y, ww, hh, oldw, oldh; - + if ((ty->w == w) && (ty->h == h)) return; olds = ty->screen; olds2 = ty->screen2; oldw = ty->w; oldh = ty->h; - + ty->w = w; ty->h = h; ty->state.had_cr = 0; _limit_coord(ty, &(ty->state)); _limit_coord(ty, &(ty->swap)); _limit_coord(ty, &(ty->save)); - + ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h); if (!ty->screen) { @@ -1548,7 +1548,7 @@ termpty_resize(Termpty *ty, int w, int h) { ERR("memerr"); } - + ww = ty->w; hh = ty->h; if (ww > oldw) ww = oldw; @@ -1557,11 +1557,11 @@ termpty_resize(Termpty *ty, int w, int h) for (y = 0; y < hh; y++) { Termcell *c1, *c2; - + c1 = &(olds[y * oldw]); c2 = &(ty->screen[y * ty->w]); _text_copy(ty, c1, c2, ww); - + c1 = &(olds2[y * oldw]); c2 = &(ty->screen2[y * ty->w]); _text_copy(ty, c1, c2, ww); diff --git a/src/bin/win.c b/src/bin/win.c index 9d34b7a6..d61887f2 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -7,18 +7,18 @@ tg_win_add(void) { Evas_Object *win, *o; char buf[4096]; - + win = elm_win_add(NULL, "main", ELM_WIN_BASIC); elm_win_autodel_set(win, EINA_TRUE); - + elm_win_title_set(win, "Terminology"); elm_win_icon_name_set(win, "Terminology"); - + o = evas_object_image_add(evas_object_evas_get(win)); snprintf(buf, sizeof(buf), "%s/images/terminology.png", elm_app_data_dir_get()); evas_object_image_file_set(o, buf, NULL); elm_win_icon_object_set(win, o); - + return win; }