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.37 by pcg, Tue Feb 24 23:58:13 2004 UTC vs.
Revision 1.41 by pcg, Sun Feb 29 15:31:56 2004 UTC

1/*--------------------------------*-C-*--------------------------------------* 1/*--------------------------------*-C-*--------------------------------------*
2 * File: screen.c 2 * File: screen.c
3 *---------------------------------------------------------------------------* 3 *---------------------------------------------------------------------------*
4 * 4 *
5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
6 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version. 11 * (at your option) any later version.
16 * 17 *
17 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *--------------------------------------------------------------------------*/ 21 *--------------------------------------------------------------------------*/
22
21/* 23/*
22 * We handle _all_ screen updates and selections 24 * This file handles _all_ screen updates and selections
23 */ 25 */
24 26
25#include "../config.h" /* NECESSARY */ 27#include "../config.h" /* NECESSARY */
26#define INTERN_SCREEN 28#define INTERN_SCREEN
27#include "rxvt.h" /* NECESSARY */ 29#include "rxvt.h" /* NECESSARY */
30#include <X11/Xmd.h> /* get the typedef for CARD32 */ 32#include <X11/Xmd.h> /* get the typedef for CARD32 */
31 33
32#include <stdint.h> 34#include <stdint.h>
33#include <wchar.h> 35#include <wchar.h>
34 36
35#include "salloc.C" // HACK!! 37#include "salloc.C" // HACK, should be a seperate compile!
36 38
37inline void fill_text (text_t *start, text_t value, int len) 39inline void fill_text (text_t *start, text_t value, int len)
38{ 40{
39 while (len--) 41 while (len--)
40 *start++ = value; 42 *start++ = value;
2153 back = Color_RV; 2155 back = Color_RV;
2154#endif 2156#endif
2155 } 2157 }
2156 2158
2157#ifdef TEXT_BLINK 2159#ifdef TEXT_BLINK
2158 if (rend & RS_Blink) 2160 if (rend & RS_Blink && back == Color_bg)
2159 { 2161 {
2160 if (!text_blink_ev.active) 2162 if (!text_blink_ev.active)
2161 { 2163 {
2162 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 2164 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL);
2163 hidden_text = 0; 2165 hidden_text = 0;
2488 } 2490 }
2489 2491
2490 for (;;) 2492 for (;;)
2491 { 2493 {
2492 if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4), 2494 if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4),
2493 (long) (PROP_SIZE / 4), delete_prop, 2495 (long) (PROP_SIZE / 4), delete_prop,
2494 AnyPropertyType, &ct.encoding, &ct.format, 2496 AnyPropertyType, &ct.encoding, &ct.format,
2495 &ct.nitems, &bytes_after, 2497 &ct.nitems, &bytes_after,
2496 &ct.value) != Success) 2498 &ct.value) != Success)
2497 break; 2499 break;
2498 2500
2499 if (ct.encoding == 0) 2501 if (ct.encoding == 0)
2500 { 2502 {
2501 D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!")); 2503 D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!"));
2509 } 2511 }
2510 2512
2511 if (ct.nitems == 0) 2513 if (ct.nitems == 0)
2512 { 2514 {
2513 D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end")); 2515 D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end"));
2514 if (selection_wait == Sel_normal && nread == 0) 2516 if (selection_wait == Sel_normal && nread == 0
2517 && (win != display->root || prop != XA_CUT_BUFFER0)) // avoid recursion
2515 { 2518 {
2516 /* 2519 /*
2517 * pass through again trying CUT_BUFFER0 if we've come from 2520 * pass through again trying CUT_BUFFER0 if we've come from
2518 * XConvertSelection () but nothing was presented 2521 * XConvertSelection () but nothing was presented
2519 */ 2522 */
2732 selection.op = SELECTION_DONE; 2735 selection.op = SELECTION_DONE;
2733 /* FALLTHROUGH */ 2736 /* FALLTHROUGH */
2734 default: 2737 default:
2735 return; 2738 return;
2736 } 2739 }
2740
2737 selection.op = SELECTION_DONE; 2741 selection.op = SELECTION_DONE;
2738 2742
2739 if (selection.clicks == 4) 2743 if (selection.clicks == 4)
2740 return; /* nothing selected, go away */ 2744 return; /* nothing selected, go away */
2741 2745
2792 { 2796 {
2793 free (new_selection_text); 2797 free (new_selection_text);
2794 return; 2798 return;
2795 } 2799 }
2796 2800
2797 // due to MB_MAX_CUR, selection wastage is usually high, so realloc 2801 // due to MB_CUR_MAX, selection wastage is usually high, so realloc
2798 if (str - (char *)new_selection_text > 1024) 2802 if (str - (char *)new_selection_text > 1024)
2799 new_selection_text = (unsigned char *)rxvt_realloc (new_selection_text, i + 1); 2803 new_selection_text = (unsigned char *)rxvt_realloc (new_selection_text, i + 1);
2800 2804
2801 selection.len = i; 2805 selection.len = i;
2802 2806
2816 char *cl = (char *)selection.text; 2820 char *cl = (char *)selection.text;
2817 2821
2818 if (XmbTextListToTextProperty (display->display, &cl, 1, XStringStyle, &ct) >= 0) 2822 if (XmbTextListToTextProperty (display->display, &cl, 1, XStringStyle, &ct) >= 0)
2819 { 2823 {
2820 XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, 2824 XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8,
2821 PropModeReplace, ct.value, ct.nitems); 2825 PropModeReplace, ct.value, ct.nitems);
2822 XFree (ct.value); 2826 XFree (ct.value);
2823 } 2827 }
2824 else 2828 else
2825 XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, 2829 XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8,
2826 PropModeReplace, selection.text, (int)selection.len); 2830 PropModeReplace, selection.text, (int)selection.len);
2827 } 2831 }
2828 2832
2829 selection_time = tm; 2833 selection_time = tm;
2830 D_SELECT ((stderr, "rxvt_selection_make (): selection.len=%d", selection.len)); 2834 D_SELECT ((stderr, "rxvt_selection_make (): selection.len=%d", selection.len));
2831} 2835}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines