--- rxvt-unicode/src/command.C 2012/06/06 08:59:13 1.517 +++ rxvt-unicode/src/command.C 2012/12/30 15:52:37 1.530 @@ -6,7 +6,7 @@ * Copyright (c) 1992 John Bovey, University of Kent at Canterbury * - original version * Copyright (c) 1994 Robert Nation - * - extensive modifications + * - extensive modifications * Copyright (c) 1995 Garrett D'Amore * - vt100 printing * Copyright (c) 1995 Steven Hirsch @@ -22,7 +22,7 @@ * and Linux 1.2.x * Copyright (c) 1997,1998 Oezguer Kesim * Copyright (c) 1998-2001 Geoff Wing - * - extensive modifications + * - extensive modifications * Copyright (c) 1998 Alfredo K. Kojima * Copyright (c) 2001 Marius Gedminas * - Ctrl/Mod4+Tab works like Meta+Tab (options) @@ -943,7 +943,7 @@ { flush_ev.stop (); -#ifdef HAVE_BG_PIXMAP +#ifdef HAVE_IMG if (bg_flags & BG_NEEDS_REFRESH) { bg_flags &= ~BG_NEEDS_REFRESH; @@ -1469,13 +1469,16 @@ bool want_position_change = SHOULD_INVOKE (HOOK_POSITION_CHANGE); + bool moved = false; #ifdef HAVE_BG_PIXMAP if (bg_window_position_sensitive ()) - want_position_change = true; + { + want_position_change = true; + if (bg_img == 0) + moved = true; + } #endif - bool moved = false; - if (want_position_change) { int x, y; @@ -1490,14 +1493,11 @@ if (x != parent_x || y != parent_y) { - HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END)); parent_x = x; parent_y = y; + HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END)); + moved = true; } - - if (bg_set_position (x, y) - || !(bg_flags & BG_IS_VALID)) - moved = true; } if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) @@ -1531,19 +1531,14 @@ case MapNotify: #ifdef HAVE_BG_PIXMAP - /* This is needed specifically to fix the case of no window manager or a - * non-reparenting window manager. In those cases we never get first - * ConfigureNotify. Also that speeds startup under normal WM, by taking - * care of multiplicity of ConfigureNotify events arriving while WM does - * reparenting. - * We should not render background immediately, as there could be several - * ConfigureNotify's to follow. Lets take care of all of them in one scoop - * by scheduling background redraw as soon as we can, but giving a short - * bit of time for ConfigureNotifies to arrive. - * We should render background PRIOR to drawing any text, but AFTER all - * of ConfigureNotifys for the best results. - */ - if (!(bg_flags & BG_IS_VALID)) + // This is needed at startup for the case of no window manager + // or a non-reparenting window manager and also because we + // defer bg image updates if the window is not mapped. The + // short delay is to optimize for multiple ConfigureNotify + // events at startup when the window manager reparents the + // window, so as to perform the computation after we have + // received all of them. + if (bg_img == 0) update_background_ev.start (0.025); #endif mapped = 1; @@ -1840,7 +1835,7 @@ #endif } -#if ENABLE_TRANSPARENCY || ENABLE_PERL +#if BG_IMAGE_FROM_ROOT || ENABLE_PERL void ecb_hot rxvt_term::rootwin_cb (XEvent &ev) { @@ -1860,7 +1855,7 @@ if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) { -# if ENABLE_TRANSPARENCY +#if BG_IMAGE_FROM_ROOT bg_set_root_pixmap (); update_background (); #endif @@ -2389,6 +2384,8 @@ if (len == (size_t)-1) { mbstate.reset (); // reset now undefined conversion state + // a -1 might indicate that a previous incomplete char is invalid (previous return -2) + // in which case we "erroneously" return the next byte which might be valid. return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through } @@ -3453,7 +3450,8 @@ case URxvt_Color_border: process_color_seq (op, Color_border, str, resp); break; -#if ENABLE_TRANSPARENCY + +#if BG_IMAGE_FROM_ROOT case URxvt_Color_tint: process_color_seq (op, Color_tint, str, resp); { @@ -3474,15 +3472,10 @@ if (!strcmp (str, "?")) { char str[256]; - int h_scale = 0, v_scale = 0; - int h_align = 0, v_align = 0; - if (image_vec.size () > 0) - { - h_scale = image_vec[0].h_scale; - v_scale = image_vec[0].v_scale; - h_align = image_vec[0].h_align; - v_align = image_vec[0].v_align; - } + int h_scale = fimage.h_scale; + int v_scale = fimage.v_scale; + int h_align = fimage.h_align; + int v_align = fimage.v_align; sprintf (str, "[%dx%d+%d+%d]", h_scale, v_scale, @@ -3495,22 +3488,20 @@ if (*str != ';') { - if (image_vec.size () > 0) - changed = image_vec[0].set_file_geometry (str); - else + try + { + fimage.set_file_geometry (this, str); + changed = true; + } + catch (const class rxvt_failure_exception &e) { - rxvt_image *image = new_image (); - if (!image->set_file_geometry (str)) - image_vec.pop_back (); - else - changed = true; } } else { str++; - if (image_vec.size () > 0) - changed = image_vec[0].set_geometry (str, true); + if (fimage.set_geometry (str, true)) + changed = true; } if (changed) @@ -3519,7 +3510,8 @@ { int x, y; get_window_origin (x, y); - bg_set_position (x, y); + parent_x = x; + parent_y = y; } update_background (); }