billiob pushed a commit to branch master. http://git.enlightenment.org/apps/terminology.git/commit/?id=8fbffdd86940597ef47abc028b752db24a765926
commit 8fbffdd86940597ef47abc028b752db24a765926 Author: Boris Faure <bill...@gmail.com> Date: Sat Aug 1 18:37:35 2015 +0200 renames to make the code more consistant --- src/bin/miniview.c | 4 ++-- src/bin/termio.c | 26 +++++++++++++------------- src/bin/termpty.c | 46 +++++++++++++++++----------------------------- src/bin/termpty.h | 11 ++++++----- src/bin/termptyops.c | 8 ++++---- src/bin/termptysave.c | 26 ++++++++++++++++++++------ src/bin/termptysave.h | 4 +--- 7 files changed, 63 insertions(+), 62 deletions(-) diff --git a/src/bin/miniview.c b/src/bin/miniview.c index 477a7e9..f1dac82 100644 --- a/src/bin/miniview.c +++ b/src/bin/miniview.c @@ -145,7 +145,7 @@ _is_top_bottom_reached(Miniview *mv) EINA_SAFETY_ON_NULL_RETURN_VAL(mv, EINA_FALSE); ty = termio_pty_get(mv->termio); - history_len = termpty_backscroll_length(ty); + history_len = termpty_backlog_length(ty); if (( (- mv->img_hist) > (int)(mv->img_h - mv->rows - (mv->rows / 2))) && ( (- mv->img_hist) < (int)(history_len + (mv->rows / 2)))) @@ -523,7 +523,7 @@ _deferred_renderer(void *data) evas_object_geometry_get(mv->termio, &ox, &oy, &ow, &oh); if ((ow == 0) || (oh == 0)) return EINA_TRUE; - history_len = termpty_backscroll_length(ty); + history_len = termpty_backlog_length(ty); evas_object_image_size_set(mv->img, mv->cols, mv->img_h); ow = mv->cols; diff --git a/src/bin/termio.c b/src/bin/termio.c index c85fcca..39cec99 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -588,7 +588,7 @@ termio_config_update(Evas_Object *obj) sd->jump_on_change = sd->config->jump_on_change; sd->jump_on_keypress = sd->config->jump_on_keypress; - termpty_backscroll_set(sd->pty, sd->config->scrollback); + termpty_backlog_size_set(sd->pty, sd->config->scrollback); sd->scroll = 0; if (evas_object_focus_get(obj)) @@ -2040,7 +2040,7 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y, int x, y; EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL); - termpty_cellcomp_freeze(sd->pty); + termpty_backlog_lock(); for (y = c1y; y <= c2y; y++) { Termcell *cells; @@ -2191,7 +2191,7 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y, } } } - termpty_cellcomp_thaw(sd->pty); + termpty_backlog_unlock(); if (rtrim) _sb_spaces_rtrim(&sb); @@ -2437,7 +2437,7 @@ _sel_line(Termio *sd, int cy) int y, w = 0; Termcell *cells; - termpty_cellcomp_freeze(sd->pty); + termpty_backlog_lock(); _sel_set(sd, EINA_TRUE); sd->pty->selection.makesel = EINA_FALSE; @@ -2471,7 +2471,7 @@ _sel_line(Termio *sd, int cy) sd->pty->selection.by_line = EINA_TRUE; sd->pty->selection.is_top_to_bottom = EINA_TRUE; - termpty_cellcomp_thaw(sd->pty); + termpty_backlog_unlock(); } static void @@ -2782,7 +2782,7 @@ _sel_word(Termio *sd, int cx, int cy) int x, y, w = 0; Eina_Bool done = EINA_FALSE; - termpty_cellcomp_freeze(sd->pty); + termpty_backlog_lock(); _sel_set(sd, EINA_TRUE); sd->pty->selection.makesel = EINA_TRUE; @@ -2891,7 +2891,7 @@ _sel_word(Termio *sd, int cx, int cy) sd->pty->selection.by_word = EINA_TRUE; sd->pty->selection.is_top_to_bottom = EINA_TRUE; - termpty_cellcomp_thaw(sd->pty); + termpty_backlog_unlock(); } static void @@ -3206,7 +3206,7 @@ _selection_dbl_fix(Termio *sd INT_SWAP(start_x, end_x); } - termpty_cellcomp_freeze(sd->pty); + termpty_backlog_lock(); cells = termpty_cellrow_get(sd->pty, end_y - sd->scroll, &w); if (cells) { @@ -3259,7 +3259,7 @@ _selection_dbl_fix(Termio *sd } } } - termpty_cellcomp_thaw(sd->pty); + termpty_backlog_unlock(); if (!sd->pty->selection.is_top_to_bottom) { @@ -3286,7 +3286,7 @@ _selection_newline_extend_fix(Evas_Object *obj) if ((sd->top_left) || (sd->bottom_right) || (sd->pty->selection.is_box)) return; - termpty_cellcomp_freeze(sd->pty); + termpty_backlog_lock(); start_x = sd->pty->selection.start.x; start_y = sd->pty->selection.start.y; @@ -3331,7 +3331,7 @@ _selection_newline_extend_fix(Evas_Object *obj) sd->pty->selection.end.x = end_x; sd->pty->selection.end.y = end_y; - termpty_cellcomp_thaw(sd->pty); + termpty_backlog_unlock(); } /* }}} */ @@ -4507,7 +4507,7 @@ _smart_apply(Evas_Object *obj) blk->active = EINA_FALSE; } inv = sd->pty->termstate.reverse; - termpty_cellcomp_freeze(sd->pty); + termpty_backlog_lock(); termpty_backscroll_adjust(sd->pty, &sd->scroll); for (y = 0; y < sd->grid.h; y++) { @@ -4736,7 +4736,7 @@ _smart_apply(Evas_Object *obj) preedit_x = x - sd->cursor.x; preedit_y = y - sd->cursor.y; } - termpty_cellcomp_thaw(sd->pty); + termpty_backlog_unlock(); EINA_LIST_FOREACH_SAFE(sd->pty->block.active, l, ln, blk) { diff --git a/src/bin/termpty.c b/src/bin/termpty.c index b72510d..dc6db85 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -566,7 +566,7 @@ termpty_free(Termpty *ty) if (ty->prop.icon) eina_stringshare_del(ty->prop.icon); if (ty->back) { - int i; + size_t i; for (i = 0; i < ty->backsize; i++) termpty_save_free(&ty->back[i]); @@ -578,18 +578,6 @@ termpty_free(Termpty *ty) free(ty); } -void -termpty_cellcomp_freeze(Termpty *ty EINA_UNUSED) -{ - termpty_save_freeze(); -} - -void -termpty_cellcomp_thaw(Termpty *ty EINA_UNUSED) -{ - termpty_save_thaw(); -} - static Eina_Bool termpty_line_is_empty(const Termcell *cells, ssize_t nb_cells) { @@ -680,7 +668,7 @@ termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max) return; assert(ty->back); - termpty_save_freeze(); + termpty_backlog_lock(); w = termpty_line_length(cells, w_max); if (ty->backsize >= 1) @@ -708,11 +696,11 @@ add_new_ts: ty->backpos++; if (ty->backpos >= ty->backsize) ty->backpos = 0; - termpty_save_thaw(); + termpty_backlog_unlock(); ty->backlog_beacon.screen_y++; ty->backlog_beacon.backlog_y++; - if (ty->backlog_beacon.backlog_y >= ty->backsize) + if (ty->backlog_beacon.backlog_y >= (int)ty->backsize) { ty->backlog_beacon.screen_y = 0; ty->backlog_beacon.backlog_y = 0; @@ -736,9 +724,9 @@ termpty_row_length(Termpty *ty, int y) cells = &(TERMPTY_SCREEN(ty, 0, y)); return termpty_line_length(cells, ty->w); } - if ((y < -ty->backsize) || !ty->back) + if ((y < -(int)ty->backsize) || !ty->back) { - ERR("invalid row given: %d; ty->back:%p ty->backsize:%d", + ERR("invalid row given: %d; ty->back:%p ty->backsize:%zd", y, ty->back, ty->backsize); return 0; } @@ -748,7 +736,7 @@ termpty_row_length(Termpty *ty, int y) } ssize_t -termpty_backscroll_length(Termpty *ty) +termpty_backlog_length(Termpty *ty) { int backlog_y = ty->backlog_beacon.backlog_y; int screen_y = ty->backlog_beacon.screen_y; @@ -762,7 +750,7 @@ termpty_backscroll_length(Termpty *ty) Termsave *ts; ts = BACKLOG_ROW_GET(ty, backlog_y); - if (!ts->cells || backlog_y >= ty->backsize) + if (!ts->cells || backlog_y >= (int)ty->backsize) return ty->backlog_beacon.screen_y; nb_lines = (ts->w == 0) ? 1 : (ts->w + ty->w - 1) / ty->w; @@ -793,7 +781,7 @@ termpty_backscroll_adjust(Termpty *ty, int *scroll) Termsave *ts; ts = BACKLOG_ROW_GET(ty, backlog_y); - if (!ts->cells || backlog_y >= ty->backsize) + if (!ts->cells || backlog_y >= (int)ty->backsize) { *scroll = ty->backlog_beacon.screen_y; return; @@ -988,7 +976,7 @@ termpty_resize(Termpty *ty, int new_w, int new_h) if ((new_w == new_h) && (new_w == 1)) return; // FIXME: something weird is // going on at term init - termpty_save_freeze(); + termpty_backlog_unlock(); if (ty->altbuf) { @@ -1050,7 +1038,7 @@ termpty_resize(Termpty *ty, int new_w, int new_h) _pty_size(ty); - termpty_save_thaw(); + termpty_backlog_unlock(); ty->backlog_beacon.backlog_y = 0; ty->backlog_beacon.screen_y = 0; @@ -1058,23 +1046,23 @@ termpty_resize(Termpty *ty, int new_w, int new_h) return; bad: - termpty_save_thaw(); + termpty_backlog_unlock(); free(new_screen); } void -termpty_backscroll_set(Termpty *ty, int size) +termpty_backlog_size_set(Termpty *ty, size_t size) { - int i; - if (ty->backsize == size) return; /* TODO: RESIZE: handle that case better: changing backscroll size */ - termpty_save_freeze(); + termpty_backlog_lock(); if (ty->back) { + size_t i; + for (i = 0; i < ty->backsize; i++) termpty_save_free(&ty->back[i]); free(ty->back); @@ -1085,7 +1073,7 @@ termpty_backscroll_set(Termpty *ty, int size) ty->back = NULL; ty->backpos = 0; ty->backsize = size; - termpty_save_thaw(); + termpty_backlog_unlock(); } pid_t diff --git a/src/bin/termpty.h b/src/bin/termpty.h index b9b339a..4abecad 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -105,7 +105,7 @@ struct _Termpty size_t buflen; unsigned char oldbuf[4]; Termsave *back; - int backsize, backpos; + size_t backsize, backpos; struct { int screen_y; int backlog_y; @@ -232,16 +232,17 @@ Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h, int backscroll, Eina_Bool xterm_256color, Eina_Bool erase_is_del, const char *emotion_mod); void termpty_free(Termpty *ty); -void termpty_cellcomp_freeze(Termpty *ty); -void termpty_cellcomp_thaw(Termpty *ty); + +void termpty_backlog_lock(void); +void termpty_backlog_unlock(void); Termcell *termpty_cellrow_get(Termpty *ty, int y, int *wret); ssize_t termpty_row_length(Termpty *ty, int y); void termpty_write(Termpty *ty, const char *input, int len); void termpty_resize(Termpty *ty, int new_w, int new_h); -void termpty_backscroll_set(Termpty *ty, int size); +void termpty_backlog_size_set(Termpty *ty, size_t size); +ssize_t termpty_backlog_length(Termpty *ty); void termpty_backscroll_adjust(Termpty *ty, int *scroll); -ssize_t termpty_backscroll_length(Termpty *ty); pid_t termpty_pid_get(const Termpty *ty); void termpty_block_free(Termblock *tb); diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c index 95b8922..0d6d549 100644 --- a/src/bin/termptyops.c +++ b/src/bin/termptyops.c @@ -384,10 +384,10 @@ termpty_reset_state(Termpty *ty) ty->backlog_beacon.screen_y = 0; ty->backlog_beacon.backlog_y = 0; - termpty_save_freeze(); + termpty_backlog_lock(); if (ty->back) { - int i; + size_t i; for (i = 0; i < ty->backsize; i++) termpty_save_free(&ty->back[i]); free(ty->back); @@ -396,8 +396,8 @@ termpty_reset_state(Termpty *ty) ty->backpos = 0; backsize = ty->backsize; ty->backsize = 0; - termpty_backscroll_set(ty, backsize); - termpty_save_thaw(); + termpty_backlog_size_set(ty, backsize); + termpty_backlog_unlock(); } void diff --git a/src/bin/termptysave.c b/src/bin/termptysave.c index 3c5f1b7..0c5ae01 100644 --- a/src/bin/termptysave.c +++ b/src/bin/termptysave.c @@ -278,7 +278,7 @@ done: static void _walk_pty(Termpty *ty) { - int i; + size_t i; // int c0 = 0, c1 = 0; if (!ty->back) return; @@ -355,6 +355,7 @@ _check_compressor(Eina_Bool frozen) } } +#if 0 void termpty_save_freeze(void) { @@ -382,21 +383,24 @@ termpty_save_thaw(void) _check_compressor(EINA_TRUE); } } +#endif + + void termpty_save_register(Termpty *ty) { - termpty_save_freeze(); + termpty_backlog_lock(); ptys = eina_list_append(ptys, ty); - termpty_save_thaw(); + termpty_backlog_unlock(); } void termpty_save_unregister(Termpty *ty) { - termpty_save_freeze(); + termpty_backlog_lock(); ptys = eina_list_remove(ptys, ty); - termpty_save_thaw(); + termpty_backlog_unlock(); } Termsave * @@ -452,7 +456,7 @@ termpty_save_new(Termsave *ts, int w) } Termsave * -termpty_save_expand(Termsave *ts, Termcell *cells, ssize_t delta) +termpty_save_expand(Termsave *ts, Termcell *cells, size_t delta) { Termcell *newcells; @@ -481,3 +485,13 @@ termpty_save_free(Termsave *ts) ts->w = 0; _check_compressor(EINA_FALSE); } + +void +termpty_backlog_lock(void) +{ +} + +void +termpty_backlog_unlock(void) +{ +} diff --git a/src/bin/termptysave.h b/src/bin/termptysave.h index 4520fcc..b285bca 100644 --- a/src/bin/termptysave.h +++ b/src/bin/termptysave.h @@ -1,13 +1,11 @@ #ifndef _TERMPTY_SAVE_H__ #define _TERMPTY_SAVE_H__ 1 -void termpty_save_freeze(void); -void termpty_save_thaw(void); void termpty_save_register(Termpty *ty); void termpty_save_unregister(Termpty *ty); Termsave *termpty_save_extract(Termsave *ts); Termsave *termpty_save_new(Termsave *ts, int w); void termpty_save_free(Termsave *ts); -Termsave *termpty_save_expand(Termsave *ts, Termcell *cells, ssize_t delta); +Termsave *termpty_save_expand(Termsave *ts, Termcell *cells, size_t delta); #endif --