--- rxvt-unicode/src/screen.C 2004/02/24 23:58:13 1.37 +++ rxvt-unicode/src/screen.C 2004/02/25 15:06:05 1.39 @@ -3,6 +3,7 @@ *---------------------------------------------------------------------------* * * Copyright (c) 1997-2001 Geoff Wing + * Copyright (c) 2003-2004 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,8 +19,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *--------------------------------------------------------------------------*/ + /* - * We handle _all_ screen updates and selections + * This file handles _all_ screen updates and selections */ #include "../config.h" /* NECESSARY */ @@ -32,7 +34,7 @@ #include #include -#include "salloc.C" // HACK!! +#include "salloc.C" // HACK, should be a seperate compile! inline void fill_text (text_t *start, text_t value, int len) { @@ -2490,10 +2492,10 @@ for (;;) { if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4), - (long) (PROP_SIZE / 4), delete_prop, - AnyPropertyType, &ct.encoding, &ct.format, - &ct.nitems, &bytes_after, - &ct.value) != Success) + (long) (PROP_SIZE / 4), delete_prop, + AnyPropertyType, &ct.encoding, &ct.format, + &ct.nitems, &bytes_after, + &ct.value) != Success) break; if (ct.encoding == 0) @@ -2511,7 +2513,8 @@ if (ct.nitems == 0) { D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end")); - if (selection_wait == Sel_normal && nread == 0) + if (selection_wait == Sel_normal && nread == 0 + && (win != display->root || prop != XA_CUT_BUFFER0)) // avoid recursion { /* * pass through again trying CUT_BUFFER0 if we've come from @@ -2734,6 +2737,7 @@ default: return; } + selection.op = SELECTION_DONE; if (selection.clicks == 4) @@ -2794,7 +2798,7 @@ return; } - // due to MB_MAX_CUR, selection wastage is usually high, so realloc + // due to MB_CUR_MAX, selection wastage is usually high, so realloc if (str - (char *)new_selection_text > 1024) new_selection_text = (unsigned char *)rxvt_realloc (new_selection_text, i + 1); @@ -2818,12 +2822,12 @@ if (XmbTextListToTextProperty (display->display, &cl, 1, XStringStyle, &ct) >= 0) { XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, - PropModeReplace, ct.value, ct.nitems); + PropModeReplace, ct.value, ct.nitems); XFree (ct.value); } else XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, - PropModeReplace, selection.text, (int)selection.len); + PropModeReplace, selection.text, (int)selection.len); } selection_time = tm;