--- rxvt-unicode/src/command.C 2007/06/09 09:05:38 1.325 +++ rxvt-unicode/src/command.C 2007/10/15 14:56:06 1.359 @@ -97,7 +97,6 @@ XK_Shift_Lock, 0x21eb, XK_ISO_Lock, 0x21eb, - XK_ISO_Lock, 0x21eb, XK_Caps_Lock, 0x21ec, XK_Num_Lock, 0x21ed, XK_ISO_Level3_Shift, 0x21ee, @@ -521,7 +520,7 @@ } else { -# if ENABLE_OVERLAY +# if ISO_14755 scr_overlay_off (); # endif iso14755buf = 0; @@ -532,13 +531,13 @@ if (!(iso14755buf & ISO_14755_STARTED)) { iso14755buf |= ISO_14755_STARTED; -# if ENABLE_OVERLAY +# if ISO_14755 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); scr_overlay_set (0, 0, "ISO 14755 mode"); # endif } #endif - + #ifdef PRINTPIPE if (keysym == XK_Print) { @@ -550,6 +549,7 @@ if (keysym >= 0xFF00 && keysym <= 0xFFFF) { { + bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; newlen = 1; switch (keysym) { @@ -562,14 +562,14 @@ kbuf[1] = '\0'; } else - strcpy (kbuf, key_backspace); + strcpy (kbuf, rs[Rs_backspace_key]); break; #endif #ifndef NO_DELETE_KEY -# ifdef XK_KP_Prior +# ifdef XK_KP_Delete case XK_KP_Delete: /* allow shift to override */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033On"); break; @@ -577,7 +577,7 @@ /* FALLTHROUGH */ # endif case XK_Delete: - strcpy (kbuf, key_delete); + strcpy (kbuf, rs[Rs_delete_key]); break; #endif case XK_Tab: @@ -602,7 +602,7 @@ case XK_KP_Down: /* \033Or or standard */ case XK_KP_Right: /* \033Ov or standard */ case XK_KP_Left: /* \033Ot or standard */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033OZ"); kbuf[2] = "txvr"[keysym - XK_KP_Left]; @@ -635,7 +635,7 @@ # ifdef XK_KP_Prior case XK_KP_Prior: /* allow shift to override */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033Oy"); break; @@ -648,7 +648,7 @@ # ifdef XK_KP_Next case XK_KP_Next: /* allow shift to override */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033Os"); break; @@ -661,7 +661,7 @@ #endif case XK_KP_Enter: /* allow shift to override */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033OM"); break; @@ -714,7 +714,7 @@ case XK_KP_8: /* "\033Ox" : "8" */ case XK_KP_9: /* "\033Oy" : "9" */ /* allow shift to override */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033Oj"); kbuf[2] += (keysym - XK_KP_Multiply); @@ -730,10 +730,10 @@ strcpy (kbuf, "\033[1~"); break; -#ifdef XK_KP_End +#ifdef XK_KP_Insert case XK_KP_Insert: /* allow shift to override */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033Op"); break; @@ -756,7 +756,7 @@ #ifdef XK_KP_End case XK_KP_End: /* allow shift to override */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033Oq"); break; @@ -769,7 +769,7 @@ #ifdef XK_KP_Home case XK_KP_Home: /* allow shift to override */ - if ((priv_modes & PrivMode_aplKP) ? !shft : shft) + if (kp) { strcpy (kbuf, "\033Ow"); break; @@ -936,7 +936,7 @@ if (iso14755buf) if (iso14755buf & ISO_14755_52) { -# if ENABLE_OVERLAY +# if ISO_14755 scr_overlay_off (); # endif # if ISO_14755 @@ -969,7 +969,7 @@ } else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) { -# if ENABLE_OVERLAY +# if ISO_14755 scr_overlay_off (); # endif if (iso14755buf & ISO_14755_51) @@ -1036,12 +1036,11 @@ rxvt_term::flush () { flush_ev.stop (); - -#ifdef TRANSPARENT - if (want_full_refresh) + +#ifdef HAVE_BG_PIXMAP + if (bgPixmap.check_clearChanged ()) { - want_full_refresh = 0; - scr_clear (); +// scr_clear (true); This needs to be researched further! scr_touch (false); } #endif @@ -1112,7 +1111,6 @@ { make_current (); - refresh_limit = 1; refresh_count = 0; flush (); } @@ -1188,7 +1186,7 @@ static struct event_handler { check_watcher yield_ev; - + void yield_cb (check_watcher &w) { // this should really be sched_yield(), but the linux guys thought @@ -1245,7 +1243,7 @@ if (!option (Opt_hold)) destroy (); } - + return false; } @@ -1306,9 +1304,8 @@ int button_number, key_state = 0; int x, y; - x = ev.x; - y = ev.y; - pixel_position (&x, &y); + x = Pixel2Col (ev.x); + y = Pixel2Row (ev.y); if (MEvent.button == AnyButton) button_number = 3; @@ -1438,10 +1435,6 @@ } break; - case MappingNotify: - XRefreshKeyboardMapping (&ev.xmapping); - break; - /* * XXX: this is not the _current_ arrangement * Here's my conclusion: @@ -1482,6 +1475,9 @@ break; case ConfigureNotify: + /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", + ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, + szHint.width, szHint.height); */ if (ev.xconfigure.window == parent[0]) { while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) @@ -1491,21 +1487,15 @@ { seen_resize = 1; resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); -#ifdef XPM_BACKGROUND - if (!option(Opt_transparent) && bgPixmap.auto_resize) - { - resize_pixmap (); - scr_touch (true); - } + } + else + { +#ifdef HAVE_BG_PIXMAP + if (bgPixmap.window_position_sensitive ()) + update_background (); #endif } - HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); - -#ifdef TRANSPARENT - if (option (Opt_transparent)) - check_our_parents (); -#endif } break; @@ -1546,27 +1536,24 @@ HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); break; -#ifdef TRANSPARENT - case ReparentNotify: - rootwin_cb (ev); - break; -#endif /* TRANSPARENT */ - case GraphicsExpose: case Expose: if (ev.xany.window == vt) { do - scr_expose (ev.xexpose.x, ev.xexpose.y, - ev.xexpose.width, ev.xexpose.height, False); + { + scr_expose (ev.xexpose.x, ev.xexpose.y, + ev.xexpose.width, ev.xexpose.height, False); + } while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) - scr_expose (ev.xexpose.x, ev.xexpose.y, - ev.xexpose.width, ev.xexpose.height, False); - + { + scr_expose (ev.xexpose.x, ev.xexpose.y, + ev.xexpose.width, ev.xexpose.height, False); + } want_refresh = 1; } else @@ -1583,11 +1570,6 @@ scrollBar.setIdle (); scrollbar_show (0); } - -#ifdef TRANSPARENT - if (am_transparent && ev.xany.window == parent[0]) - XClearWindow (dpy, ev.xany.window); -#endif } break; @@ -1695,7 +1677,6 @@ scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, scrollbar_size ()); want_refresh = 1; - refresh_limit = 0; scrollbar_show (1); } break; @@ -1760,13 +1741,10 @@ #if ENABLE_FRILLS if (option (Opt_urgentOnBell)) { - XWMHints *h; - - h = XGetWMHints(dpy, parent[0]); - if (h != NULL) + if (XWMHints *h = XGetWMHints(dpy, parent[0])) { h->flags &= ~XUrgencyHint; - XSetWMHints(dpy, parent[0], h); + XSetWMHints (dpy, parent[0], h); } } #endif @@ -1787,7 +1765,7 @@ if (iso14755buf) { iso14755buf = 0; -# if ENABLE_OVERLAY +# if ISO_14755 scr_overlay_off (); # endif } @@ -1824,7 +1802,7 @@ #endif } -#if TRANSPARENT || ENABLE_PERL +#if ENABLE_TRANSPARENCY || ENABLE_PERL void rxvt_term::rootwin_cb (XEvent &ev) { @@ -1834,7 +1812,7 @@ && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) return; -# if TRANSPARENT +# if ENABLE_TRANSPARENCY switch (ev.type) { case PropertyNotify: @@ -1842,14 +1820,12 @@ * if user used some Esetroot compatible prog to set the root bg, * use the property to determine the pixmap. We use it later on. */ - if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] - && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) - return; - - /* FALLTHROUGH */ - case ReparentNotify: - if (option (Opt_transparent)) - check_our_parents (); + if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] + || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) + { + bgPixmap.set_root_pixmap (); + update_background (); + } break; } # endif @@ -2236,624 +2212,6 @@ } } -#ifdef TRANSPARENT -#if TINTING && !defined(HAVE_AFTERIMAGE) -/* taken from aterm-0.4.2 */ - -typedef uint32_t RUINT32T; - -void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) -{ - int sh_r, sh_g, sh_b; - RUINT32T mask_r, mask_g, mask_b; - RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; - unsigned int lower_lim_r, lower_lim_g, lower_lim_b; - unsigned int upper_lim_r, upper_lim_g, upper_lim_b; - int i; - - Visual *visual = term->visual; - - if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; - - /* for convenience */ - mask_r = visual->red_mask; - mask_g = visual->green_mask; - mask_b = visual->blue_mask; - - /* boring lookup table pre-initialization */ - switch (srcImage->bits_per_pixel) { - case 15: - if ((mask_r != 0x7c00) || - (mask_g != 0x03e0) || - (mask_b != 0x001f)) - return; - lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); - lookup_r = lookup; - lookup_g = lookup+32; - lookup_b = lookup+32+32; - sh_r = 10; - sh_g = 5; - sh_b = 0; - break; - case 16: - if ((mask_r != 0xf800) || - (mask_g != 0x07e0) || - (mask_b != 0x001f)) - return; - lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); - lookup_r = lookup; - lookup_g = lookup+32; - lookup_b = lookup+32+64; - sh_r = 11; - sh_g = 5; - sh_b = 0; - break; - case 24: - if ((mask_r != 0xff0000) || - (mask_g != 0x00ff00) || - (mask_b != 0x0000ff)) - return; - lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); - lookup_r = lookup; - lookup_g = lookup+256; - lookup_b = lookup+256+256; - sh_r = 16; - sh_g = 8; - sh_b = 0; - break; - case 32: - if ((mask_r != 0xff0000) || - (mask_g != 0x00ff00) || - (mask_b != 0x0000ff)) - return; - lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); - lookup_r = lookup; - lookup_g = lookup+256; - lookup_b = lookup+256+256; - sh_r = 16; - sh_g = 8; - sh_b = 0; - break; - default: - return; /* we do not support this color depth */ - } - - /* prepare limits for color transformation (each channel is handled separately) */ - if (shade < 0) { - shade = -shade; - if (shade < 0) shade = 0; - if (shade > 100) shade = 100; - - lower_lim_r = 65535-rm; - lower_lim_g = 65535-gm; - lower_lim_b = 65535-bm; - - lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); - lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); - lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); - - upper_lim_r = upper_lim_g = upper_lim_b = 65535; - } else { - if (shade < 0) shade = 0; - if (shade > 100) shade = 100; - - lower_lim_r = lower_lim_g = lower_lim_b = 0; - - upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); - upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); - upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); - } - - /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ - if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) - { - unsigned int tmp; - - tmp = lower_lim_r; - lower_lim_r = lower_lim_b; - lower_lim_b = tmp; - - tmp = upper_lim_r; - upper_lim_r = upper_lim_b; - upper_lim_b = tmp; - } - - /* fill our lookup tables */ - for (i = 0; i <= mask_r>>sh_r; i++) - { - RUINT32T tmp; - tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); - tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); - lookup_r[i] = (tmp/65535)<>sh_g; i++) - { - RUINT32T tmp; - tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); - tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); - lookup_g[i] = (tmp/65535)<>sh_b; i++) - { - RUINT32T tmp; - tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); - tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); - lookup_b[i] = (tmp/65535)<bits_per_pixel) - { - case 15: - { - unsigned short *p1, *pf, *p, *pl; - p1 = (unsigned short *) srcImage->data; - pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); - while (p1 < pf) - { - p = p1; - pl = p1 + srcImage->width; - for (; p < pl; p++) - { - *p = lookup_r[(*p & 0x7c00)>>10] | - lookup_g[(*p & 0x03e0)>> 5] | - lookup_b[(*p & 0x001f)]; - } - p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); - } - break; - } - case 16: - { - unsigned short *p1, *pf, *p, *pl; - p1 = (unsigned short *) srcImage->data; - pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); - while (p1 < pf) - { - p = p1; - pl = p1 + srcImage->width; - for (; p < pl; p++) - { - *p = lookup_r[(*p & 0xf800)>>11] | - lookup_g[(*p & 0x07e0)>> 5] | - lookup_b[(*p & 0x001f)]; - } - p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); - } - break; - } - case 24: - { - unsigned char *p1, *pf, *p, *pl; - p1 = (unsigned char *) srcImage->data; - pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); - while (p1 < pf) - { - p = p1; - pl = p1 + srcImage->width * 3; - for (; p < pl; p += 3) - { - p[0] = lookup_r[(p[0] & 0xff0000)>>16]; - p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; - p[2] = lookup_r[(p[2] & 0x0000ff)]; - } - p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); - } - break; - } - case 32: - { - RUINT32T *p1, *pf, *p, *pl; - p1 = (RUINT32T *) srcImage->data; - pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); - - while (p1 < pf) - { - p = p1; - pl = p1 + srcImage->width; - for (; p < pl; p++) - { - *p = lookup_r[(*p & 0xff0000)>>16] | - lookup_g[(*p & 0x00ff00)>> 8] | - lookup_b[(*p & 0x0000ff)] | - (*p & ~0xffffff); - } - p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); - } - break; - } - } - - free (lookup); -} -#endif - -/* - * Check our parents are still who we think they are. - * Do transparency updates if required - */ -int -rxvt_term::check_our_parents () -{ -#if TRANSPARENT || ENABLE_PERL - check_our_aprents_ev.stop(); - check_our_aprents_ev.start(NOW + 1./3.); -#endif - return 0; -} - -void -rxvt_term::check_our_parents_cb (time_watcher &w) -{ - int i, pchanged, aformat, have_pixmap, rootdepth; - unsigned long nitems, bytes_after; - Atom atype; - unsigned char *prop = NULL; - Window root, oldp, *list; - Pixmap rootpixmap = None; - XWindowAttributes wattr, wrootattr; - int sx, sy; - Window cr; - - pchanged = 0; - - if (!option (Opt_transparent)) - return /*pchanged*/; /* Don't try any more */ - - XGetWindowAttributes (dpy, display->root, &wrootattr); - rootdepth = wrootattr.depth; - - XGetWindowAttributes (dpy, parent[0], &wattr); - - if (rootdepth != wattr.depth) - { - if (am_transparent) - { - pchanged = 1; - XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); - am_transparent = am_pixmap_trans = 0; - } - - return /*pchanged*/; /* Don't try any more */ - } - - /* Get all X ops out of the queue so that our information is up-to-date. */ - XSync (dpy, False); - - XTranslateCoordinates (dpy, parent[0], display->root, - 0, 0, &sx, &sy, &cr); - - /* check if we are outside of the visible part of the virtual screen : */ - if( sx + (int)szHint.width <= 0 || sy + (int)szHint.height <= 0 - || sx >= wrootattr.width || sy >= wrootattr.height ) - return /* 0 */ ; - /* - * Make the frame window set by the window manager have - * the root background. Some window managers put multiple nested frame - * windows for each client, so we have to take care about that. - */ - i = (xa[XA_XROOTPMAP_ID] - && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], - 0L, 1L, False, XA_PIXMAP, &atype, &aformat, - &nitems, &bytes_after, &prop) == Success); - - if (!i || prop == NULL) - i = (xa[XA_ESETROOT_PMAP_ID] - && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], - 0L, 1L, False, XA_PIXMAP, &atype, &aformat, - &nitems, &bytes_after, &prop) == Success); - - if (!i || prop == NULL -#if TINTING - || (!ISSET_PIXCOLOR (Color_tint) && rs[Rs_shade] == NULL -#ifdef HAVE_AFTERIMAGE - && original_asim == NULL && rs[Rs_blurradius] == NULL -#endif - ) -#endif - ) - have_pixmap = 0; - else - { - have_pixmap = 1; - rootpixmap = *(Pixmap *)prop; - XFree (prop); - } - - if (have_pixmap) - { - Bool success = False ; - GC gc; - XGCValues gcvalue; -#ifdef HAVE_AFTERIMAGE - { - Pixmap tmp_pmap = None ; - ShadingInfo shade; - ARGB32 tint ; - unsigned int pmap_w = 0, pmap_h = 0; - - if (get_drawable_size( rootpixmap, &pmap_w, &pmap_h )) - { - int root_x = 0, root_y = 0; - - shade.shading = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; - if (ISSET_PIXCOLOR (Color_tint)) - { - rgba c; - pix_colors_focused [Color_tint].get (c); - shade.tintColor.red = c.r; - shade.tintColor.green = c.g; - shade.tintColor.blue = c.b; - } - else - shade.tintColor.red = shade.tintColor.green = shade.tintColor.blue = 0xFFFF; - tint = shading2tint32( &shade ); - gc = XCreateGC (dpy, vt, 0UL, &gcvalue); - if (GetWinPosition (parent[0], &root_x, &root_y) ) - { - ASImageLayer *layers = create_image_layers( 2 ); - ASImage *merged_im = NULL; - int back_x, back_y, back_w, back_h; - /* merge_layers does good job at tiling background appropriately, - so all we need is to cut out smallest possible piece : */ -#define MAKE_ROOTPMAP_GEOM(xy,wh,widthheight) \ - do{ while( root_##xy < 0 ) root_##xy += (int)wrootattr.widthheight; \ - back_##xy = root_##xy % pmap_##wh; /* that gives us left side of the closest tile : */ \ - if( pmap_##wh >= back_##xy + szHint.widthheight ) \ - back_##wh = szHint.widthheight;/* background is large - limit it by our size */ \ - else \ - { /* small background - need the whole of it for successfull tiling :*/ \ - back_##xy = 0; \ - back_##wh = pmap_##wh; \ - }}while(0) - - MAKE_ROOTPMAP_GEOM(x,w,width); - MAKE_ROOTPMAP_GEOM(y,h,height); - - layers[0].im = pixmap2asimage (display->asv, rootpixmap, back_x, back_y, back_w, back_h, AllPlanes, ASA_ASImage, 100); - layers[0].clip_x = (back_w == pmap_w)?root_x:0; - layers[0].clip_y = (back_h == pmap_h)?root_y:0; - layers[0].clip_width = szHint.width; - layers[0].clip_height = szHint.height; - layers[0].tint = tint; - if (rs[Rs_blurradius] && layers[0].im) - { - double r = atof(rs[Rs_blurradius]); - ASImage* tmp = blur_asimage_gauss(display->asv, layers[0].im, r, r, 0xFFFFFFFF, ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT ); - if( tmp ) - { - destroy_asimage( &layers[0].im ); - layers[0].im = tmp; - } - } - if (original_asim != NULL) - { - int fore_w, fore_h; - layers[1].im = original_asim; - if( bgPixmap.auto_resize ) - { - fore_w = szHint.width; - fore_h = szHint.height; - } - else - { - fore_w = bgPixmap.w; - fore_h = bgPixmap.h; - } - if (fore_w != original_asim->width - || fore_h != original_asim->height) - { - layers[1].im = scale_asimage( display->asv, - original_asim, - fore_w, fore_h, - ASA_ASImage, 100, - ASIMAGE_QUALITY_DEFAULT ); - } - - layers[1].clip_width = szHint.width; - layers[1].clip_height = szHint.height; - - if (rs[Rs_blendtype]) - { - layers[1].merge_scanlines = blend_scanlines_name2func(rs[Rs_blendtype]); - if( layers[1].merge_scanlines == NULL ) - layers[1].merge_scanlines = alphablend_scanlines; - } - } - merged_im = merge_layers( display->asv, layers, layers[1].im?2:1, - szHint.width, szHint.height, - ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT ); - if (layers[1].im != original_asim) - destroy_asimage( &(layers[1].im) ); - destroy_asimage( &(layers[0].im) ); - if (merged_im != NULL) - { - tmp_pmap = asimage2pixmap( display->asv, DefaultRootWindow(dpy), merged_im, gc, True ); - destroy_asimage( &merged_im ); - } - free( layers ); - } - } - if (tmp_pmap != None) - { - success = True; - if (pixmap != None) - XFreePixmap (dpy, pixmap); - pixmap = tmp_pmap; - } - } -#else /* HAVE_AFTERIMAGE */ - { - /* - * Copy display->root pixmap transparency - */ - int nx, ny; - unsigned int nw, nh; - XImage *image; - - nw = (unsigned int)szHint.width; - nh = (unsigned int)szHint.height; - nx = ny = 0; - - if (sx < 0) - { - nw += sx; - nx = -sx; - sx = 0; - } - - if (sy < 0) - { - nh += sy; - ny = -sy; - sy = 0; - } - - min_it (nw, (unsigned int) (wrootattr.width - sx)); - min_it (nh, (unsigned int) (wrootattr.height - sy)); - - XSync (dpy, False); - allowedxerror = -1; - image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); - - /* XXX: handle BadMatch - usually because we're outside the pixmap */ - /* XXX: may need a delay here? */ - allowedxerror = 0; - if (image != NULL) - { - if (pixmap != None) - XFreePixmap (dpy, pixmap); - -#if TINTING - if (ISSET_PIXCOLOR (Color_tint)) - { - int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; - - rgba c; - pix_colors_focused [Color_tint].get (c); - ShadeXImage (this, image, shade, c.r, c.g, c.b); - } -#endif - - pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); - gc = XCreateGC (dpy, vt, 0UL, &gcvalue); - XPutImage (dpy, pixmap, gc, image, 0, 0, - nx, ny, image->width, image->height); - XDestroyImage (image); - success = True ; - } - } -#endif /* HAVE_AFTERIMAGE */ - if (gc != NULL) - XFreeGC (dpy, gc); - - if (!success) - { - if (am_transparent && am_pixmap_trans) - { - pchanged = 1; - if (pixmap != None) - { - XFreePixmap (dpy, pixmap); - pixmap = None; - } - } - - am_pixmap_trans = 0; - } - else - { - XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); - XClearWindow (dpy, parent[0]); - - if (!am_transparent || !am_pixmap_trans) - pchanged = 1; - - am_transparent = am_pixmap_trans = 1; - } - } - - if (am_pixmap_trans) - XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); - else - { - unsigned int n; - /* - * InheritPixmap transparency - */ - for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) - { - oldp = parent[i]; - XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); - XFree (list); - - if (parent[i] == display->root) - { - if (oldp != None) - pchanged = 1; - - break; - } - - if (oldp != parent[i]) - pchanged = 1; - } - - n = 0; - - if (pchanged) - for (; n < (unsigned int)i; n++) - { - XGetWindowAttributes (dpy, parent[n], &wattr); - - if (wattr.depth != rootdepth || wattr.c_class == InputOnly) - { - n = (int) (sizeof (parent) / sizeof (Window)) + 1; - break; - } - } - - if (n > (sizeof (parent) / sizeof (parent[0]))) - { - XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); - XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); - am_transparent = 0; - /* XXX: also turn off Opt_transparent? */ - } - else - { - for (n = 0; n < (unsigned int)i; n++) - { - XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); - XClearWindow (dpy, parent[n]); - } - - XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); - am_transparent = 1; - } - - for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) - parent[i] = None; - } - - if (scrollBar.win) - { - XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); - scrollBar.setIdle (); - scrollbar_show (0); - } - - if (am_transparent) - { - want_refresh = want_full_refresh = 1; - if (am_pixmap_trans) - flush (); - } - -// return pchanged; -} -#endif - /*}}} */ bool @@ -2911,13 +2269,16 @@ refresh_count++; - if (!option (Opt_jumpScroll) - || (refresh_count >= refresh_limit * (nrow - 1))) + if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) { - refreshnow = true; refresh_count = 0; - ch = NOCHAR; - break; + + if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) + { + refreshnow = true; + ch = NOCHAR; + break; + } } // scr_add_lines only works for nlines <= nrow - 1. @@ -2955,21 +2316,14 @@ /* * If there have been a lot of new lines, then update the screen - * What the heck I'll cheat and only refresh less than every page-full. - * the number of pages between refreshes is refresh_limit, which - * is incremented here because we must be doing flat-out scrolling. + * What the heck we'll cheat and only refresh less than every page-full. + * if skipScroll is enabled. */ if (refreshnow) { - if (option (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) - refresh_limit++; - else - { - flag = true; - //TODO: due to popular request, implement "skipscroll" option here - scr_refresh (); - want_refresh = 1; - } + flag = true; + scr_refresh (); + want_refresh = 1; } } @@ -3128,7 +2482,7 @@ break; /* done = 1 */ } } - + for (i = 0; i < len; i++) if (putc (buf[i], fd) == EOF) { @@ -3200,7 +2554,7 @@ case 0x9b: /* CSI */ process_csi_seq (); break; - case 0x9d: /* CSI */ + case 0x9d: /* OSC */ process_osc_seq (); break; #endif @@ -3436,10 +2790,9 @@ unicode_t ch, priv, i; unsigned int nargs, p; int n, ndef; - int arg[ESC_ARGS]; + int arg[ESC_ARGS] = { }; - for (nargs = ESC_ARGS; nargs > 0;) - arg[--nargs] = 0; + nargs = 0; priv = 0; ch = cmd_getc (); @@ -3493,7 +2846,7 @@ case '>': if (ch == CSI_DA) /* secondary device attributes */ { - // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, + // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, // 'U' for rxvt-unicode != 7.[34] (where it was broken). // // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt @@ -3956,7 +3309,7 @@ dLocal (Display *, dpy); assert (str != NULL); - + if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) return; @@ -4061,53 +3414,59 @@ process_color_seq (op, Color_IT, str, resp); break; #endif -#if TRANSPARENT && TINTING +#if ENABLE_TRANSPARENCY case URxvt_Color_tint: process_color_seq (op, Color_tint, str, resp); - - check_our_parents (); - - if (am_transparent) - want_full_refresh = want_refresh = 1; + { + bool changed = false; + if (ISSET_PIXCOLOR (Color_tint)) + changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); + else + changed = bgPixmap.unset_tint (); + if (changed) + update_background (); + } break; #endif +#if BG_IMAGE_FROM_FILE case Rxvt_Pixmap: - { - if (*str != ';') - { -#if XPM_BACKGROUND - scale_pixmap (""); /* reset to default scaling */ - set_bgPixmap (str); /* change pixmap */ - scr_touch (true); -#endif - } - - int changed = 0; + if (!strcmp (str, "?")) + { + char str[256]; - while ((str = strchr (str, ';')) != NULL) - { - str++; -#if XPM_BACKGROUND - changed += scale_pixmap (str); -#endif - } + sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ + min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), + min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); + process_xterm_seq (XTerm_title, str, CHAR_ST); + } + else + { + int changed = 0; - if (changed) - { -#ifdef XPM_BACKGROUND - resize_pixmap (); - scr_touch (true); -#endif - } -#if TRANSPARENT && defined(HAVE_AFTERIMAGE) - if (option(Opt_transparent)) - check_our_parents (); -#endif - - } + if (*str != ';') + { + /* reset to default scaling :*/ + bgPixmap.unset_geometry (); + if (bgPixmap.set_file (str)) /* change pixmap */ + changed++; + str = strchr (str, ';'); + if (str == NULL) + bgPixmap.set_defaultGeometry (); + } + while (str) + { + str++; + if (bgPixmap.set_geometry (str)) + changed++; + str = strchr (str, ';'); + } + if (changed) + update_background (); + } break; +#endif case Rxvt_restoreFG: set_window_color (Color_fg, str); @@ -4239,12 +3598,10 @@ int state; static const struct - { - const int argval; - const unsigned long bit; - } - - argtopriv[] = { + { + const int argval; + const unsigned long bit; + } argtopriv[] = { { 1, PrivMode_aplCUR }, { 2, PrivMode_vt52 }, { 3, PrivMode_132 }, @@ -4646,7 +4003,6 @@ { free (v_buffer); v_buffer = 0; - v_buflen = 0; pty_ev.set (EVENT_READ); return;