--- rxvt-unicode/src/command.C 2012/06/04 15:18:52 1.514 +++ rxvt-unicode/src/command.C 2012/12/30 20:28:31 1.531 @@ -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) @@ -151,7 +151,7 @@ if (t != NOCHAR || !x) { - iso14755_51 (l.t[x], l.r[x], x, y); + iso14755_51 (l.t[x], l.r[x], x, y, view_start); iso14755buf = ISO_14755_54; break; } @@ -161,7 +161,7 @@ } void ecb_cold -rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) +rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y, int y2) { rxvt_fontset *fs = FONTSET (r); wchar_t *chr, *alloc, ch2, **fname; @@ -184,6 +184,9 @@ len = 1; } + char rowcol[40]; + snprintf (rowcol, sizeof rowcol, "col %d row %d @%d", x, y, y2); + char attr[80]; // plenty sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s", @@ -205,7 +208,6 @@ max_it (width, wcswidth (fname[i], wcslen (fname[i]))); } - max_it (width, 8+5); // for char + hex max_it (width, strlen (attr)); if (y >= 0) @@ -214,7 +216,9 @@ x = 0; } - scr_overlay_new (x, y, width, len * 2 + 1); + scr_overlay_new (x, y, width, len * 2 + 2); + + scr_overlay_set (0, 0, rowcol); r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); @@ -225,16 +229,16 @@ ch = *chr++; sprintf (buf, "%8x", ch); - scr_overlay_set (0, y, buf); - scr_overlay_set (9, y, '='); + scr_overlay_set (0, y + 1, buf); + scr_overlay_set (9, y + 1, '='); # if !UNICODE_3 if (ch >= 0x10000) ch = 0xfffd; # endif - scr_overlay_set (11, y, ch, r); + scr_overlay_set (11, y + 1, ch, r); if (WCWIDTH (ch) >= 2) - scr_overlay_set (12, y, NOCHAR, r); + scr_overlay_set (12, y + 1, NOCHAR, r); } // { @@ -242,10 +246,10 @@ // snprintf (buf, sizeof (buf), "(%.4d|%.4d)", x, y); // scr_overlay_set (0, 0, buf); // } - scr_overlay_set (0, len , attr); + scr_overlay_set (0, len + 1, attr); for (int i = 0; i < len; i++) { - scr_overlay_set (0, len + 1 + i, fname[i]); + scr_overlay_set (0, len + 2 + i, fname[i]); free (fname[i]); } @@ -939,7 +943,7 @@ { flush_ev.stop (); -#ifdef HAVE_BG_PIXMAP +#ifdef HAVE_IMG if (bg_flags & BG_NEEDS_REFRESH) { bg_flags &= ~BG_NEEDS_REFRESH; @@ -1463,11 +1467,22 @@ while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) ; -#ifdef HAVE_BG_PIXMAP + 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; + if (bg_img == 0) + moved = true; + } +#endif + + if (want_position_change) + { int x, y; + if (ev.xconfigure.send_event) { x = ev.xconfigure.x; @@ -1476,11 +1491,14 @@ else get_window_origin (x, y); - if (bg_set_position (x, y) - || !(bg_flags & BG_IS_VALID)) - moved = true; + if (x != parent_x || y != parent_y) + { + parent_x = x; + parent_y = y; + HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END)); + moved = true; + } } -#endif if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) { @@ -1513,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; @@ -1822,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) { @@ -1832,7 +1845,6 @@ && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) return; -# if ENABLE_TRANSPARENCY switch (ev.type) { case PropertyNotify: @@ -1843,13 +1855,20 @@ if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) { - bg_set_root_pixmap (); - update_background (); +#if BG_IMAGE_FROM_ROOT + if (option (Opt_transparent)) + { + bg_set_root_pixmap (); + update_background (); + } +#endif +#if ENABLE_PERL + HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END)); +#endif } break; } -# endif refresh_check (); } @@ -2368,6 +2387,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 } @@ -3432,7 +3453,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); { @@ -3453,15 +3475,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, @@ -3474,22 +3491,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) @@ -3498,7 +3513,8 @@ { int x, y; get_window_origin (x, y); - bg_set_position (x, y); + parent_x = x; + parent_y = y; } update_background (); }