… | |
… | |
633 | return XftColorAllocValue (screen->xdisp, screen->visual, screen->cmap, &d, &c); |
633 | return XftColorAllocValue (screen->xdisp, screen->visual, screen->cmap, &d, &c); |
634 | } |
634 | } |
635 | |
635 | |
636 | return false; |
636 | return false; |
637 | #else |
637 | #else |
638 | XColor xc; |
638 | if (screen->visual->c_class == TrueColor) |
639 | |
|
|
640 | xc.red = rgba.r; |
|
|
641 | xc.green = rgba.g; |
|
|
642 | xc.blue = rgba.b; |
|
|
643 | xc.flags = DoRed | DoGreen | DoBlue; |
|
|
644 | |
|
|
645 | if (XAllocColor (screen->xdisp, screen->cmap, &xc)) |
|
|
646 | { |
639 | { |
647 | p = xc.pixel; |
640 | p = (rgba.r * (screen->visual->red_mask >> ctz (screen->visual->red_mask )) |
|
|
641 | / rxvt_rgba::MAX_CC) << ctz (screen->visual->red_mask ) |
|
|
642 | | (rgba.g * (screen->visual->green_mask >> ctz (screen->visual->green_mask)) |
|
|
643 | / rxvt_rgba::MAX_CC) << ctz (screen->visual->green_mask) |
|
|
644 | | (rgba.b * (screen->visual->blue_mask >> ctz (screen->visual->blue_mask )) |
|
|
645 | / rxvt_rgba::MAX_CC) << ctz (screen->visual->blue_mask ); |
|
|
646 | |
648 | return true; |
647 | return true; |
|
|
648 | } |
|
|
649 | else |
|
|
650 | { |
|
|
651 | XColor xc; |
|
|
652 | |
|
|
653 | xc.red = rgba.r; |
|
|
654 | xc.green = rgba.g; |
|
|
655 | xc.blue = rgba.b; |
|
|
656 | xc.flags = DoRed | DoGreen | DoBlue; |
|
|
657 | |
|
|
658 | if (XAllocColor (screen->xdisp, screen->cmap, &xc)) |
|
|
659 | { |
|
|
660 | p = xc.pixel; |
|
|
661 | return true; |
|
|
662 | } |
649 | } |
663 | } |
650 | |
664 | |
651 | return false; |
665 | return false; |
652 | #endif |
666 | #endif |
653 | } |
667 | } |