… | |
… | |
172 | slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this); |
172 | slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this); |
173 | #endif |
173 | #endif |
174 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
174 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
175 | rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this), |
175 | rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this), |
176 | #endif |
176 | #endif |
177 | #ifdef HAVE_SCROLLBARS |
|
|
178 | scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this), |
177 | scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this), |
179 | #endif |
|
|
180 | #ifdef USE_XIM |
178 | #ifdef USE_XIM |
181 | im_ev.set <rxvt_term, &rxvt_term::im_cb> (this), |
179 | im_ev.set <rxvt_term, &rxvt_term::im_cb> (this), |
182 | #endif |
180 | #endif |
183 | #ifdef POINTER_BLANK |
181 | #ifdef POINTER_BLANK |
184 | pointer_ev.set <rxvt_term, &rxvt_term::pointer_cb> (this); |
182 | pointer_ev.set <rxvt_term, &rxvt_term::pointer_cb> (this); |
… | |
… | |
229 | delete fontset[0]; |
227 | delete fontset[0]; |
230 | |
228 | |
231 | #ifdef HAVE_BG_PIXMAP |
229 | #ifdef HAVE_BG_PIXMAP |
232 | bgPixmap.destroy (); |
230 | bgPixmap.destroy (); |
233 | #endif |
231 | #endif |
|
|
232 | #ifdef HAVE_AFTERIMAGE |
|
|
233 | if (asv) |
|
|
234 | destroy_asvisual (asv, 0); |
|
|
235 | if (asimman) |
|
|
236 | destroy_image_manager (asimman, 0); |
|
|
237 | #endif |
234 | |
238 | |
235 | if (display) |
239 | if (display) |
236 | { |
240 | { |
237 | selection_clear (); |
241 | selection_clear (); |
238 | |
242 | |
239 | #ifdef USE_XIM |
243 | #ifdef USE_XIM |
240 | im_destroy (); |
244 | im_destroy (); |
241 | #endif |
245 | #endif |
242 | #ifdef XTERM_SCROLLBAR |
246 | scrollBar.destroy (); |
243 | if (xscrollbarGC) XFreeGC (dpy, xscrollbarGC); |
|
|
244 | if (ShadowGC) XFreeGC (dpy, ShadowGC); |
|
|
245 | #endif |
|
|
246 | #ifdef PLAIN_SCROLLBAR |
|
|
247 | if (pscrollbarGC) XFreeGC (dpy, pscrollbarGC); |
|
|
248 | #endif |
|
|
249 | #ifdef NEXT_SCROLLBAR |
|
|
250 | if (blackGC) XFreeGC (dpy, blackGC); |
|
|
251 | if (whiteGC) XFreeGC (dpy, whiteGC); |
|
|
252 | if (grayGC) XFreeGC (dpy, grayGC); |
|
|
253 | if (darkGC) XFreeGC (dpy, darkGC); |
|
|
254 | if (stippleGC) XFreeGC (dpy, stippleGC); |
|
|
255 | if (dimple) XFreePixmap (dpy, dimple); |
|
|
256 | if (upArrow) XFreePixmap (dpy, upArrow); |
|
|
257 | if (downArrow) XFreePixmap (dpy, downArrow); |
|
|
258 | if (upArrowHi) XFreePixmap (dpy, upArrowHi); |
|
|
259 | if (downArrowHi) XFreePixmap (dpy, downArrowHi); |
|
|
260 | #endif |
|
|
261 | #ifdef RXVT_SCROLLBAR |
|
|
262 | if (topShadowGC) XFreeGC (dpy, topShadowGC); |
|
|
263 | if (botShadowGC) XFreeGC (dpy, botShadowGC); |
|
|
264 | if (scrollbarGC) XFreeGC (dpy, scrollbarGC); |
|
|
265 | #endif |
|
|
266 | if (gc) XFreeGC (dpy, gc); |
247 | if (gc) XFreeGC (dpy, gc); |
267 | |
248 | |
268 | delete drawable; |
249 | delete drawable; |
269 | // destroy all windows |
250 | // destroy all windows |
270 | if (parent[0]) |
251 | if (parent[0]) |
… | |
… | |
337 | if (display) |
318 | if (display) |
338 | { |
319 | { |
339 | #if USE_XIM |
320 | #if USE_XIM |
340 | im_ev.stop (display); |
321 | im_ev.stop (display); |
341 | #endif |
322 | #endif |
342 | #if HAVE_SCROLLBARS |
|
|
343 | scrollbar_ev.stop (display); |
323 | scrollbar_ev.stop (display); |
344 | #endif |
|
|
345 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
324 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
346 | rootwin_ev.stop (display); |
325 | rootwin_ev.stop (display); |
347 | #endif |
326 | #endif |
348 | incr_ev.stop (); |
327 | incr_ev.stop (); |
349 | termwin_ev.stop (display); |
328 | termwin_ev.stop (display); |
… | |
… | |
529 | */ |
508 | */ |
530 | void |
509 | void |
531 | rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) |
510 | rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) |
532 | { |
511 | { |
533 | short recalc_x, recalc_y; |
512 | short recalc_x, recalc_y; |
534 | int x, y, sb_w, flags; |
513 | int x, y, flags; |
535 | unsigned int w, h; |
514 | unsigned int w, h; |
536 | unsigned int max_width, max_height; |
515 | unsigned int max_width, max_height; |
537 | |
516 | |
538 | szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; |
517 | szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; |
539 | szHint.win_gravity = NorthWestGravity; |
518 | szHint.win_gravity = NorthWestGravity; |
… | |
… | |
549 | if (rs[Rs_geometry]) |
528 | if (rs[Rs_geometry]) |
550 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
529 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
551 | |
530 | |
552 | if (flags & WidthValue) |
531 | if (flags & WidthValue) |
553 | { |
532 | { |
|
|
533 | if (!w) |
|
|
534 | rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n"); |
|
|
535 | |
554 | ncol = clamp (w, 0, std::numeric_limits<int16_t>::max ()); |
536 | ncol = clamp (w, 1, std::numeric_limits<int16_t>::max ()); |
555 | szHint.flags |= USSize; |
537 | szHint.flags |= USSize; |
556 | } |
538 | } |
557 | |
539 | |
558 | if (flags & HeightValue) |
540 | if (flags & HeightValue) |
559 | { |
541 | { |
|
|
542 | if (!h) |
|
|
543 | rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n"); |
|
|
544 | |
560 | nrow = clamp (h, 0, std::numeric_limits<int16_t>::max ()); |
545 | nrow = clamp (h, 1, std::numeric_limits<int16_t>::max ()); |
561 | szHint.flags |= USSize; |
546 | szHint.flags |= USSize; |
562 | } |
547 | } |
563 | |
548 | |
564 | if (flags & XValue) |
549 | if (flags & XValue) |
565 | { |
550 | { |
… | |
… | |
596 | max_width = MAX_COLS * fwidth; |
581 | max_width = MAX_COLS * fwidth; |
597 | max_height = MAX_ROWS * fheight; |
582 | max_height = MAX_ROWS * fheight; |
598 | |
583 | |
599 | szHint.base_width = szHint.base_height = 2 * int_bwidth; |
584 | szHint.base_width = szHint.base_height = 2 * int_bwidth; |
600 | |
585 | |
601 | sb_w = 0; |
|
|
602 | window_vt_x = window_vt_y = int_bwidth; |
586 | window_vt_x = window_vt_y = int_bwidth; |
603 | |
587 | |
604 | if (scrollBar.state) |
588 | if (scrollBar.state) |
605 | { |
589 | { |
606 | sb_w = scrollbar_TotalWidth (); |
590 | int sb_w = scrollBar.total_width (); |
607 | szHint.base_width += sb_w; |
591 | szHint.base_width += sb_w; |
608 | |
592 | |
609 | if (!option (Opt_scrollBar_right)) |
593 | if (!option (Opt_scrollBar_right)) |
610 | window_vt_x += sb_w; |
594 | window_vt_x += sb_w; |
611 | } |
595 | } |
… | |
… | |
634 | else |
618 | else |
635 | { |
619 | { |
636 | min_it (height, max_height); |
620 | min_it (height, max_height); |
637 | szHint.height = szHint.base_height + height; |
621 | szHint.height = szHint.base_height + height; |
638 | } |
622 | } |
639 | |
|
|
640 | if (scrollBar.state && option (Opt_scrollBar_right)) |
|
|
641 | window_sb_x = szHint.width - sb_w; |
|
|
642 | |
623 | |
643 | if (recalc_x) |
624 | if (recalc_x) |
644 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
625 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
645 | |
626 | |
646 | if (recalc_y) |
627 | if (recalc_y) |
… | |
… | |
805 | void |
786 | void |
806 | rxvt_term::set_window_color (int idx, const char *color) |
787 | rxvt_term::set_window_color (int idx, const char *color) |
807 | { |
788 | { |
808 | #ifdef XTERM_COLOR_CHANGE |
789 | #ifdef XTERM_COLOR_CHANGE |
809 | rxvt_color xcol; |
790 | rxvt_color xcol; |
810 | int i; |
|
|
811 | |
791 | |
812 | if (color == NULL || *color == '\0') |
792 | if (color == NULL || *color == '\0') |
813 | return; |
793 | return; |
814 | |
794 | |
815 | color = strdup (color); |
795 | color = strdup (color); |
… | |
… | |
817 | rs[Rs_color + idx] = color; |
797 | rs[Rs_color + idx] = color; |
818 | |
798 | |
819 | /* handle color aliases */ |
799 | /* handle color aliases */ |
820 | if (isdigit (*color)) |
800 | if (isdigit (*color)) |
821 | { |
801 | { |
822 | i = atoi (color); |
802 | int i = atoi (color); |
823 | |
803 | |
824 | if (i >= 8 && i <= 15) |
804 | if (i >= 8 && i <= 15) |
825 | { |
805 | { |
826 | /* bright colors */ |
806 | /* bright colors */ |
827 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; |
807 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; |
… | |
… | |
987 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
967 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
988 | |
968 | |
989 | if (fix_screen || newwidth != old_width || newheight != old_height) |
969 | if (fix_screen || newwidth != old_width || newheight != old_height) |
990 | { |
970 | { |
991 | if (scrollBar.state) |
971 | if (scrollBar.state) |
992 | { |
972 | scrollBar.resize (); |
993 | XMoveResizeWindow (dpy, scrollBar.win, |
|
|
994 | window_sb_x, 0, |
|
|
995 | scrollbar_TotalWidth (), szHint.height); |
|
|
996 | resize_scrollbar (); |
|
|
997 | } |
|
|
998 | |
973 | |
999 | XMoveResizeWindow (dpy, vt, |
974 | XMoveResizeWindow (dpy, vt, |
1000 | window_vt_x, window_vt_y, |
975 | window_vt_x, window_vt_y, |
1001 | width, height); |
976 | width, height); |
1002 | |
977 | |