ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.417 by root, Mon May 28 16:40:03 2012 UTC vs.
Revision 1.424 by root, Fri Jun 29 22:10:09 2012 UTC

161{ 161{
162 int tsize = sizeof (text_t) * ncol; 162 int tsize = sizeof (text_t) * ncol;
163 int rsize = sizeof (rend_t) * ncol; 163 int rsize = sizeof (rend_t) * ncol;
164 164
165 // we assume that rend_t size is a sufficient alignment 165 // we assume that rend_t size is a sufficient alignment
166 // factor for tetx_t and line_t values, and we only 166 // factor for text_t and line_t values, and we only
167 // need to adjust tsize. 167 // need to adjust tsize.
168 tsize = (tsize + sizeof (rend_t) - 1); 168 tsize = (tsize + sizeof (rend_t) - 1);
169 tsize -= tsize % sizeof (rend_t); 169 tsize -= tsize % sizeof (rend_t);
170 170
171 int all_rows = total_rows + nrow + nrow; 171 int all_rows = total_rows + nrow + nrow;
172 172
173 chunk_size = (sizeof (line_t) + rsize + tsize) * all_rows; 173 chunk_size = (sizeof (line_t) + rsize + tsize) * all_rows;
174 chunk = rxvt_malloc (chunk_size); 174 chunk = chunk_alloc (chunk_size, 0);
175 175
176 char *base = (char *)chunk + sizeof (line_t) * all_rows; 176 char *base = (char *)chunk + sizeof (line_t) * all_rows;
177 177
178 for (int row = 0; row < all_rows; ++row) 178 for (int row = 0; row < all_rows; ++row)
179 { 179 {
225 225
226 screen.tscroll = 0; 226 screen.tscroll = 0;
227 screen.bscroll = nrow - 1; 227 screen.bscroll = nrow - 1;
228 228
229 void *prev_chunk = chunk; 229 void *prev_chunk = chunk;
230 size_t prev_chunk_size = chunk_size;
230 line_t *prev_drawn_buf = drawn_buf; 231 line_t *prev_drawn_buf = drawn_buf;
231 line_t *prev_swap_buf = swap_buf; 232 line_t *prev_swap_buf = swap_buf;
232 line_t *prev_row_buf = row_buf; 233 line_t *prev_row_buf = row_buf;
233 234
234 int common_col = min (prev_ncol, ncol); 235 int common_col = min (prev_ncol, ncol);
236 scr_alloc (); 237 scr_alloc ();
237 238
238 if (!prev_row_buf) 239 if (!prev_row_buf)
239 { 240 {
240 /* 241 /*
241 * first time called so just malloc everything: don't rely on realloc 242 * first time called (or after scr_release) so just malloc everything: don't rely on realloc
242 */ 243 */
243 top_row = 0; 244 top_row = 0;
244 term_start = 0; 245 term_start = 0;
245 246
246 memset (charsets, 'B', sizeof (charsets)); 247 memset (charsets, 'B', sizeof (charsets));
408 if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE); 409 if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE);
409 if (!swap_buf [row].valid ()) scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE); 410 if (!swap_buf [row].valid ()) scr_blank_screen_mem (swap_buf [row], DEFAULT_RSTYLE);
410 if (!drawn_buf [row].valid ()) scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); 411 if (!drawn_buf [row].valid ()) scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE);
411 } 412 }
412 413
413 free (prev_chunk); 414 printf ("pc %p\n", prev_chunk);//D
415 chunk_free (prev_chunk, prev_chunk_size);
414 416
415 free (tabs); 417 free (tabs);
416 tabs = (char *)rxvt_malloc (ncol); 418 tabs = (char *)rxvt_malloc (ncol);
417 419
418 for (int col = ncol; col--; ) 420 for (int col = ncol; col--; )
426 tt_winch (); 428 tt_winch ();
427 429
428 HOOK_INVOKE ((this, HOOK_RESET, DT_END)); 430 HOOK_INVOKE ((this, HOOK_RESET, DT_END));
429} 431}
430 432
431/* ------------------------------------------------------------------------- */
432/*
433 * Free everything. That way malloc debugging can find leakage.
434 */
435void ecb_cold 433void ecb_cold
436rxvt_term::scr_release () NOTHROW 434rxvt_term::scr_release () NOTHROW
437{ 435{
438 free (chunk); 436 chunk_free (chunk, chunk_size);
437 chunk = 0;
438 row_buf = 0;
439
439 free (tabs); 440 free (tabs);
441 tabs = 0;
440} 442}
441 443
442/* ------------------------------------------------------------------------- */ 444/* ------------------------------------------------------------------------- */
443/* 445/*
444 * Hard/Soft reset 446 * Hard/Soft reset
446void ecb_cold 448void ecb_cold
447rxvt_term::scr_poweron () 449rxvt_term::scr_poweron ()
448{ 450{
449 scr_release (); 451 scr_release ();
450 452
451 row_buf = 0;
452 tabs = 0;
453 prev_nrow = prev_ncol = 0; 453 prev_nrow = prev_ncol = 0;
454 rvideo_mode = false; 454 rvideo_mode = false;
455 scr_soft_reset (); 455 scr_soft_reset ();
456 scr_reset (); 456 scr_reset ();
457 457
1708 { 1708 {
1709 rvideo_state = on; 1709 rvideo_state = on;
1710 1710
1711 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); 1711 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
1712#ifdef HAVE_BG_PIXMAP 1712#ifdef HAVE_BG_PIXMAP
1713 if (bg_pixmap == None) 1713 if (bg_img == 0)
1714#endif 1714#endif
1715 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); 1715 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
1716 1716
1717 XGCValues gcvalue; 1717 XGCValues gcvalue;
1718 gcvalue.foreground = pix_colors[Color_fg]; 1718 gcvalue.foreground = pix_colors[Color_fg];
2053 refresh_count = 0; 2053 refresh_count = 0;
2054 2054
2055 unsigned int old_screen_flags = screen.flags; 2055 unsigned int old_screen_flags = screen.flags;
2056 bool have_bg = 0; 2056 bool have_bg = 0;
2057#ifdef HAVE_BG_PIXMAP 2057#ifdef HAVE_BG_PIXMAP
2058 have_bg = bg_pixmap != None; 2058 have_bg = bg_img != 0;
2059#endif 2059#endif
2060 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 2060 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
2061 2061
2062 /* 2062 /*
2063 * B: reverse any characters which are selected 2063 * B: reverse any characters which are selected
2534rxvt_term::scr_recolour (bool refresh) NOTHROW 2534rxvt_term::scr_recolour (bool refresh) NOTHROW
2535{ 2535{
2536 bool transparent = false; 2536 bool transparent = false;
2537 2537
2538#ifdef HAVE_BG_PIXMAP 2538#ifdef HAVE_BG_PIXMAP
2539 if (bg_pixmap != None) 2539 if (bg_img != 0)
2540 { 2540 {
2541# ifdef ENABLE_TRANSPARENCY 2541# if ENABLE_TRANSPARENCY
2542 if (bg_flags & BG_IS_TRANSPARENT) 2542 if (bg_flags & BG_IS_TRANSPARENT)
2543 { 2543 {
2544 XSetWindowBackgroundPixmap (dpy, parent, bg_pixmap); 2544 XSetWindowBackgroundPixmap (dpy, parent, bg_img->pm);
2545 XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); 2545 XSetWindowBackgroundPixmap (dpy, vt, ParentRelative);
2546 2546
2547 transparent = true; 2547 transparent = true;
2548 } 2548 }
2549 else 2549 else
2550# endif 2550# endif
2551 { 2551 {
2552 XSetWindowBackground (dpy, parent, pix_colors[Color_border]); 2552 XSetWindowBackground (dpy, parent, pix_colors[Color_border]);
2553 XSetWindowBackgroundPixmap (dpy, vt, bg_pixmap); 2553 XSetWindowBackgroundPixmap (dpy, vt, bg_img->pm);
2554 } 2554 }
2555 } 2555 }
2556 else 2556 else
2557#endif 2557#endif
2558 { 2558 {
3532 3532
3533 XSendEvent (dpy, rq.requestor, False, 0L, (XEvent *)&ev); 3533 XSendEvent (dpy, rq.requestor, False, 0L, (XEvent *)&ev);
3534} 3534}
3535 3535
3536/* ------------------------------------------------------------------------- */ 3536/* ------------------------------------------------------------------------- */
3537#ifdef USE_XIM 3537#if USE_XIM
3538void ecb_cold 3538void ecb_cold
3539rxvt_term::im_set_position (XPoint &pos) NOTHROW 3539rxvt_term::im_set_position (XPoint &pos) NOTHROW
3540{ 3540{
3541 XWindowAttributes xwa; 3541 XWindowAttributes xwa;
3542 3542

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines