--- rxvt-unicode/src/command.C 2016/06/30 14:01:11 1.573 +++ rxvt-unicode/src/command.C 2016/07/14 05:33:26 1.582 @@ -1484,16 +1484,6 @@ 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; @@ -1511,7 +1501,6 @@ parent_x = x; parent_y = y; HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END)); - moved = true; } } @@ -1520,13 +1509,6 @@ seen_resize = 1; resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); } - else - { -#ifdef HAVE_BG_PIXMAP - if (moved) - update_background (); -#endif - } HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); } @@ -1545,17 +1527,6 @@ break; case MapNotify: -#ifdef HAVE_BG_PIXMAP - // 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; #ifdef TEXT_BLINK text_blink_ev.start (); @@ -1860,7 +1831,7 @@ #endif } -#if BG_IMAGE_FROM_ROOT || ENABLE_PERL +#if ENABLE_PERL void ecb_hot rxvt_term::rootwin_cb (XEvent &ev) { @@ -1880,13 +1851,6 @@ if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) { -#if BG_IMAGE_FROM_ROOT - if (option (Opt_transparent)) - { - rxvt_img::new_from_root (this)->replace (root_img); - update_background (); - } -#endif HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END)); } @@ -3352,52 +3316,52 @@ /* * Find the nearest color slot in the hidden color cube, - * adapt its value to the 24bit RGB color. + * adapt its value to the 32bit RGBA color. */ unsigned int -rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b) +rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b, unsigned int a) { r &= 0xff; g &= 0xff; b &= 0xff; + a &= 0xff; - unsigned int color = (r << 16) | (g << 8) | b; - unsigned int idx_r = r / (0xff / (Red_levels - 1)); - unsigned int idx_g = g / (0xff / (Green_levels - 1)); - unsigned int idx_b = b / (0xff / (Blue_levels - 1)); - unsigned int idx = colorcube_index (idx_r, idx_g, idx_b); + uint32_t color = (a << 24) | (r << 16) | (g << 8) | b; - if (rgb24_color[idx] == color) - return idx + minTermCOLOR24; + unsigned int idx_r = r * (Red_levels - 1) / 0xff; + unsigned int idx_g = g * (Green_levels - 1) / 0xff; + unsigned int idx_b = b * (Blue_levels - 1) / 0xff; + unsigned int idx = colorcube_index (idx_r, idx_g, idx_b); /* we allow one of the 6 directly neighbouring colours */ /* to replace the current color, if they not used recently */ static const signed char dxyz[][3] = { 0, 0, 0, - 0, 0, -1, 0, 0, +1, - 0, -1, 0, + 0, 0, -1, 0, +1, 0, - -1, 0, 0, + 0, -1, 0, +1, 0, 0, + -1, 0, 0, }; for (int n = 0; n < ecb_array_length (dxyz); ++n) { - int i = idx_r + dxyz[n][0]; - int j = idx_r + dxyz[n][1]; - int k = idx_r + dxyz[n][2]; - - if (!IN_RANGE_EXC (i, 0, Red_levels)) - continue; + int r = idx_r + dxyz[n][0]; + int g = idx_g + dxyz[n][1]; + int b = idx_b + dxyz[n][2]; + + if (!IN_RANGE_EXC (r, 0, Red_levels )) continue; + if (!IN_RANGE_EXC (g, 0, Green_levels)) continue; + if (!IN_RANGE_EXC (b, 0, Blue_levels )) continue; - if (!IN_RANGE_EXC (j, 0, Green_levels)) - continue; + unsigned int index = colorcube_index (r, g, b); - if (!IN_RANGE_EXC (k, 0, Blue_levels)) - continue; - - unsigned int index = colorcube_index (i, j, k); + if (rgb24_color[index] == color) + { + rgb24_seqno[index] = ++rgb24_sequence; + return index + minTermCOLOR24; + } // minor issue: could update index 0 few more times if ((rgb24_seqno[index] | rgb24_color[index]) == 0) @@ -3406,9 +3370,6 @@ goto update; } - if (rgb24_color[index] == color) - return index + minTermCOLOR24; - // like (rgb24_seqno[idx] > rgb24_seqno[index]) // but also handles wrap around values good enough if ((uint16_t)(rgb24_seqno[idx] - rgb24_seqno[index]) < 0x7fff) @@ -3421,9 +3382,7 @@ idx += minTermCOLOR24; pix_colors_focused [idx].free (this); - pix_colors_focused [idx].set (this, rgba (r * 0x0101, - g * 0x0101, - b * 0x0101)); + pix_colors_focused [idx].set (this, rgba (r * 0x0101, g * 0x0101, b * 0x0101, a * 0x0101)); update_fade_color (idx, false); return idx; @@ -3576,74 +3535,6 @@ process_color_seq (op, Color_border, str, resp); break; -#if BG_IMAGE_FROM_ROOT - case URxvt_Color_tint: - process_color_seq (op, Color_tint, str, resp); - { - bool changed = false; - - if (ISSET_PIXCOLOR (Color_tint)) - changed = root_effects.set_tint (pix_colors_focused [Color_tint]); - - if (changed) - update_background (); - } - - break; -#endif - -#if BG_IMAGE_FROM_FILE - case Rxvt_Pixmap: - if (!strcmp (str, "?")) - { - char str[256]; - 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, - h_align, v_align); - process_xterm_seq (XTerm_title, str, CHAR_ST); - } - else - { - bool changed = false; - - if (*str != ';') - { - try - { - fimage.set_file_geometry (this, str); - changed = true; - } - catch (const class rxvt_failure_exception &e) - { - } - } - else - { - str++; - if (fimage.set_geometry (str, true)) - changed = true; - } - - if (changed) - { - if (bg_window_position_sensitive ()) - { - int x, y; - get_window_origin (x, y); - parent_x = x; - parent_y = y; - } - update_background (); - } - } - break; -#endif - case XTerm_logfile: // TODO, when secure mode? break; @@ -4065,22 +3956,6 @@ case 37: scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg); break; - case 38: // set fg color, ISO 8613-6 - if (nargs > i + 2 && arg[i + 1] == 5) - { - scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); - i += 2; - } - else if (nargs > i + 4 && arg[i + 1] == 2) - { - unsigned int r = arg[i + 2]; - unsigned int g = arg[i + 3]; - unsigned int b = arg[i + 4]; - unsigned int idx = map_rgb24_color (r, g, b); - scr_color (idx, Color_fg); - i += 4; - } - break; case 39: /* default fg */ scr_color (Color_fg, Color_fg); break; @@ -4095,26 +3970,39 @@ case 47: scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg); break; - case 48: // set bg color, ISO 8613-6 - if (nargs > i + 2 && arg[i + 1] == 5) - { - scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); - i += 2; - } - else if (nargs > i + 4 && arg[i + 1] == 2) - { - unsigned int r = arg[i + 2]; - unsigned int g = arg[i + 3]; - unsigned int b = arg[i + 4]; - unsigned int idx = map_rgb24_color (r, g, b); - scr_color (idx, Color_bg); - i += 4; - } - break; case 49: /* default bg */ scr_color (Color_bg, Color_bg); break; + case 38: // set fg color, ISO 8613-6 + case 48: // set bg color, ISO 8613-6 + { + unsigned int fgbg = arg[i] == 38 ? Color_fg : Color_bg; + unsigned int idx; + + if (nargs > i + 2 && arg[i + 1] == 5) + { + idx = minCOLOR + arg[i + 2]; + i += 2; + + scr_color (idx, fgbg); + } + else if (nargs > i + 4 && arg[i + 1] == 2) + { + unsigned int r = arg[i + 2]; + unsigned int g = arg[i + 3]; + unsigned int b = arg[i + 4]; + unsigned int a = 0xff; + + idx = map_rgb24_color (r, g, b, a); + + i += 4; + + scr_color (idx, fgbg); + } + } + break; + //case 50: // not variable spacing #if !ENABLE_MINIMAL