… | |
… | |
148 | } |
148 | } |
149 | #endif |
149 | #endif |
150 | |
150 | |
151 | rxvt_term::rxvt_term () |
151 | rxvt_term::rxvt_term () |
152 | : |
152 | : |
153 | #if TRANSPARENT || ENABLE_PERL |
153 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
154 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
154 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
|
|
155 | #endif |
|
|
156 | #if ENABLE_TRANSPARENCY |
|
|
157 | check_our_parents_ev(this, &rxvt_term::check_our_parents_cb), |
155 | #endif |
158 | #endif |
156 | #ifdef HAVE_SCROLLBARS |
159 | #ifdef HAVE_SCROLLBARS |
157 | scrollbar_ev (this, &rxvt_term::x_cb), |
160 | scrollbar_ev (this, &rxvt_term::x_cb), |
158 | #endif |
161 | #endif |
159 | #ifdef CURSOR_BLINK |
162 | #ifdef CURSOR_BLINK |
… | |
… | |
307 | { |
310 | { |
308 | HOOK_INVOKE ((this, HOOK_CHILD_EXIT, DT_INT, status, DT_END)); |
311 | HOOK_INVOKE ((this, HOOK_CHILD_EXIT, DT_INT, status, DT_END)); |
309 | |
312 | |
310 | cmd_pid = 0; |
313 | cmd_pid = 0; |
311 | |
314 | |
312 | if (!OPTION (Opt_hold)) |
315 | if (!option (Opt_hold)) |
313 | destroy (); |
316 | destroy (); |
314 | } |
317 | } |
315 | |
318 | |
316 | void |
319 | void |
317 | rxvt_term::destroy () |
320 | rxvt_term::destroy () |
… | |
… | |
331 | im_ev.stop (display); |
334 | im_ev.stop (display); |
332 | #endif |
335 | #endif |
333 | #if HAVE_SCROLLBARS |
336 | #if HAVE_SCROLLBARS |
334 | scrollbar_ev.stop (display); |
337 | scrollbar_ev.stop (display); |
335 | #endif |
338 | #endif |
336 | #if TRANSPARENT || ENABLE_PERL |
339 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
337 | rootwin_ev.stop (display); |
340 | rootwin_ev.stop (display); |
338 | #endif |
341 | #endif |
339 | incr_ev.stop (); |
342 | incr_ev.stop (); |
340 | termwin_ev.stop (display); |
343 | termwin_ev.stop (display); |
341 | vt_ev.stop (display); |
344 | vt_ev.stop (display); |
… | |
… | |
481 | #ifdef KEYSYM_RESOURCE |
484 | #ifdef KEYSYM_RESOURCE |
482 | keyboard->register_done (); |
485 | keyboard->register_done (); |
483 | #endif |
486 | #endif |
484 | |
487 | |
485 | #ifdef HAVE_SCROLLBARS |
488 | #ifdef HAVE_SCROLLBARS |
486 | if (OPTION (Opt_scrollBar)) |
489 | if (option (Opt_scrollBar)) |
487 | scrollBar.setIdle (); /* set existence for size calculations */ |
490 | scrollBar.setIdle (); /* set existence for size calculations */ |
488 | #endif |
491 | #endif |
489 | |
492 | |
490 | pty = ptytty::create (); |
493 | pty = ptytty::create (); |
491 | |
494 | |
… | |
… | |
498 | #if 0 |
501 | #if 0 |
499 | XSynchronize (dpy, True); |
502 | XSynchronize (dpy, True); |
500 | #endif |
503 | #endif |
501 | |
504 | |
502 | #ifdef HAVE_SCROLLBARS |
505 | #ifdef HAVE_SCROLLBARS |
503 | if (OPTION (Opt_scrollBar)) |
506 | if (option (Opt_scrollBar)) |
504 | resize_scrollbar (); /* create and map scrollbar */ |
507 | resize_scrollbar (); /* create and map scrollbar */ |
505 | #endif |
508 | #endif |
|
|
509 | #ifdef HAVE_BG_PIXMAP |
|
|
510 | { |
|
|
511 | bool changed = false; |
|
|
512 | bgPixmap.set_target (this); |
|
|
513 | |
506 | #ifdef TRANSPARENT |
514 | #ifdef ENABLE_TRANSPARENCY |
507 | if (OPTION (Opt_transparent)) |
515 | if (option (Opt_transparent)) |
508 | { |
516 | { |
|
|
517 | bgPixmap.set_transparent (); |
|
|
518 | #ifdef HAVE_AFTERIMAGE |
|
|
519 | if (rs [Rs_blurradius]) |
|
|
520 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
|
|
521 | #endif |
|
|
522 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
523 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
524 | if (rs [Rs_shade]) |
|
|
525 | bgPixmap.set_shade (rs [Rs_shade]); |
|
|
526 | changed = true; |
|
|
527 | |
|
|
528 | bgPixmap.set_root_pixmap (); |
509 | XSelectInput (dpy, display->root, PropertyChangeMask); |
529 | XSelectInput (dpy, display->root, PropertyChangeMask); |
510 | check_our_parents (); |
|
|
511 | rootwin_ev.start (display, display->root); |
530 | rootwin_ev.start (display, display->root); |
512 | } |
531 | } |
513 | #endif |
532 | #endif |
|
|
533 | |
|
|
534 | #ifdef XPM_BACKGROUND |
|
|
535 | if (rs[Rs_backgroundPixmap] != NULL) |
|
|
536 | { |
|
|
537 | const char *p = rs[Rs_backgroundPixmap]; |
|
|
538 | |
|
|
539 | if ((p = strchr (p, ';')) != NULL) |
|
|
540 | { |
|
|
541 | p++; |
|
|
542 | bgPixmap.set_geometry (p); |
|
|
543 | } |
|
|
544 | else |
|
|
545 | bgPixmap.set_defaultGeometry (); |
|
|
546 | |
|
|
547 | changed = bgPixmap.set_file (rs[Rs_backgroundPixmap]); |
|
|
548 | } |
|
|
549 | #endif |
|
|
550 | if (changed) |
|
|
551 | { |
|
|
552 | bgPixmap.render (); |
|
|
553 | scr_touch (true); |
|
|
554 | } |
|
|
555 | } |
|
|
556 | #endif |
|
|
557 | |
514 | #if ENABLE_PERL |
558 | #if ENABLE_PERL |
515 | rootwin_ev.start (display, display->root); |
559 | rootwin_ev.start (display, display->root); |
516 | #endif |
560 | #endif |
517 | |
561 | |
518 | set_colorfgbg (); |
562 | set_colorfgbg (); |
… | |
… | |
627 | return p; |
671 | return p; |
628 | } |
672 | } |
629 | |
673 | |
630 | /*----------------------------------------------------------------------*/ |
674 | /*----------------------------------------------------------------------*/ |
631 | /* |
675 | /* |
632 | * window size/position calculcations for XSizeHint and other storage. |
676 | * window size/position calculations for XSizeHint and other storage. |
633 | * if width/height are non-zero then override calculated width/height |
677 | * if width/height are non-zero then override calculated width/height |
634 | */ |
678 | */ |
635 | void |
679 | void |
636 | rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) |
680 | rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) |
637 | { |
681 | { |
… | |
… | |
709 | if (scrollBar.state) |
753 | if (scrollBar.state) |
710 | { |
754 | { |
711 | sb_w = scrollbar_TotalWidth (); |
755 | sb_w = scrollbar_TotalWidth (); |
712 | szHint.base_width += sb_w; |
756 | szHint.base_width += sb_w; |
713 | |
757 | |
714 | if (!OPTION (Opt_scrollBar_right)) |
758 | if (!option (Opt_scrollBar_right)) |
715 | window_vt_x += sb_w; |
759 | window_vt_x += sb_w; |
716 | } |
760 | } |
717 | |
761 | |
718 | szHint.width_inc = fwidth; |
762 | szHint.width_inc = fwidth; |
719 | szHint.height_inc = fheight; |
763 | szHint.height_inc = fheight; |
… | |
… | |
740 | { |
784 | { |
741 | min_it (height, max_height); |
785 | min_it (height, max_height); |
742 | szHint.height = szHint.base_height + height; |
786 | szHint.height = szHint.base_height + height; |
743 | } |
787 | } |
744 | |
788 | |
745 | if (scrollBar.state && OPTION (Opt_scrollBar_right)) |
789 | if (scrollBar.state && option (Opt_scrollBar_right)) |
746 | window_sb_x = szHint.width - sb_w; |
790 | window_sb_x = szHint.width - sb_w; |
747 | |
791 | |
748 | if (recalc_x) |
792 | if (recalc_x) |
749 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
793 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
750 | |
794 | |
… | |
… | |
812 | delete fontset[0]; |
856 | delete fontset[0]; |
813 | fontset[0] = fs; |
857 | fontset[0] = fs; |
814 | |
858 | |
815 | prop = (*fs)[1]->properties (); |
859 | prop = (*fs)[1]->properties (); |
816 | prop.height += lineSpace; |
860 | prop.height += lineSpace; |
|
|
861 | |
817 | fs->set_prop (prop); |
862 | fs->set_prop (prop, false); |
818 | |
863 | |
819 | fwidth = prop.width; |
864 | fwidth = prop.width; |
820 | fheight = prop.height; |
865 | fheight = prop.height; |
821 | fbase = prop.ascent; |
866 | fbase = prop.ascent; |
822 | |
867 | |
… | |
… | |
831 | { |
876 | { |
832 | fontset[style] = fs = new rxvt_fontset (this); |
877 | fontset[style] = fs = new rxvt_fontset (this); |
833 | rxvt_fontprop prop2 = prop; |
878 | rxvt_fontprop prop2 = prop; |
834 | |
879 | |
835 | if (res) |
880 | if (res) |
836 | prop2.weight = prop2.slant = rxvt_fontprop::unset; |
881 | { |
|
|
882 | fs->populate (res); |
|
|
883 | fs->set_prop (prop2, false); |
|
|
884 | } |
837 | else |
885 | else |
838 | { |
886 | { |
839 | res = fontset[0]->fontdesc; |
887 | fs->populate (fontset[0]->fontdesc); |
840 | |
888 | |
841 | if (SET_STYLE (0, style) & RS_Bold) prop2.weight = rxvt_fontprop::bold; |
889 | if (SET_STYLE (0, style) & RS_Bold) prop2.weight = rxvt_fontprop::bold; |
842 | if (SET_STYLE (0, style) & RS_Italic) prop2.slant = rxvt_fontprop::italic; |
890 | if (SET_STYLE (0, style) & RS_Italic) prop2.slant = rxvt_fontprop::italic; |
|
|
891 | |
|
|
892 | fs->set_prop (prop2, true); |
843 | } |
893 | } |
844 | |
894 | |
845 | fs->populate (res); |
|
|
846 | fs->set_prop (prop2); |
|
|
847 | } |
895 | } |
848 | #else |
896 | #else |
849 | fontset[style] = fontset[0]; |
897 | fontset[style] = fontset[0]; |
850 | #endif |
898 | #endif |
851 | } |
899 | } |
… | |
… | |
1101 | |
1149 | |
1102 | XMoveResizeWindow (dpy, vt, |
1150 | XMoveResizeWindow (dpy, vt, |
1103 | window_vt_x, window_vt_y, |
1151 | window_vt_x, window_vt_y, |
1104 | width, height); |
1152 | width, height); |
1105 | |
1153 | |
|
|
1154 | #ifdef XPM_BACKGROUND |
|
|
1155 | /* TODO: replace with update_pixmap() that should unify transparency and bg image handling ! */ |
|
|
1156 | if (bgPixmap.window_size_sensitive ()) |
|
|
1157 | bgPixmap.render (); |
|
|
1158 | #endif |
|
|
1159 | |
1106 | scr_clear (); |
1160 | scr_clear (); |
1107 | #ifdef XPM_BACKGROUND |
|
|
1108 | resize_pixmap (); |
|
|
1109 | #endif |
|
|
1110 | } |
1161 | } |
1111 | |
1162 | |
1112 | if (fix_screen || old_height == 0) |
1163 | if (fix_screen || old_height == 0) |
1113 | scr_reset (); |
1164 | scr_reset (); |
1114 | |
1165 | |
1115 | // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version |
1166 | // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version |
1116 | //scr_touch (false); |
1167 | //scr_touch (false); |
1117 | |
1168 | |
1118 | #ifdef XPM_BACKGROUND |
1169 | #ifdef HAVE_BG_PIXMAP |
1119 | if (pixmap) |
1170 | // TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ? |
|
|
1171 | // if (bgPixmap.pixmap) |
1120 | scr_touch (false); |
1172 | // scr_touch (false); |
1121 | #endif |
1173 | #endif |
1122 | |
1174 | |
1123 | #ifdef USE_XIM |
1175 | #ifdef USE_XIM |
1124 | IMSetPosition (); |
1176 | IMSetPosition (); |
1125 | #endif |
1177 | #endif |