… | |
… | |
11 | * Copyright (c) 1997 mj olesen <olesen@me.QueensU.CA> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.QueensU.CA> |
12 | * - extensive modifications |
12 | * - extensive modifications |
13 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
13 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
14 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
14 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
15 | * - extensive modifications |
15 | * - extensive modifications |
16 | * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com> |
16 | * Copyright (c) 2003-2008 Marc Lehmann <pcg@goof.com> |
17 | * |
17 | * |
18 | * This program is free software; you can redistribute it and/or modify |
18 | * This program is free software; you can redistribute it and/or modify |
19 | * it under the terms of the GNU General Public License as published by |
19 | * it under the terms of the GNU General Public License as published by |
20 | * the Free Software Foundation; either version 2 of the License, or |
20 | * the Free Software Foundation; either version 2 of the License, or |
21 | * (at your option) any later version. |
21 | * (at your option) any later version. |
… | |
… | |
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); |
… | |
… | |
237 | selection_clear (); |
235 | selection_clear (); |
238 | |
236 | |
239 | #ifdef USE_XIM |
237 | #ifdef USE_XIM |
240 | im_destroy (); |
238 | im_destroy (); |
241 | #endif |
239 | #endif |
242 | #ifdef XTERM_SCROLLBAR |
240 | 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); |
241 | if (gc) XFreeGC (dpy, gc); |
267 | |
242 | |
268 | delete drawable; |
243 | delete drawable; |
269 | // destroy all windows |
244 | // destroy all windows |
270 | if (parent[0]) |
245 | if (parent[0]) |
… | |
… | |
337 | if (display) |
312 | if (display) |
338 | { |
313 | { |
339 | #if USE_XIM |
314 | #if USE_XIM |
340 | im_ev.stop (display); |
315 | im_ev.stop (display); |
341 | #endif |
316 | #endif |
342 | #if HAVE_SCROLLBARS |
|
|
343 | scrollbar_ev.stop (display); |
317 | scrollbar_ev.stop (display); |
344 | #endif |
|
|
345 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
318 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
346 | rootwin_ev.stop (display); |
319 | rootwin_ev.stop (display); |
347 | #endif |
320 | #endif |
348 | incr_ev.stop (); |
321 | incr_ev.stop (); |
349 | termwin_ev.stop (display); |
322 | termwin_ev.stop (display); |
… | |
… | |
529 | */ |
502 | */ |
530 | void |
503 | void |
531 | rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) |
504 | rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) |
532 | { |
505 | { |
533 | short recalc_x, recalc_y; |
506 | short recalc_x, recalc_y; |
534 | int x, y, sb_w, flags; |
507 | int x, y, flags; |
535 | unsigned int w, h; |
508 | unsigned int w, h; |
536 | unsigned int max_width, max_height; |
509 | unsigned int max_width, max_height; |
537 | |
510 | |
538 | szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; |
511 | szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; |
539 | szHint.win_gravity = NorthWestGravity; |
512 | szHint.win_gravity = NorthWestGravity; |
… | |
… | |
549 | if (rs[Rs_geometry]) |
522 | if (rs[Rs_geometry]) |
550 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
523 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
551 | |
524 | |
552 | if (flags & WidthValue) |
525 | if (flags & WidthValue) |
553 | { |
526 | { |
|
|
527 | if (!w) |
|
|
528 | rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n"); |
|
|
529 | |
554 | ncol = clamp (w, 0, std::numeric_limits<int16_t>::max ()); |
530 | ncol = clamp (w, 1, std::numeric_limits<int16_t>::max ()); |
555 | szHint.flags |= USSize; |
531 | szHint.flags |= USSize; |
556 | } |
532 | } |
557 | |
533 | |
558 | if (flags & HeightValue) |
534 | if (flags & HeightValue) |
559 | { |
535 | { |
|
|
536 | if (!h) |
|
|
537 | rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n"); |
|
|
538 | |
560 | nrow = clamp (h, 0, std::numeric_limits<int16_t>::max ()); |
539 | nrow = clamp (h, 1, std::numeric_limits<int16_t>::max ()); |
561 | szHint.flags |= USSize; |
540 | szHint.flags |= USSize; |
562 | } |
541 | } |
563 | |
542 | |
564 | if (flags & XValue) |
543 | if (flags & XValue) |
565 | { |
544 | { |
… | |
… | |
596 | max_width = MAX_COLS * fwidth; |
575 | max_width = MAX_COLS * fwidth; |
597 | max_height = MAX_ROWS * fheight; |
576 | max_height = MAX_ROWS * fheight; |
598 | |
577 | |
599 | szHint.base_width = szHint.base_height = 2 * int_bwidth; |
578 | szHint.base_width = szHint.base_height = 2 * int_bwidth; |
600 | |
579 | |
601 | sb_w = 0; |
|
|
602 | window_vt_x = window_vt_y = int_bwidth; |
580 | window_vt_x = window_vt_y = int_bwidth; |
603 | |
581 | |
604 | if (scrollBar.state) |
582 | if (scrollBar.state) |
605 | { |
583 | { |
606 | sb_w = scrollbar_TotalWidth (); |
584 | int sb_w = scrollBar.total_width (); |
607 | szHint.base_width += sb_w; |
585 | szHint.base_width += sb_w; |
608 | |
586 | |
609 | if (!option (Opt_scrollBar_right)) |
587 | if (!option (Opt_scrollBar_right)) |
610 | window_vt_x += sb_w; |
588 | window_vt_x += sb_w; |
611 | } |
589 | } |
… | |
… | |
634 | else |
612 | else |
635 | { |
613 | { |
636 | min_it (height, max_height); |
614 | min_it (height, max_height); |
637 | szHint.height = szHint.base_height + height; |
615 | szHint.height = szHint.base_height + height; |
638 | } |
616 | } |
639 | |
|
|
640 | if (scrollBar.state && option (Opt_scrollBar_right)) |
|
|
641 | window_sb_x = szHint.width - sb_w; |
|
|
642 | |
617 | |
643 | if (recalc_x) |
618 | if (recalc_x) |
644 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
619 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
645 | |
620 | |
646 | if (recalc_y) |
621 | if (recalc_y) |
… | |
… | |
805 | void |
780 | void |
806 | rxvt_term::set_window_color (int idx, const char *color) |
781 | rxvt_term::set_window_color (int idx, const char *color) |
807 | { |
782 | { |
808 | #ifdef XTERM_COLOR_CHANGE |
783 | #ifdef XTERM_COLOR_CHANGE |
809 | rxvt_color xcol; |
784 | rxvt_color xcol; |
810 | int i; |
|
|
811 | |
785 | |
812 | if (color == NULL || *color == '\0') |
786 | if (color == NULL || *color == '\0') |
813 | return; |
787 | return; |
814 | |
788 | |
815 | color = strdup (color); |
789 | color = strdup (color); |
… | |
… | |
817 | rs[Rs_color + idx] = color; |
791 | rs[Rs_color + idx] = color; |
818 | |
792 | |
819 | /* handle color aliases */ |
793 | /* handle color aliases */ |
820 | if (isdigit (*color)) |
794 | if (isdigit (*color)) |
821 | { |
795 | { |
822 | i = atoi (color); |
796 | int i = atoi (color); |
823 | |
797 | |
824 | if (i >= 8 && i <= 15) |
798 | if (i >= 8 && i <= 15) |
825 | { |
799 | { |
826 | /* bright colors */ |
800 | /* bright colors */ |
827 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; |
801 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; |
… | |
… | |
987 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
961 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
988 | |
962 | |
989 | if (fix_screen || newwidth != old_width || newheight != old_height) |
963 | if (fix_screen || newwidth != old_width || newheight != old_height) |
990 | { |
964 | { |
991 | if (scrollBar.state) |
965 | if (scrollBar.state) |
992 | { |
966 | scrollBar.resize (); |
993 | XMoveResizeWindow (dpy, scrollBar.win, |
|
|
994 | window_sb_x, 0, |
|
|
995 | scrollbar_TotalWidth (), szHint.height); |
|
|
996 | resize_scrollbar (); |
|
|
997 | } |
|
|
998 | |
967 | |
999 | XMoveResizeWindow (dpy, vt, |
968 | XMoveResizeWindow (dpy, vt, |
1000 | window_vt_x, window_vt_y, |
969 | window_vt_x, window_vt_y, |
1001 | width, height); |
970 | width, height); |
1002 | |
971 | |