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.352 by root, Fri Oct 15 20:52:15 2010 UTC vs.
Revision 1.365 by sf-exg, Thu Jan 27 17:37:19 2011 UTC

400 } 400 }
401 401
402 free (tabs); 402 free (tabs);
403 tabs = (char *)rxvt_malloc (ncol); 403 tabs = (char *)rxvt_malloc (ncol);
404 404
405 for (int col = ncol; --col; ) 405 for (int col = ncol; col--; )
406 tabs [col] = col % TABSIZE == 0; 406 tabs [col] = col % TABSIZE == 0;
407 407
408 CLEAR_ALL_SELECTION (); 408 CLEAR_ALL_SELECTION ();
409 409
410 prev_nrow = nrow; 410 prev_nrow = nrow;
917 else 917 else
918 screen.cur.col = ncol - width; 918 screen.cur.col = ncol - width;
919 } 919 }
920 920
921 // nuke the character at this position, if required 921 // nuke the character at this position, if required
922 if (expect_false ( 922 // due to wonderful coincidences everywhere else in this loop
923 // we never have to check for overwriting a wide char itself,
924 // only its tail.
923 line->t[screen.cur.col] == NOCHAR 925 if (expect_false (line->t[screen.cur.col] == NOCHAR))
924 || (screen.cur.col < ncol - 1
925 && line->t[screen.cur.col + 1] == NOCHAR)
926 ))
927 scr_kill_char (*line, screen.cur.col); 926 scr_kill_char (*line, screen.cur.col);
928 927
929 line->touch (); 928 line->touch ();
930 929
931 do 930 do
1686 { 1685 {
1687 rvideo_state = on; 1686 rvideo_state = on;
1688 1687
1689 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); 1688 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
1690#ifdef HAVE_BG_PIXMAP 1689#ifdef HAVE_BG_PIXMAP
1691 if (bgPixmap.pixmap == None) 1690 if (bg_pixmap == None)
1692#endif 1691#endif
1693 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); 1692 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
1694 1693
1695 XGCValues gcvalue; 1694 XGCValues gcvalue;
1696 gcvalue.foreground = pix_colors[Color_fg]; 1695 gcvalue.foreground = pix_colors[Color_fg];
2032 refresh_count = 0; 2031 refresh_count = 0;
2033 2032
2034 unsigned int old_screen_flags = screen.flags; 2033 unsigned int old_screen_flags = screen.flags;
2035 char have_bg = 0; 2034 char have_bg = 0;
2036#ifdef HAVE_BG_PIXMAP 2035#ifdef HAVE_BG_PIXMAP
2037 have_bg = bgPixmap.pixmap != None; 2036 have_bg = bg_pixmap != None;
2038#endif 2037#endif
2039 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 2038 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
2040 2039
2041 /* 2040 /*
2042 * B: reverse any characters which are selected 2041 * B: reverse any characters which are selected
2509 scr_remap_chars (swap_buf [i]); 2508 scr_remap_chars (swap_buf [i]);
2510 } 2509 }
2511} 2510}
2512 2511
2513void 2512void
2514rxvt_term::scr_recolour () NOTHROW 2513rxvt_term::scr_recolour (bool refresh) NOTHROW
2515{ 2514{
2515 bool transparent = false;
2516
2516#ifdef HAVE_BG_PIXMAP 2517#ifdef HAVE_BG_PIXMAP
2517 bgPixmap.apply (); 2518 if (bg_pixmap != None)
2518#else 2519 {
2520# ifdef ENABLE_TRANSPARENCY
2521 if (bg_flags & isTransparent)
2522 {
2523 XSetWindowBackgroundPixmap (dpy, parent[0], bg_pixmap);
2524 XSetWindowBackgroundPixmap (dpy, vt, ParentRelative);
2519 2525
2526 transparent = true;
2527 }
2528 else
2529# endif
2530 {
2531 XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]);
2532 XSetWindowBackgroundPixmap (dpy, vt, bg_pixmap);
2533 }
2534 }
2535 else
2536#endif
2537 {
2520 XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); 2538 XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]);
2539 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
2540 }
2541
2521 XClearWindow (dpy, parent[0]); 2542 XClearWindow (dpy, parent[0]);
2522 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
2523 2543
2524 if (scrollBar.win) 2544 if (scrollBar.win)
2525 { 2545 {
2546 if (transparent)
2547 XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative);
2548 else
2526 XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); 2549 XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]);
2527 scrollBar.state = STATE_IDLE; 2550 scrollBar.state = STATE_IDLE;
2528 scrollBar.show (0); 2551 scrollBar.show (0);
2529 } 2552 }
2530 2553
2531#endif 2554 if (refresh)
2532 2555 {
2533 /* bgPixmap.apply () does not do the following : */
2534 scr_clear (); 2556 scr_clear ();
2535 scr_touch (true); 2557 scr_touch (true);
2558 }
2536 want_refresh = 1; 2559 want_refresh = 1;
2537} 2560}
2538 2561
2539/* ------------------------------------------------------------------------- */ 2562/* ------------------------------------------------------------------------- */
2540void 2563void
2628void 2651void
2629rxvt_term::scr_dump (int fd) NOTHROW 2652rxvt_term::scr_dump (int fd) NOTHROW
2630{ 2653{
2631 int row, wrote; 2654 int row, wrote;
2632 unsigned int width, towrite; 2655 unsigned int width, towrite;
2633 char r1[] = "\n"; 2656 const char r1[] = "\n";
2634 2657
2635 for (row = saveLines + top_row; 2658 for (row = saveLines + top_row;
2636 row < saveLines + nrow - 1; row++) 2659 row < saveLines + nrow - 1; row++)
2637 { 2660 {
2638 width = row_buf[row].l >= 0 ? row_buf[row].l 2661 width = row_buf[row].l >= 0 ? row_buf[row].l
2773 &ct2.nitems, &bytes_after, 2796 &ct2.nitems, &bytes_after,
2774 &ct2.value) != Success) 2797 &ct2.value) != Success)
2775 goto bailout; 2798 goto bailout;
2776 2799
2777 // realloc should be compatible to XFree, here, and elsewhere, too 2800 // realloc should be compatible to XFree, here, and elsewhere, too
2778 ct.value = (unsigned char *)realloc (ct.value, ct.nitems + ct2.nitems + 1); 2801 ct.value = (unsigned char *)rxvt_realloc (ct.value, ct.nitems + ct2.nitems + 1);
2779 memcpy (ct.value + ct.nitems, ct2.value, ct2.nitems + 1); 2802 memcpy (ct.value + ct.nitems, ct2.value, ct2.nitems + 1);
2780 ct.nitems += ct2.nitems; 2803 ct.nitems += ct2.nitems;
2781 2804
2782 XFree (ct2.value); 2805 XFree (ct2.value);
2783 } 2806 }
2832 incr_ev.start (10); 2855 incr_ev.start (10);
2833 2856
2834 while (incr_buf_fill + ct.nitems > incr_buf_size) 2857 while (incr_buf_fill + ct.nitems > incr_buf_size)
2835 { 2858 {
2836 incr_buf_size = incr_buf_size ? incr_buf_size * 2 : 128*1024; 2859 incr_buf_size = incr_buf_size ? incr_buf_size * 2 : 128*1024;
2837 incr_buf = (char *)realloc (incr_buf, incr_buf_size); 2860 incr_buf = (char *)rxvt_realloc (incr_buf, incr_buf_size);
2838 } 2861 }
2839 2862
2840 memcpy (incr_buf + incr_buf_fill, ct.value, ct.nitems); 2863 memcpy (incr_buf + incr_buf_fill, ct.value, ct.nitems);
2841 incr_buf_fill += ct.nitems; 2864 incr_buf_fill += ct.nitems;
2842 2865
2999 * EXT: button 1 or 3 release 3022 * EXT: button 1 or 3 release
3000 */ 3023 */
3001void 3024void
3002rxvt_term::selection_make (Time tm) 3025rxvt_term::selection_make (Time tm)
3003{ 3026{
3004 int i; 3027 int size;
3005 wchar_t *new_selection_text; 3028 wchar_t *new_selection_text;
3006 text_t *t; 3029 text_t *t;
3007 3030
3008 switch (selection.op) 3031 switch (selection.op)
3009 { 3032 {
3025 return; /* nothing selected, go away */ 3048 return; /* nothing selected, go away */
3026 3049
3027 if (HOOK_INVOKE ((this, HOOK_SEL_MAKE, DT_LONG, (long)tm, DT_END))) 3050 if (HOOK_INVOKE ((this, HOOK_SEL_MAKE, DT_LONG, (long)tm, DT_END)))
3028 return; 3051 return;
3029 3052
3030 i = (selection.end.row - selection.beg.row + 1) * (ncol + 1); 3053 size = (selection.end.row - selection.beg.row + 1) * (ncol + 1);
3031 new_selection_text = (wchar_t *)rxvt_malloc ((i + 4) * sizeof (wchar_t)); 3054 new_selection_text = (wchar_t *)rxvt_malloc ((size + 4) * sizeof (wchar_t));
3032 3055
3033 int ofs = 0; 3056 int ofs = 0;
3034 int extra = 0; 3057 int extra = 0;
3035 3058
3036 int col = selection.beg.col; 3059 int col = selection.beg.col;
3042 { 3065 {
3043#if !ENABLE_MINIMAL 3066#if !ENABLE_MINIMAL
3044 if (selection.rect) 3067 if (selection.rect)
3045 { 3068 {
3046 col = selection.beg.col; 3069 col = selection.beg.col;
3047 end_col = ncol + 1; 3070 end_col = selection.end.col;
3048 } 3071 }
3049 else 3072 else
3050#endif 3073#endif
3051 end_col = ROW(row).l; 3074 end_col = ROW(row).l;
3052 3075
3053 col = max (col, 0); 3076 col = max (col, 0);
3054 3077
3055 if (row == selection.end.row 3078 if (row == selection.end.row)
3056#if !ENABLE_MINIMAL
3057 || selection.rect
3058#endif
3059 )
3060 min_it (end_col, selection.end.col); 3079 min_it (end_col, selection.end.col);
3061 3080
3062 t = ROW(row).t + col; 3081 t = ROW(row).t + col;
3063 3082
3064 for (; col < end_col; col++) 3083 for (; col < end_col; col++)
3072 3091
3073 extra -= (len - 1); 3092 extra -= (len - 1);
3074 3093
3075 if (extra < 0) 3094 if (extra < 0)
3076 { 3095 {
3077 extra += i; 3096 extra += size;
3078 i += i; 3097 size += size;
3079 new_selection_text = (wchar_t *)rxvt_realloc (new_selection_text, (i + 4) * sizeof (wchar_t)); 3098 new_selection_text = (wchar_t *)rxvt_realloc (new_selection_text, (size + 4) * sizeof (wchar_t));
3080 } 3099 }
3081 3100
3082 ofs += rxvt_composite.expand (*t++, new_selection_text + ofs); 3101 ofs += rxvt_composite.expand (*t++, new_selection_text + ofs);
3083 } 3102 }
3084#endif 3103#endif
3096 3115
3097 new_selection_text[ofs++] = C0_LF; 3116 new_selection_text[ofs++] = C0_LF;
3098 } 3117 }
3099 else 3118 else
3100#endif 3119#endif
3101 if (!ROW(row).is_longer () && row != selection.end.row) 3120 if (!ROW(row).is_longer ()
3121 && (row != selection.end.row || end_col != selection.end.col)
3122 && (row != selection.beg.row || selection.beg.col < ncol))
3102 new_selection_text[ofs++] = C0_LF; 3123 new_selection_text[ofs++] = C0_LF;
3103 } 3124 }
3104
3105 if (end_col != selection.end.col)
3106 new_selection_text[ofs++] = C0_LF;
3107 3125
3108 new_selection_text[ofs] = 0; 3126 new_selection_text[ofs] = 0;
3109 3127
3110 if (ofs == 0) 3128 if (ofs == 0)
3111 { 3129 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines