--- rxvt-unicode/src/rxvttoolkit.C 2007/12/14 06:17:27 1.84 +++ rxvt-unicode/src/rxvttoolkit.C 2008/01/26 12:12:38 1.96 @@ -503,6 +503,7 @@ XFreeCursor (dpy, blank_cursor); #endif x_ev.stop (); + flush_ev.stop (); #ifdef USE_XIM xims.clear (); #endif @@ -551,12 +552,13 @@ #ifdef USE_XIM if (!XFilterEvent (&xev, None)) +#endif { if (xev.type == PropertyNotify && xev.xany.window == root && xev.xproperty.atom == xa[XA_XIM_SERVERS]) im_change_check (); -#endif + if (xev.type == MappingNotify) XRefreshKeyboardMapping (&xev.xmapping); @@ -567,16 +569,20 @@ else if (xw[i]->window == xev.xany.window) xw[i]->call (xev); } -#ifdef USE_XIM } -#endif } } void rxvt_display::flush_cb (ev::prepare &w, int revents) { - w.stop (); XFlush (dpy); + if (XEventsQueued (dpy, QueuedAfterReading)) + x_cb(x_ev,0);//D + XFlush (dpy); + if (XEventsQueued (dpy, QueuedAfterReading)) + x_cb(x_ev,0);//D + XFlush (dpy); + w.stop (); } void rxvt_display::reg (xevent_watcher *w) @@ -600,7 +606,12 @@ void rxvt_display::set_selection_owner (rxvt_term *owner) { if (selection_owner && selection_owner != owner) - selection_owner->selection_clear (); + { + rxvt_term *owner = selection_owner; + + owner->selection_clear (); + owner->flush (); + } selection_owner = owner; } @@ -669,6 +680,9 @@ bool rxvt_color::alloc (rxvt_screen *screen, const rgba &color) { + //TODO: only supports 24 bit + int alpha = color.a >= 0xff00 ? 0xffff : color.a; + #if XFT XRenderPictFormat *format; @@ -682,12 +696,12 @@ c.color.red = color.r; c.color.green = color.g; c.color.blue = color.b; - c.color.alpha = color.a; + c.color.alpha = alpha; c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) | insert_component (color.g, format->direct.greenMask, format->direct.green) | insert_component (color.b, format->direct.blueMask , format->direct.blue ) - | insert_component (color.a, format->direct.alphaMask, format->direct.alpha); + | insert_component (alpha , format->direct.alphaMask, format->direct.alpha); return true; } @@ -698,7 +712,7 @@ d.red = color.r; d.green = color.g; d.blue = color.b; - d.alpha = color.a; + d.alpha = alpha; return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); } @@ -733,29 +747,17 @@ char eos; int skip; + c.a = rgba::MAX_CC; + // parse the nonstandard "[alphapercent]" prefix if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) { c.a = lerp (0, rgba::MAX_CC, c.a); name += skip; } - else - c.a = rgba::MAX_CC; - // parse the non-standard "#aarrggbb" format - if (name[0] == '#' && strlen (name) == 1+2+2+2+2 && 4 == sscanf (name+1, "%2hx%2hx%2hx%2hx%c", &c.a, &c.r, &c.g, &c.b, &eos)) - { - if (c.r) - c.r = (c.r << 8) | 0x0ff; - if (c.g) - c.g = (c.g << 8) | 0x0ff; - if (c.b) - c.b = (c.b << 8) | 0x0ff; - if (c.a) - c.a = (c.a << 8) | 0x0ff; - } // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format - else if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) + if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) { XColor xc;