… | |
… | |
314 | rxvt_perl.init (this); |
314 | rxvt_perl.init (this); |
315 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
315 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
316 | } |
316 | } |
317 | #endif |
317 | #endif |
318 | |
318 | |
|
|
319 | xa = display->xa; |
|
|
320 | |
|
|
321 | #if ENABLE_FRILLS |
|
|
322 | if (rs[Rs_depth]) |
|
|
323 | set (display, strtol (rs[Rs_depth], 0, 0)); |
|
|
324 | else |
|
|
325 | #endif |
|
|
326 | set (display); |
|
|
327 | |
319 | /* |
328 | /* |
320 | * set any defaults not already set |
329 | * set any defaults not already set |
321 | */ |
330 | */ |
322 | if (cmd_argv && cmd_argv[0]) |
331 | if (cmd_argv && cmd_argv[0]) |
323 | { |
332 | { |
… | |
… | |
503 | |
512 | |
504 | #ifdef RXVT_TERMINFO |
513 | #ifdef RXVT_TERMINFO |
505 | putenv ("TERMINFO=" RXVT_TERMINFO); |
514 | putenv ("TERMINFO=" RXVT_TERMINFO); |
506 | #endif |
515 | #endif |
507 | |
516 | |
508 | if (display->depth <= 2) |
517 | if (depth <= 2) |
509 | putenv ("COLORTERM=" COLORTERMENV "-mono"); |
518 | putenv ("COLORTERM=" COLORTERMENV "-mono"); |
510 | else |
519 | else |
511 | putenv ("COLORTERM=" COLORTERMENVFULL); |
520 | putenv ("COLORTERM=" COLORTERMENVFULL); |
512 | |
521 | |
513 | if (rs[Rs_term_name] != NULL) |
522 | if (rs[Rs_term_name] != NULL) |
… | |
… | |
644 | |
653 | |
645 | #ifdef OFF_FOCUS_FADING |
654 | #ifdef OFF_FOCUS_FADING |
646 | pix_colors = pix_colors_focused; |
655 | pix_colors = pix_colors_focused; |
647 | #endif |
656 | #endif |
648 | |
657 | |
649 | for (i = 0; i < (display->depth <= 2 ? 2 : NRS_COLORS); i++) |
658 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
650 | { |
659 | { |
651 | rxvt_color xcol; |
660 | rxvt_color xcol; |
652 | |
661 | |
653 | if (!rs[Rs_color + i]) |
662 | if (!rs[Rs_color + i]) |
654 | continue; |
663 | continue; |
… | |
… | |
694 | SET_PIXCOLOR (i); |
703 | SET_PIXCOLOR (i); |
695 | } |
704 | } |
696 | |
705 | |
697 | #ifdef OFF_FOCUS_FADING |
706 | #ifdef OFF_FOCUS_FADING |
698 | if (rs[Rs_fade]) |
707 | if (rs[Rs_fade]) |
699 | for (i = 0; i < (display->depth <= 2 ? 2 : NRS_COLORS); i++) |
708 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
700 | pix_colors_unfocused[i] = pix_colors_focused[i].fade (display, atoi (rs[Rs_fade]), pix_colors[Color_fade]); |
709 | pix_colors_unfocused[i] = pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); |
701 | #endif |
710 | #endif |
702 | |
711 | |
703 | if (display->depth <= 2) |
712 | if (depth <= 2) |
704 | { |
713 | { |
705 | if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; |
714 | if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; |
706 | if (!rs[Rs_color + Color_pointer_bg]) pix_colors[Color_pointer_bg] = pix_colors[Color_bg]; |
715 | if (!rs[Rs_color + Color_pointer_bg]) pix_colors[Color_pointer_bg] = pix_colors[Color_bg]; |
707 | if (!rs[Rs_color + Color_border] ) pix_colors[Color_border] = pix_colors[Color_fg]; |
716 | if (!rs[Rs_color + Color_border] ) pix_colors[Color_border] = pix_colors[Color_fg]; |
708 | } |
717 | } |
… | |
… | |
713 | * The calculations of topShadow/bottomShadow values are adapted |
722 | * The calculations of topShadow/bottomShadow values are adapted |
714 | * from the fvwm window manager. |
723 | * from the fvwm window manager. |
715 | */ |
724 | */ |
716 | #ifdef KEEP_SCROLLCOLOR |
725 | #ifdef KEEP_SCROLLCOLOR |
717 | |
726 | |
718 | if (display->depth <= 2) |
727 | if (depth <= 2) |
719 | { |
728 | { |
720 | /* Monochrome */ |
729 | /* Monochrome */ |
721 | pix_colors[Color_scroll] = pix_colors[Color_fg]; |
730 | pix_colors[Color_scroll] = pix_colors[Color_fg]; |
722 | pix_colors[Color_topShadow] = pix_colors[Color_bg]; |
731 | pix_colors[Color_topShadow] = pix_colors[Color_bg]; |
723 | pix_colors[Color_bottomShadow] = pix_colors[Color_bg]; |
732 | pix_colors[Color_bottomShadow] = pix_colors[Color_bg]; |
… | |
… | |
728 | /* xcol[0] == white |
737 | /* xcol[0] == white |
729 | * xcol[1] == top shadow |
738 | * xcol[1] == top shadow |
730 | * xcol[2] == bot shadow */ |
739 | * xcol[2] == bot shadow */ |
731 | |
740 | |
732 | xcol[1] = pix_colors[Color_scroll]; |
741 | xcol[1] = pix_colors[Color_scroll]; |
733 | xcol[0].set (display, 65535, 65535, 65535); |
742 | xcol[0].set (this, 65535, 65535, 65535); |
734 | |
743 | |
735 | unsigned short pr1, pg1, pb1, pr0, pg0, pb0; |
744 | unsigned short pr1, pg1, pb1, pr0, pg0, pb0; |
736 | |
745 | |
737 | xcol[0].get (display, pr0, pg0, pb0); |
746 | xcol[0].get (this, pr0, pg0, pb0); |
738 | xcol[1].get (display, pr1, pg1, pb1); |
747 | xcol[1].get (this, pr1, pg1, pb1); |
739 | |
748 | |
740 | pix_colors[Color_bottomShadow] = xcol[1].fade (display, 50); |
749 | pix_colors[Color_bottomShadow] = xcol[1].fade (this, 50); |
741 | |
750 | |
742 | /* topShadowColor */ |
751 | /* topShadowColor */ |
743 | if (!xcol[1].set (display, |
752 | if (!xcol[1].set (this, |
744 | min (pr0, max (pr0 / 5, pr1) * 7 / 5), |
753 | min (pr0, max (pr0 / 5, pr1) * 7 / 5), |
745 | min (pg0, max (pg0 / 5, pg1) * 7 / 5), |
754 | min (pg0, max (pg0 / 5, pg1) * 7 / 5), |
746 | min (pb0, max (pb0 / 5, pb1) * 7 / 5))) |
755 | min (pb0, max (pb0 / 5, pb1) * 7 / 5))) |
747 | xcol[1] = pix_colors[Color_White]; |
756 | xcol[1] = pix_colors[Color_White]; |
748 | |
757 | |
… | |
… | |
872 | MWMHints mwmhints; |
881 | MWMHints mwmhints; |
873 | #endif |
882 | #endif |
874 | XGCValues gcvalue; |
883 | XGCValues gcvalue; |
875 | XSetWindowAttributes attributes; |
884 | XSetWindowAttributes attributes; |
876 | Window top, parent; |
885 | Window top, parent; |
877 | dDisp; |
|
|
878 | |
886 | |
879 | xa = display->xa; |
887 | dLocal (Display *, xdisp); |
880 | |
888 | |
881 | /* grab colors before netscape does */ |
889 | /* grab colors before netscape does */ |
882 | Get_Colours (); |
890 | Get_Colours (); |
883 | |
891 | |
884 | if (!set_fonts ()) |
892 | if (!set_fonts ()) |
… | |
… | |
889 | attributes.override_redirect = !!OPTION (Opt_override_redirect); |
897 | attributes.override_redirect = !!OPTION (Opt_override_redirect); |
890 | |
898 | |
891 | #if ENABLE_FRILLS |
899 | #if ENABLE_FRILLS |
892 | if (OPTION (Opt_borderLess)) |
900 | if (OPTION (Opt_borderLess)) |
893 | { |
901 | { |
894 | if (XInternAtom (disp, "_MOTIF_WM_INFO", True) == None) |
902 | if (XInternAtom (xdisp, "_MOTIF_WM_INFO", True) == None) |
895 | { |
903 | { |
896 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
904 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
897 | attributes.override_redirect = TRUE; |
905 | attributes.override_redirect = TRUE; |
898 | mwmhints.flags = 0; |
906 | mwmhints.flags = 0; |
899 | } |
907 | } |
… | |
… | |
912 | { |
920 | { |
913 | XWindowAttributes wattr; |
921 | XWindowAttributes wattr; |
914 | |
922 | |
915 | parent = strtol (rs[Rs_embed], 0, 0); |
923 | parent = strtol (rs[Rs_embed], 0, 0); |
916 | |
924 | |
917 | if (!XGetWindowAttributes (disp, parent, &wattr)) |
925 | if (!XGetWindowAttributes (xdisp, parent, &wattr)) |
918 | rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); |
926 | rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); |
919 | |
927 | |
920 | window_calc (wattr.width, wattr.height); |
928 | window_calc (wattr.width, wattr.height); |
921 | } |
929 | } |
922 | #endif |
930 | #endif |
923 | |
931 | |
924 | window_calc (0, 0); |
932 | window_calc (0, 0); |
925 | |
933 | |
926 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
934 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
927 | attributes.background_pixel = pix_colors_focused[Color_border]; |
935 | attributes.background_pixel = pix_colors_focused [Color_border]; |
928 | attributes.border_pixel = pix_colors_focused[Color_border]; |
936 | attributes.border_pixel = pix_colors_focused [Color_border]; |
929 | attributes.colormap = display->cmap; |
937 | attributes.colormap = cmap; |
930 | |
938 | |
931 | top = XCreateWindow (disp, parent, |
939 | top = XCreateWindow (xdisp, parent, |
932 | szHint.x, szHint.y, |
940 | szHint.x, szHint.y, |
933 | szHint.width, szHint.height, |
941 | szHint.width, szHint.height, |
934 | ext_bwidth, |
942 | ext_bwidth, |
935 | display->depth, InputOutput, |
943 | depth, InputOutput, visual, |
936 | display->visual, |
|
|
937 | CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, |
944 | CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, |
938 | &attributes); |
945 | &attributes); |
939 | |
946 | |
940 | this->parent[0] = top; |
947 | this->parent[0] = top; |
941 | |
948 | |
… | |
… | |
951 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
958 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
952 | wmHint.input = True; |
959 | wmHint.input = True; |
953 | wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; |
960 | wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; |
954 | wmHint.window_group = top; |
961 | wmHint.window_group = top; |
955 | |
962 | |
956 | XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, |
963 | XmbSetWMProperties (xdisp, top, NULL, NULL, (char **)argv, argc, |
957 | &szHint, &wmHint, &classHint); |
964 | &szHint, &wmHint, &classHint); |
958 | |
965 | |
959 | #if ENABLE_FRILLS |
966 | #if ENABLE_FRILLS |
960 | if (mwmhints.flags) |
967 | if (mwmhints.flags) |
961 | XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
968 | XChangeProperty (xdisp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
962 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
969 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
963 | #endif |
970 | #endif |
964 | |
971 | |
965 | Atom protocols[] = { |
972 | Atom protocols[] = { |
966 | xa[XA_WM_DELETE_WINDOW], |
973 | xa[XA_WM_DELETE_WINDOW], |
967 | #if ENABLE_EWMH |
974 | #if ENABLE_EWMH |
968 | xa[XA_NET_WM_PING], |
975 | xa[XA_NET_WM_PING], |
969 | #endif |
976 | #endif |
970 | }; |
977 | }; |
971 | |
978 | |
972 | XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0])); |
979 | XSetWMProtocols (xdisp, top, protocols, sizeof (protocols) / sizeof (protocols[0])); |
973 | |
980 | |
974 | #if ENABLE_FRILLS |
981 | #if ENABLE_FRILLS |
975 | if (rs[Rs_transient_for]) |
982 | if (rs[Rs_transient_for]) |
976 | XSetTransientForHint (disp, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); |
983 | XSetTransientForHint (xdisp, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); |
977 | #endif |
984 | #endif |
978 | |
985 | |
979 | #if ENABLE_EWMH |
986 | #if ENABLE_EWMH |
980 | long pid = getpid (); |
987 | long pid = getpid (); |
981 | |
988 | |
982 | XChangeProperty (disp, top, |
989 | XChangeProperty (xdisp, top, |
983 | xa[XA_NET_WM_PID], XA_CARDINAL, 32, |
990 | xa[XA_NET_WM_PID], XA_CARDINAL, 32, |
984 | PropModeReplace, (unsigned char *)&pid, 1); |
991 | PropModeReplace, (unsigned char *)&pid, 1); |
985 | |
992 | |
986 | // _NET_WM_WINDOW_TYPE is NORMAL, which is the default |
993 | // _NET_WM_WINDOW_TYPE is NORMAL, which is the default |
987 | #endif |
994 | #endif |
988 | |
995 | |
989 | XSelectInput (disp, top, |
996 | XSelectInput (xdisp, top, |
990 | KeyPressMask |
997 | KeyPressMask |
991 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755 |
998 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755 |
992 | | KeyReleaseMask |
999 | | KeyReleaseMask |
993 | #endif |
1000 | #endif |
994 | | FocusChangeMask | VisibilityChangeMask |
1001 | | FocusChangeMask | VisibilityChangeMask |
995 | | ExposureMask | StructureNotifyMask); |
1002 | | ExposureMask | StructureNotifyMask); |
996 | |
1003 | |
997 | termwin_ev.start (display, top); |
1004 | termwin_ev.start (display, top); |
998 | |
1005 | |
999 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1006 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1000 | TermWin_cursor = XCreateFontCursor (disp, XC_xterm); |
1007 | TermWin_cursor = XCreateFontCursor (xdisp, XC_xterm); |
1001 | |
1008 | |
1002 | #ifdef HAVE_SCROLLBARS |
1009 | #ifdef HAVE_SCROLLBARS |
1003 | /* cursor scrollBar: Black-on-White */ |
1010 | /* cursor scrollBar: Black-on-White */ |
1004 | leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr); |
1011 | leftptr_cursor = XCreateFontCursor (xdisp, XC_left_ptr); |
1005 | #endif |
1012 | #endif |
1006 | |
1013 | |
1007 | /* the vt window */ |
1014 | /* the vt window */ |
1008 | vt = XCreateSimpleWindow (disp, top, |
1015 | vt = XCreateSimpleWindow (xdisp, top, |
1009 | window_vt_x, window_vt_y, |
1016 | window_vt_x, window_vt_y, |
1010 | width, height, |
1017 | width, height, |
1011 | 0, |
1018 | 0, |
1012 | pix_colors_focused[Color_fg], |
1019 | pix_colors_focused[Color_fg], |
1013 | pix_colors_focused[Color_bg]); |
1020 | pix_colors_focused[Color_bg]); |
1014 | |
1021 | |
1015 | attributes.bit_gravity = NorthWestGravity; |
1022 | attributes.bit_gravity = NorthWestGravity; |
1016 | XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); |
1023 | XChangeWindowAttributes (xdisp, vt, CWBitGravity, &attributes); |
1017 | |
1024 | |
1018 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1025 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1019 | |
1026 | |
1020 | if (OPTION (Opt_pointerBlank)) |
1027 | if (OPTION (Opt_pointerBlank)) |
1021 | vt_emask |= PointerMotionMask; |
1028 | vt_emask |= PointerMotionMask; |
… | |
… | |
1046 | /* graphics context for the vt window */ |
1053 | /* graphics context for the vt window */ |
1047 | gcvalue.foreground = pix_colors[Color_fg]; |
1054 | gcvalue.foreground = pix_colors[Color_fg]; |
1048 | gcvalue.background = pix_colors[Color_bg]; |
1055 | gcvalue.background = pix_colors[Color_bg]; |
1049 | gcvalue.graphics_exposures = 1; |
1056 | gcvalue.graphics_exposures = 1; |
1050 | |
1057 | |
1051 | gc = XCreateGC (disp, vt, |
1058 | gc = XCreateGC (xdisp, vt, |
1052 | GCForeground | GCBackground | GCGraphicsExposures, |
1059 | GCForeground | GCBackground | GCGraphicsExposures, |
1053 | &gcvalue); |
1060 | &gcvalue); |
1054 | |
1061 | |
1055 | drawable = new rxvt_drawable (display, vt); |
1062 | drawable = new rxvt_drawable (this, vt); |
1056 | |
1063 | |
1057 | #ifdef RXVT_SCROLLBAR |
1064 | #ifdef RXVT_SCROLLBAR |
1058 | gcvalue.foreground = pix_colors[Color_topShadow]; |
1065 | gcvalue.foreground = pix_colors[Color_topShadow]; |
1059 | topShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue); |
1066 | topShadowGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); |
1060 | gcvalue.foreground = pix_colors[Color_bottomShadow]; |
1067 | gcvalue.foreground = pix_colors[Color_bottomShadow]; |
1061 | botShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue); |
1068 | botShadowGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); |
1062 | gcvalue.foreground = pix_colors[ (display->depth <= 2 ? Color_fg : Color_scroll)]; |
1069 | gcvalue.foreground = pix_colors[ (depth <= 2 ? Color_fg : Color_scroll)]; |
1063 | scrollbarGC = XCreateGC (disp, vt, GCForeground, &gcvalue); |
1070 | scrollbarGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); |
1064 | #endif |
1071 | #endif |
1065 | |
1072 | |
1066 | #ifdef OFF_FOCUS_FADING |
1073 | #ifdef OFF_FOCUS_FADING |
1067 | // initially we are in unfocused state |
1074 | // initially we are in unfocused state |
1068 | if (rs[Rs_fade]) |
1075 | if (rs[Rs_fade]) |