… | |
… | |
574 | } |
574 | } |
575 | } |
575 | } |
576 | |
576 | |
577 | void rxvt_display::flush_cb (ev::prepare &w, int revents) |
577 | void rxvt_display::flush_cb (ev::prepare &w, int revents) |
578 | { |
578 | { |
|
|
579 | while (XEventsQueued (dpy, QueuedAfterFlush)) |
|
|
580 | x_cb (x_ev, EV_READ); |
|
|
581 | |
579 | w.stop (); |
582 | w.stop (); |
580 | XFlush (dpy); |
|
|
581 | } |
583 | } |
582 | |
584 | |
583 | void rxvt_display::reg (xevent_watcher *w) |
585 | void rxvt_display::reg (xevent_watcher *w) |
584 | { |
586 | { |
585 | if (!w->active) |
587 | if (!w->active) |
… | |
… | |
673 | } |
675 | } |
674 | |
676 | |
675 | bool |
677 | bool |
676 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
678 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
677 | { |
679 | { |
678 | //TODO: only supports 24 bit truecolour |
680 | //TODO: only supports 24 bit |
679 | int alpha = color.a >= 0xff00 ? 0xffff : color.a; |
681 | int alpha = color.a >= 0xff00 ? 0xffff : color.a; |
680 | |
682 | |
681 | #if XFT |
683 | #if XFT |
682 | XRenderPictFormat *format; |
684 | XRenderPictFormat *format; |
683 | |
685 | |
… | |
… | |
740 | { |
742 | { |
741 | rgba c; |
743 | rgba c; |
742 | char eos; |
744 | char eos; |
743 | int skip; |
745 | int skip; |
744 | |
746 | |
|
|
747 | c.a = rgba::MAX_CC; |
|
|
748 | |
745 | // parse the nonstandard "[alphapercent]" prefix |
749 | // parse the nonstandard "[alphapercent]" prefix |
746 | if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) |
750 | if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) |
747 | { |
751 | { |
748 | c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); |
752 | c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); |
749 | name += skip; |
753 | name += skip; |
750 | } |
754 | } |
751 | else |
|
|
752 | c.a = rgba::MAX_CC; |
|
|
753 | |
755 | |
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 |
756 | // 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)) |
757 | 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 | { |
758 | { |
765 | XColor xc; |
759 | XColor xc; |
766 | |
760 | |
767 | if (XParseColor (screen->dpy, screen->cmap, name, &xc)) |
761 | if (XParseColor (screen->dpy, screen->cmap, name, &xc)) |
768 | { |
762 | { |