diff options
author | Eli Zaretskii <eliz@gnu.org> | 2012-08-11 17:34:55 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2012-08-11 17:34:55 +0300 |
commit | 141f1ff7a40cda10f0558e891dd196a943a5082e (patch) | |
tree | 4a1fced77628527d37258b7dfb1970db9a91653c /src/dispnew.c | |
parent | b5e9cbb6fdce4b7e8c5cd6ad1addf6e4af35da67 (diff) |
Second commit; does not compile yet.
Finalized saving of current_matrix and restoring into desired_matrix.
Added margin areas, when non-empty, to save/restore.
Replaced ScreenRetreive and ScreenUpdate with the new functions based on
saving and restoring glyph matrices.
Started work on reading input via read_char while inside menu display.
Diffstat (limited to 'src/dispnew.c')
-rw-r--r-- | src/dispnew.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 0c97512447..1cb30b84d6 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2040,7 +2040,7 @@ fake_current_matrices (Lisp_Object window) /* Save away the contents of frame F's current frame matrix. Value is a glyph matrix holding the contents of F's current frame matrix. */ -static struct glyph_matrix * +struct glyph_matrix * save_current_matrix (struct frame *f) { int i; @@ -2058,9 +2058,26 @@ save_current_matrix (struct frame *f) struct glyph_row *from = f->current_matrix->rows + i; struct glyph_row *to = saved->rows + i; ptrdiff_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); + to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes); memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes); to->used[TEXT_AREA] = from->used[TEXT_AREA]; + if (from->used[LEFT_MARGIN_AREA]) + { + nbytes = from->used[LEFT_MARGIN_AREA] * sizeof (struct glyph); + to->glyphs[LEFT_MARGIN_AREA] = (struct glyph *) xmalloc (nbytes); + memcpy (to->glyphs[LEFT_MARGIN_AREA], + from->glyphs[LEFT_MARGIN_AREA], nbytes); + to->used[LEFT_MARGIN_AREA] = from->used[LEFT_MARGIN_AREA]; + } + if (from->used[RIGHT_MARGIN_AREA]) + { + nbytes = from->used[RIGHT_MARGIN_AREA] * sizeof (struct glyph); + to->glyphs[RIGHT_MARGIN_AREA] = (struct glyph *) xmalloc (nbytes); + memcpy (to->glyphs[RIGHT_MARGIN_AREA], + from->glyphs[RIGHT_MARGIN_AREA], nbytes); + to->used[RIGHT_MARGIN_AREA] = from->used[RIGHT_MARGIN_AREA]; + } } return saved; @@ -2080,9 +2097,30 @@ restore_current_matrix (struct frame *f, struct glyph_matrix *saved) struct glyph_row *from = saved->rows + i; struct glyph_row *to = f->current_matrix->rows + i; ptrdiff_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); + memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes); to->used[TEXT_AREA] = from->used[TEXT_AREA]; xfree (from->glyphs[TEXT_AREA]); + nbytes = from->used[LEFT_MARGIN_AREA]; + if (nbytes) + { + memcpy (to->glyphs[LEFT_MARGIN_AREA], + from->glyphs[LEFT_MARGIN_AREA], nbytes); + to->used[LEFT_MARGIN_AREA] = from->used[LEFT_MARGIN_AREA]; + xfree (from->glyphs[LEFT_MARGIN_AREA]); + } + else + to->used[LEFT_MARGIN_AREA] = 0; + nbytes = from->used[RIGHT_MARGIN_AREA]; + if (nbytes) + { + memcpy (to->glyphs[RIGHT_MARGIN_AREA], + from->glyphs[RIGHT_MARGIN_AREA], nbytes); + to->used[RIGHT_MARGIN_AREA] = from->used[RIGHT_MARGIN_AREA]; + xfree (from->glyphs[RIGHT_MARGIN_AREA]); + } + else + to->used[RIGHT_MARGIN_AREA] = 0; } xfree (saved->rows); @@ -3355,6 +3393,8 @@ update_frame_with_menu (struct frame *f) /* Update the display */ update_begin (f); + /* Force update_frame_1 not to stop due to pending input, and not + try scrolling. */ paused_p = update_frame_1 (f, 1, 1); update_end (f); |