… | |
… | |
299 | if (!(display = displays.get (rs[Rs_display_name]))) |
299 | if (!(display = displays.get (rs[Rs_display_name]))) |
300 | rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); |
300 | rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); |
301 | |
301 | |
302 | xa = display->xa; |
302 | xa = display->xa; |
303 | |
303 | |
304 | #if ENABLE_FRILLS |
304 | #if XFT |
305 | if (rs[Rs_depth]) |
305 | if (rs[Rs_depth]) |
306 | set (display, strtol (rs[Rs_depth], 0, 0)); |
306 | set (display, strtol (rs[Rs_depth], 0, 0)); |
307 | else |
307 | else |
308 | #endif |
308 | #endif |
309 | set (display); |
309 | set (display); |
… | |
… | |
655 | pix_colors = pix_colors_focused; |
655 | pix_colors = pix_colors_focused; |
656 | #endif |
656 | #endif |
657 | |
657 | |
658 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
658 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
659 | { |
659 | { |
|
|
660 | const char *name = rs[Rs_color + i]; |
|
|
661 | |
|
|
662 | if (!name) |
|
|
663 | continue; |
|
|
664 | |
660 | rxvt_color xcol; |
665 | rxvt_color xcol; |
661 | |
666 | |
662 | if (!rs[Rs_color + i]) |
|
|
663 | continue; |
|
|
664 | |
|
|
665 | if (!set_color (xcol, rs[Rs_color + i])) |
667 | if (!set_color (xcol, name)) |
666 | { |
668 | { |
667 | #ifndef XTERM_REVERSE_VIDEO |
669 | #ifndef XTERM_REVERSE_VIDEO |
668 | if (i < 2 && OPTION (Opt_reverseVideo)) |
670 | if (i < 2 && OPTION (Opt_reverseVideo)) |
669 | rs[Rs_color + i] = def_colorName[!i]; |
671 | name = def_colorName [1 - i]; |
670 | else |
672 | else |
671 | #endif |
673 | #endif |
672 | rs[Rs_color + i] = def_colorName[i]; |
674 | name = def_colorName [i]; |
673 | |
675 | |
674 | if (!rs[Rs_color + i]) |
676 | if (!name) |
675 | continue; |
677 | continue; |
676 | |
678 | |
677 | if (!set_color (xcol, rs[Rs_color + i])) |
679 | if (!set_color (xcol, name)) |
678 | { |
680 | { |
679 | switch (i) |
681 | switch (i) |
680 | { |
682 | { |
681 | case Color_fg: |
683 | case Color_fg: |
682 | case Color_bg: |
684 | case Color_bg: |
683 | /* fatal: need bg/fg color */ |
|
|
684 | rxvt_warn ("unable to get foreground/background colour, continuing.\n"); |
685 | rxvt_warn ("unable to get foreground/background colour, continuing.\n"); |
|
|
686 | name = ""; |
685 | break; |
687 | break; |
686 | #ifndef NO_CURSORCOLOR |
688 | #ifndef NO_CURSORCOLOR |
687 | case Color_cursor2: |
689 | case Color_cursor2: |
688 | xcol = pix_colors[Color_fg]; |
690 | #endif |
689 | break; |
|
|
690 | #endif /* ! NO_CURSORCOLOR */ |
|
|
691 | case Color_pointer_fg: |
691 | case Color_pointer_fg: |
|
|
692 | name = rs[Rs_color + Color_fg]; |
692 | xcol = pix_colors[Color_fg]; |
693 | xcol = pix_colors[Color_fg]; |
693 | break; |
694 | break; |
694 | default: |
695 | default: |
|
|
696 | name = rs[Rs_color + Color_bg]; |
695 | xcol = pix_colors[Color_bg]; /* None */ |
697 | xcol = pix_colors[Color_bg]; |
696 | break; |
698 | break; |
697 | } |
699 | } |
698 | } |
700 | } |
699 | } |
701 | } |
700 | |
702 | |
701 | pix_colors[i] = xcol; |
703 | pix_colors[i] = xcol; |
702 | SET_PIXCOLOR (i); |
704 | rs[Rs_color + i] = name; |
703 | } |
705 | } |
704 | |
706 | |
705 | #ifdef OFF_FOCUS_FADING |
707 | #ifdef OFF_FOCUS_FADING |
706 | if (rs[Rs_fade]) |
708 | if (rs[Rs_fade]) |
707 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
709 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
|
|
710 | { |
|
|
711 | rgba c; |
|
|
712 | pix_colors[Color_fade].get (this, c); |
708 | pix_colors_unfocused[i] = pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); |
713 | pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c); |
|
|
714 | } |
709 | #endif |
715 | #endif |
710 | |
716 | |
711 | if (depth <= 2) |
717 | if (depth <= 2) |
712 | { |
718 | { |
713 | if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; |
719 | if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; |
… | |
… | |
736 | /* xcol[0] == white |
742 | /* xcol[0] == white |
737 | * xcol[1] == top shadow |
743 | * xcol[1] == top shadow |
738 | * xcol[2] == bot shadow */ |
744 | * xcol[2] == bot shadow */ |
739 | |
745 | |
740 | xcol[1] = pix_colors[Color_scroll]; |
746 | xcol[1] = pix_colors[Color_scroll]; |
741 | xcol[0].set (this, rxvt_rgba (rxvt_rgba::MAX_CC, rxvt_rgba::MAX_CC, rxvt_rgba::MAX_CC)); |
747 | xcol[0].set (this, rgba (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC)); |
742 | |
748 | |
743 | rxvt_rgba c0, c1; |
749 | rgba c0, c1; |
744 | |
750 | |
745 | xcol[0].get (this, c0); |
751 | xcol[0].get (this, c0); |
746 | xcol[1].get (this, c1); |
752 | xcol[1].get (this, c1); |
747 | |
753 | |
748 | pix_colors[Color_bottomShadow] = xcol[1].fade (this, 50); |
754 | xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]); |
749 | |
755 | |
750 | /* topShadowColor */ |
756 | /* topShadowColor */ |
751 | if (!xcol[1].set (this, |
757 | if (!xcol[1].set (this, |
752 | rxvt_rgba ( |
758 | rgba ( |
753 | min (c0.r, max (c1.r / 5, c1.r) * 7 / 5), |
759 | min (c0.r, max (c1.r / 5, c1.r) * 7 / 5), |
754 | min (c0.g, max (c1.g / 5, c1.g) * 7 / 5), |
760 | min (c0.g, max (c1.g / 5, c1.g) * 7 / 5), |
755 | min (c0.b, max (c1.b / 5, c1.b) * 7 / 5), |
761 | min (c0.b, max (c1.b / 5, c1.b) * 7 / 5), |
756 | c1.a) // pa1 vs. pa0: arbitrary |
762 | c1.a) // pa1 vs. pa0: arbitrary |
757 | )); |
763 | )); |