… | |
… | |
297 | get_options (r_argc, r_argv); |
297 | get_options (r_argc, r_argv); |
298 | |
298 | |
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 | // using a local pointer decreases code size a lot |
302 | xa = display->xa; |
303 | xa = display->xa; |
303 | |
304 | |
304 | #if XFT |
305 | #if XFT |
305 | if (rs[Rs_depth]) |
306 | if (rs[Rs_depth]) |
306 | set (display, strtol (rs[Rs_depth], 0, 0)); |
307 | set (display, strtol (rs[Rs_depth], 0, 0)); |
… | |
… | |
309 | set (display); |
310 | set (display); |
310 | |
311 | |
311 | extract_resources (); |
312 | extract_resources (); |
312 | |
313 | |
313 | free (r_argv); |
314 | free (r_argv); |
|
|
315 | |
|
|
316 | for (int i = NUM_RESOURCES; i--; ) |
|
|
317 | if (rs [i] == resval_undef) |
|
|
318 | rs [i] = 0; |
314 | |
319 | |
315 | #if ENABLE_PERL |
320 | #if ENABLE_PERL |
316 | if (!rs[Rs_perl_ext_1]) |
321 | if (!rs[Rs_perl_ext_1]) |
317 | rs[Rs_perl_ext_1] = "default"; |
322 | rs[Rs_perl_ext_1] = "default"; |
318 | |
323 | |
… | |
… | |
689 | #ifndef NO_CURSORCOLOR |
694 | #ifndef NO_CURSORCOLOR |
690 | case Color_cursor2: |
695 | case Color_cursor2: |
691 | #endif |
696 | #endif |
692 | case Color_pointer_fg: |
697 | case Color_pointer_fg: |
693 | name = rs[Rs_color + Color_fg]; |
698 | name = rs[Rs_color + Color_fg]; |
694 | xcol = pix_colors[Color_fg]; |
699 | xcol.set (this, name); |
695 | break; |
700 | break; |
696 | default: |
701 | default: |
697 | name = rs[Rs_color + Color_bg]; |
702 | name = rs[Rs_color + Color_bg]; |
698 | xcol = pix_colors[Color_bg]; |
703 | xcol.set (this, name); |
699 | break; |
704 | break; |
700 | } |
705 | } |
701 | } |
706 | } |
702 | } |
707 | } |
703 | |
708 | |
704 | pix_colors[i] = xcol; |
709 | pix_colors[i] = xcol; |
705 | rs[Rs_color + i] = name; |
710 | rs[Rs_color + i] = name; |
706 | } |
711 | } |
707 | |
712 | |
708 | #ifdef OFF_FOCUS_FADING |
|
|
709 | if (rs[Rs_fade]) |
|
|
710 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
|
|
711 | { |
|
|
712 | rgba c; |
|
|
713 | pix_colors[Color_fade].get (this, c); |
|
|
714 | pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c); |
|
|
715 | } |
|
|
716 | #endif |
|
|
717 | |
|
|
718 | if (depth <= 2) |
713 | if (depth <= 2) |
719 | { |
714 | { |
720 | if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; |
715 | if (!rs[Rs_color + Color_pointer_fg]) alias_color (Color_pointer_fg, Color_fg); |
721 | if (!rs[Rs_color + Color_pointer_bg]) pix_colors[Color_pointer_bg] = pix_colors[Color_bg]; |
716 | if (!rs[Rs_color + Color_pointer_bg]) alias_color (Color_pointer_bg, Color_bg); |
722 | if (!rs[Rs_color + Color_border] ) pix_colors[Color_border] = pix_colors[Color_fg]; |
717 | if (!rs[Rs_color + Color_border] ) alias_color (Color_border, Color_fg); |
723 | } |
718 | } |
724 | |
719 | |
725 | /* |
720 | /* |
726 | * get scrollBar shadow colors |
721 | * get scrollBar shadow colors |
727 | * |
722 | * |
728 | * The calculations of topShadow/bottomShadow values are adapted |
723 | * The calculations of topShadow/bottomShadow values are adapted |
729 | * from the fvwm window manager. |
724 | * from the fvwm window manager. |
730 | */ |
725 | */ |
731 | #ifdef KEEP_SCROLLCOLOR |
726 | #ifdef KEEP_SCROLLCOLOR |
732 | |
|
|
733 | if (depth <= 2) |
727 | if (depth <= 2) |
734 | { |
728 | { |
735 | /* Monochrome */ |
729 | /* Monochrome */ |
736 | pix_colors[Color_scroll] = pix_colors[Color_fg]; |
730 | alias_color (Color_scroll, Color_fg); |
737 | pix_colors[Color_topShadow] = pix_colors[Color_bg]; |
731 | alias_color (Color_topShadow, Color_bg); |
738 | pix_colors[Color_bottomShadow] = pix_colors[Color_bg]; |
732 | alias_color (Color_bottomShadow, Color_bg); |
739 | } |
733 | } |
740 | else |
734 | else |
741 | { |
735 | { |
742 | rxvt_color xcol[2]; |
736 | pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]); |
743 | /* xcol[0] == white |
|
|
744 | * xcol[1] == top shadow |
|
|
745 | * xcol[2] == bot shadow */ |
|
|
746 | |
737 | |
747 | xcol[1] = pix_colors[Color_scroll]; |
|
|
748 | xcol[0].set (this, rgba (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC)); |
|
|
749 | |
|
|
750 | rgba c0, c1; |
738 | rgba cscroll; |
751 | |
739 | pix_colors [Color_scroll].get (cscroll); |
752 | xcol[0].get (this, c0); |
|
|
753 | xcol[1].get (this, c1); |
|
|
754 | |
|
|
755 | xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]); |
|
|
756 | |
740 | |
757 | /* topShadowColor */ |
741 | /* topShadowColor */ |
758 | if (!xcol[1].set (this, |
742 | if (!pix_colors[Color_topShadow].set (this, |
759 | rgba ( |
743 | rgba ( |
760 | min (c0.r, max (c1.r / 5, c1.r) * 7 / 5), |
744 | min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5), |
761 | min (c0.g, max (c1.g / 5, c1.g) * 7 / 5), |
745 | min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5), |
762 | min (c0.b, max (c1.b / 5, c1.b) * 7 / 5), |
746 | min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), |
763 | c1.a) // pa1 vs. pa0: arbitrary |
747 | cscroll.a) |
764 | )); |
748 | )) |
765 | xcol[1] = pix_colors[Color_White]; |
749 | alias_color (Color_topShadow, Color_White); |
766 | |
|
|
767 | pix_colors[Color_topShadow] = xcol[1]; |
|
|
768 | } |
750 | } |
769 | #endif /* KEEP_SCROLLCOLOR */ |
751 | #endif /* KEEP_SCROLLCOLOR */ |
|
|
752 | |
|
|
753 | #ifdef OFF_FOCUS_FADING |
|
|
754 | if (rs[Rs_fade]) |
|
|
755 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
|
|
756 | { |
|
|
757 | rgba c; |
|
|
758 | pix_colors [Color_fade].get (c); |
|
|
759 | pix_colors_focused [i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c); |
|
|
760 | } |
|
|
761 | #endif |
770 | } |
762 | } |
771 | |
763 | |
772 | /*----------------------------------------------------------------------*/ |
764 | /*----------------------------------------------------------------------*/ |
773 | /* color aliases, fg/bg bright-bold */ |
765 | /* color aliases, fg/bg bright-bold */ |
774 | void |
766 | void |