aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog10
-rw-r--r--src/dispnew.c73
2 files changed, 59 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index eb485d740b3..1bea2b42391 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12001-01-15 Gerd Moellmann <gerd@gnu.org>
2
3 * dispnew.c (save_or_restore_current_matrices): Function removed.
4 (save_current_matrix, restore_current_matrix): New functions.
5 (adjust_frame_glyphs_for_frame_redisplay): Use them to save and
6 restore the frame's current matrix. Due to the glyph pointer
7 setup done in adjust_glyph_matrix, there is no easy way to make
8 saving the current matrix in the desired matrix generally correct,
9 so don't try it.
10
12001-01-15 Kenichi Handa <handa@etl.go.jp> 112001-01-15 Kenichi Handa <handa@etl.go.jp>
2 12
3 * xdisp.c (insert_left_trunc_glyphs): Overwrite padding glyphs by 13 * xdisp.c (insert_left_trunc_glyphs): Overwrite padding glyphs by
diff --git a/src/dispnew.c b/src/dispnew.c
index dff5c91719d..b4a1dabc694 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -120,7 +120,8 @@ struct dim
120 120
121/* Function prototypes. */ 121/* Function prototypes. */
122 122
123static void save_or_restore_current_matrix P_ ((struct frame *, int)); 123static struct glyph_matrix *save_current_matrix P_ ((struct frame *));
124static void restore_current_matrix P_ ((struct frame *, struct glyph_matrix *));
124static void fake_current_matrices P_ ((Lisp_Object)); 125static void fake_current_matrices P_ ((Lisp_Object));
125static void redraw_overlapping_rows P_ ((struct window *, int)); 126static void redraw_overlapping_rows P_ ((struct window *, int));
126static void redraw_overlapped_rows P_ ((struct window *, int)); 127static void redraw_overlapped_rows P_ ((struct window *, int));
@@ -2153,38 +2154,63 @@ fake_current_matrices (window)
2153} 2154}
2154 2155
2155 2156
2156/* Save or restore the contents of frame F's current frame matrix. 2157/* Save away the contents of frame F's current frame matrix. Value is
2157 SAVE_P non-zero means save it. */ 2158 a glyph matrix holding the contents of F's current frame matrix. '*/
2158 2159
2159static void 2160static struct glyph_matrix *
2160save_or_restore_current_matrix (f, save_p) 2161save_current_matrix (f)
2161 struct frame *f; 2162 struct frame *f;
2162 int save_p;
2163{ 2163{
2164 struct glyph_row *from, *to, *end; 2164 int i;
2165 struct glyph_matrix *saved;
2165 2166
2166 if (save_p) 2167 saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
2167 { 2168 bzero (saved, sizeof *saved);
2168 from = f->current_matrix->rows; 2169 saved->nrows = f->current_matrix->nrows;
2169 end = from + f->current_matrix->nrows; 2170 saved->rows = (struct glyph_row *) xmalloc (saved->nrows
2170 to = f->desired_matrix->rows; 2171 * sizeof *saved->rows);
2171 } 2172 bzero (saved->rows, saved->nrows * sizeof *saved->rows);
2172 else 2173
2174 for (i = 0; i < saved->nrows; ++i)
2173 { 2175 {
2174 from = f->desired_matrix->rows; 2176 struct glyph_row *from = f->current_matrix->rows + i;
2175 end = from + f->desired_matrix->nrows; 2177 struct glyph_row *to = saved->rows + i;
2176 to = f->current_matrix->rows; 2178 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
2179 to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
2180 bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
2181 to->used[TEXT_AREA] = from->used[TEXT_AREA];
2177 } 2182 }
2178 2183
2179 for (; from < end; ++from, ++to) 2184 return saved;
2185}
2186
2187
2188/* Restore the contents of frame F's current frame matrix from SAVED,
2189 and free memory associated with SAVED. */
2190
2191static void
2192restore_current_matrix (f, saved)
2193 struct frame *f;
2194 struct glyph_matrix *saved;
2195{
2196 int i;
2197
2198 for (i = 0; i < saved->nrows; ++i)
2180 { 2199 {
2200 struct glyph_row *from = saved->rows + i;
2201 struct glyph_row *to = f->current_matrix->rows + i;
2181 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); 2202 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
2182 bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); 2203 bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
2183 to->used[TEXT_AREA] = from->used[TEXT_AREA]; 2204 to->used[TEXT_AREA] = from->used[TEXT_AREA];
2205 xfree (from->glyphs[TEXT_AREA]);
2184 } 2206 }
2207
2208 xfree (saved->rows);
2209 xfree (saved);
2185} 2210}
2186 2211
2187 2212
2213
2188/* Allocate/reallocate glyph matrices of a single frame F for 2214/* Allocate/reallocate glyph matrices of a single frame F for
2189 frame-based redisplay. */ 2215 frame-based redisplay. */
2190 2216
@@ -2256,9 +2282,6 @@ adjust_frame_glyphs_for_frame_redisplay (f)
2256 xassert (matrix_dim.width == FRAME_WIDTH (f) 2282 xassert (matrix_dim.width == FRAME_WIDTH (f)
2257 && matrix_dim.height == FRAME_HEIGHT (f)); 2283 && matrix_dim.height == FRAME_HEIGHT (f));
2258 2284
2259 /* Resize frame matrices. */
2260 adjust_glyph_matrix (NULL, f->desired_matrix, 0, 0, matrix_dim);
2261
2262 /* Pointers to glyph memory in glyph rows are exchanged during 2285 /* Pointers to glyph memory in glyph rows are exchanged during
2263 the update phase of redisplay, which means in general that a 2286 the update phase of redisplay, which means in general that a
2264 frame's current matrix consists of pointers into both the 2287 frame's current matrix consists of pointers into both the
@@ -2273,13 +2296,15 @@ adjust_frame_glyphs_for_frame_redisplay (f)
2273 && matrix_dim.width == f->current_matrix->matrix_w 2296 && matrix_dim.width == f->current_matrix->matrix_w
2274 && matrix_dim.height == f->current_matrix->matrix_h) 2297 && matrix_dim.height == f->current_matrix->matrix_h)
2275 { 2298 {
2276 save_or_restore_current_matrix (f, 1); 2299 struct glyph_matrix *copy = save_current_matrix (f);
2300 adjust_glyph_matrix (NULL, f->desired_matrix, 0, 0, matrix_dim);
2277 adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim); 2301 adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim);
2278 save_or_restore_current_matrix (f, 0); 2302 restore_current_matrix (f, copy);
2279 fake_current_matrices (FRAME_ROOT_WINDOW (f)); 2303 fake_current_matrices (FRAME_ROOT_WINDOW (f));
2280 } 2304 }
2281 else 2305 else
2282 { 2306 {
2307 adjust_glyph_matrix (NULL, f->desired_matrix, 0, 0, matrix_dim);
2283 adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim); 2308 adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim);
2284 SET_FRAME_GARBAGED (f); 2309 SET_FRAME_GARBAGED (f);
2285 } 2310 }