ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvttoolkit.C
(Generate patch)

Comparing rxvt-unicode/src/rxvttoolkit.C (file contents):
Revision 1.88 by root, Wed Jan 23 09:14:58 2008 UTC vs.
Revision 1.102 by root, Tue Nov 4 11:03:29 2008 UTC

59#if ENABLE_EWMH 59#if ENABLE_EWMH
60 "_NET_WM_PID", 60 "_NET_WM_PID",
61 "_NET_WM_NAME", 61 "_NET_WM_NAME",
62 "_NET_WM_ICON_NAME", 62 "_NET_WM_ICON_NAME",
63 "_NET_WM_PING", 63 "_NET_WM_PING",
64 "_NET_WM_ICON",
64#endif 65#endif
65#if USE_XIM 66#if USE_XIM
66 "WM_LOCALE_NAME", 67 "WM_LOCALE_NAME",
67 "XIM_SERVERS", 68 "XIM_SERVERS",
68#endif 69#endif
543} 544}
544#endif 545#endif
545 546
546void rxvt_display::x_cb (ev::io &w, int revents) 547void rxvt_display::x_cb (ev::io &w, int revents)
547{ 548{
549 flush_ev.start ();
550}
551
552void rxvt_display::flush_cb (ev::prepare &w, int revents)
553{
548 while (XEventsQueued (dpy, QueuedAfterReading)) 554 while (XEventsQueued (dpy, QueuedAfterFlush))
555 do
549 { 556 {
550 XEvent xev; 557 XEvent xev;
551 XNextEvent (dpy, &xev); 558 XNextEvent (dpy, &xev);
552 559
553#ifdef USE_XIM 560#ifdef USE_XIM
554 if (!XFilterEvent (&xev, None)) 561 if (!XFilterEvent (&xev, None))
555 { 562 {
556 if (xev.type == PropertyNotify 563 if (xev.type == PropertyNotify
557 && xev.xany.window == root 564 && xev.xany.window == root
558 && xev.xproperty.atom == xa[XA_XIM_SERVERS]) 565 && xev.xproperty.atom == xa[XA_XIM_SERVERS])
559 im_change_check (); 566 im_change_check ();
560#endif 567#endif
561 if (xev.type == MappingNotify) 568 if (xev.type == MappingNotify)
562 XRefreshKeyboardMapping (&xev.xmapping); 569 XRefreshKeyboardMapping (&xev.xmapping);
563 570
564 for (int i = xw.size (); i--; ) 571 for (int i = xw.size (); i--; )
565 { 572 {
566 if (!xw[i]) 573 if (!xw[i])
567 xw.erase_unordered (i); 574 xw.erase_unordered (i);
568 else if (xw[i]->window == xev.xany.window) 575 else if (xw[i]->window == xev.xany.window)
569 xw[i]->call (xev); 576 xw[i]->call (xev);
570 } 577 }
571#ifdef USE_XIM 578#ifdef USE_XIM
572 } 579 }
573#endif 580#endif
574 } 581 }
575} 582 while (XEventsQueued (dpy, QueuedAlready));
576 583
577void rxvt_display::flush_cb (ev::prepare &w, int revents)
578{
579 w.stop (); 584 w.stop ();
580 XFlush (dpy);
581} 585}
582 586
583void rxvt_display::reg (xevent_watcher *w) 587void rxvt_display::reg (xevent_watcher *w)
584{ 588{
585 if (!w->active) 589 if (!w->active)
673} 677}
674 678
675bool 679bool
676rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 680rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
677{ 681{
678 //TODO: only supports 24 bit truecolour 682 //TODO: only supports 24 bit
679 int alpha = color.a >= 0xff00 ? 0xffff : color.a; 683 int alpha = color.a >= 0xff00 ? 0xffff : color.a;
680 684
681#if XFT 685#if XFT
682 XRenderPictFormat *format; 686 XRenderPictFormat *format;
683 687
740{ 744{
741 rgba c; 745 rgba c;
742 char eos; 746 char eos;
743 int skip; 747 int skip;
744 748
749 c.a = rgba::MAX_CC;
750
745 // parse the nonstandard "[alphapercent]" prefix 751 // parse the nonstandard "[alphapercent]" prefix
746 if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) 752 if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip))
747 { 753 {
748 c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); 754 c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a);
749 name += skip; 755 name += skip;
750 } 756 }
751 else
752 c.a = rgba::MAX_CC;
753 757
754 // parse the non-standard "#aarrggbb" format
755 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))
756 {
757 c.r <<= 8;
758 c.g <<= 8;
759 c.b <<= 8;
760 c.a <<= 8;
761 }
762 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format 758 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format
763 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)) 759 if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos))
764 { 760 {
765 XColor xc; 761 XColor xc;
766 762
767 if (XParseColor (screen->dpy, screen->cmap, name, &xc)) 763 if (XParseColor (screen->dpy, screen->cmap, name, &xc))
768 { 764 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines