--- rxvt-unicode/src/screen.C 2011/02/12 00:50:04 1.374 +++ rxvt-unicode/src/screen.C 2011/04/22 10:01:39 1.381 @@ -3,7 +3,7 @@ *---------------------------------------------------------------------------* * * Copyright (c) 1997-2001 Geoff Wing - * Copyright (c) 2003-2007 Marc Lehmann + * Copyright (c) 2003-2007 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 @@ -161,6 +161,10 @@ void rxvt_term::scr_reset () { +#if ENABLE_OVERLAY + scr_overlay_off (); +#endif + view_start = 0; num_scr = 0; @@ -1922,7 +1926,7 @@ # ifdef MAPALERT_OPTION if (option (Opt_mapAlert)) # endif - XMapWindow (dpy, parent[0]); + XMapWindow (dpy, parent); # endif # if ENABLE_FRILLS @@ -2518,7 +2522,7 @@ # ifdef ENABLE_TRANSPARENCY if (bg_flags & BG_IS_TRANSPARENT) { - XSetWindowBackgroundPixmap (dpy, parent[0], bg_pixmap); + XSetWindowBackgroundPixmap (dpy, parent, bg_pixmap); XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); transparent = true; @@ -2526,18 +2530,18 @@ else # endif { - XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); + XSetWindowBackground (dpy, parent, pix_colors[Color_border]); XSetWindowBackgroundPixmap (dpy, vt, bg_pixmap); } } else #endif { - XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); + XSetWindowBackground (dpy, parent, pix_colors[Color_border]); XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); } - XClearWindow (dpy, parent[0]); + XClearWindow (dpy, parent); if (scrollBar.win) { @@ -2742,32 +2746,12 @@ * will auto fallback to CUT_BUFFER0 * EXT: button 2 release */ - -static void -selection_cb (char *data, unsigned int len, rxvt_selection *rs) -{ - rxvt_term *term = (rxvt_term *)rs->user_data; - - if (data) - term->paste (data, len); - delete rs; - term->selection_req = 0; -} - void rxvt_term::selection_request (Time tm, int selnum) NOTHROW { - if (selection.text && selnum == Sel_Primary) - { - /* internal selection */ - char *str = rxvt_wcstombs (selection.text, selection.len); - paste (str, strlen (str)); - free (str); - return; - } - else if (!selection_req) + if (!selection_req) { - selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], selection_cb, this); + selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); selection_req->run (); } } @@ -3423,6 +3407,7 @@ void rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW { + Atom property = rq.property == None ? rq.target : rq.property; XSelectionEvent ev; ev.type = SelectionNotify; @@ -3447,10 +3432,10 @@ *target++ = xa[XA_UTF8_STRING]; #endif - XChangeProperty (dpy, rq.requestor, rq.property, XA_ATOM, + XChangeProperty (dpy, rq.requestor, property, XA_ATOM, 32, PropModeReplace, (unsigned char *)target_list, target - target_list); - ev.property = rq.property; + ev.property = property; } #if TODO // TODO else if (rq.target == xa[XA_MULTIPLE]) @@ -3460,15 +3445,15 @@ #endif else if (rq.target == xa[XA_TIMESTAMP] && rq.selection == XA_PRIMARY && selection.text) { - XChangeProperty (dpy, rq.requestor, rq.property, rq.target, + XChangeProperty (dpy, rq.requestor, property, rq.target, 32, PropModeReplace, (unsigned char *)&selection_time, 1); - ev.property = rq.property; + ev.property = property; } else if (rq.target == xa[XA_TIMESTAMP] && rq.selection == xa[XA_CLIPBOARD] && selection.clip_text) { - XChangeProperty (dpy, rq.requestor, rq.property, rq.target, + XChangeProperty (dpy, rq.requestor, property, rq.target, 32, PropModeReplace, (unsigned char *)&clipboard_time, 1); - ev.property = rq.property; + ev.property = property; } else if (rq.target == XA_STRING || rq.target == xa[XA_TEXT] @@ -3549,10 +3534,10 @@ ct.encoding = target; } - XChangeProperty (dpy, rq.requestor, rq.property, + XChangeProperty (dpy, rq.requestor, property, ct.encoding, 8, PropModeReplace, ct.value, (int)ct.nitems); - ev.property = rq.property; + ev.property = property; if (freect) XFree (ct.value);