… | |
… | |
227 | delete fontset[0]; |
227 | delete fontset[0]; |
228 | |
228 | |
229 | #ifdef HAVE_BG_PIXMAP |
229 | #ifdef HAVE_BG_PIXMAP |
230 | bgPixmap.destroy (); |
230 | bgPixmap.destroy (); |
231 | #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 |
232 | |
238 | |
233 | if (display) |
239 | if (display) |
234 | { |
240 | { |
235 | selection_clear (); |
241 | selection_clear (); |
|
|
242 | selection_clear (true); |
236 | |
243 | |
237 | #ifdef USE_XIM |
244 | #ifdef USE_XIM |
238 | im_destroy (); |
245 | im_destroy (); |
239 | #endif |
246 | #endif |
240 | scrollBar.destroy (); |
247 | scrollBar.destroy (); |
… | |
… | |
265 | /* clear all resources */ |
272 | /* clear all resources */ |
266 | for (int i = 0; i < allocated.size (); i++) |
273 | for (int i = 0; i < allocated.size (); i++) |
267 | free (allocated [i]); |
274 | free (allocated [i]); |
268 | |
275 | |
269 | free (selection.text); |
276 | free (selection.text); |
|
|
277 | free (selection.clip_text); |
270 | // TODO: manage env vars in child only(!) |
278 | // TODO: manage env vars in child only(!) |
271 | free (env_display); |
279 | free (env_display); |
272 | free (env_term); |
280 | free (env_term); |
273 | free (locale); |
281 | free (locale); |
274 | free (v_buffer); |
282 | free (v_buffer); |
… | |
… | |
522 | if (rs[Rs_geometry]) |
530 | if (rs[Rs_geometry]) |
523 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
531 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
524 | |
532 | |
525 | if (flags & WidthValue) |
533 | if (flags & WidthValue) |
526 | { |
534 | { |
|
|
535 | if (!w) |
|
|
536 | rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n"); |
|
|
537 | |
527 | ncol = clamp (w, 0, std::numeric_limits<int16_t>::max ()); |
538 | ncol = clamp (w, 1, std::numeric_limits<int16_t>::max ()); |
528 | szHint.flags |= USSize; |
539 | szHint.flags |= USSize; |
529 | } |
540 | } |
530 | |
541 | |
531 | if (flags & HeightValue) |
542 | if (flags & HeightValue) |
532 | { |
543 | { |
|
|
544 | if (!h) |
|
|
545 | rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n"); |
|
|
546 | |
533 | nrow = clamp (h, 0, std::numeric_limits<int16_t>::max ()); |
547 | nrow = clamp (h, 1, std::numeric_limits<int16_t>::max ()); |
534 | szHint.flags |= USSize; |
548 | szHint.flags |= USSize; |
535 | } |
549 | } |
536 | |
550 | |
537 | if (flags & XValue) |
551 | if (flags & XValue) |
538 | { |
552 | { |
… | |
… | |
613 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
627 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
614 | |
628 | |
615 | if (recalc_y) |
629 | if (recalc_y) |
616 | szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; |
630 | szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; |
617 | |
631 | |
618 | ncol = width / fwidth; |
632 | ncol = width / fwidth; |
619 | nrow = height / fheight; |
633 | nrow = height / fheight; |
620 | } |
634 | } |
621 | |
635 | |
622 | /*----------------------------------------------------------------------*/ |
636 | /*----------------------------------------------------------------------*/ |
623 | /* |
637 | /* |
… | |
… | |
634 | |
648 | |
635 | ws.ws_col = ncol; |
649 | ws.ws_col = ncol; |
636 | ws.ws_row = nrow; |
650 | ws.ws_row = nrow; |
637 | ws.ws_xpixel = width; |
651 | ws.ws_xpixel = width; |
638 | ws.ws_ypixel = height; |
652 | ws.ws_ypixel = height; |
639 | (void)ioctl (pty->pty, TIOCSWINSZ, &ws); |
653 | ioctl (pty->pty, TIOCSWINSZ, &ws); |
640 | |
654 | |
641 | #if 0 |
655 | #if 0 |
642 | // TIOCSWINSZ is supposed to do this automatically and correctly |
656 | // TIOCSWINSZ is supposed to do this automatically and correctly |
643 | if (cmd_pid) /* force through to the command */ |
657 | if (cmd_pid) /* force through to the command */ |
644 | kill (-cmd_pid, SIGWINCH); |
658 | kill (-cmd_pid, SIGWINCH); |
… | |
… | |
676 | delete fontset[0]; |
690 | delete fontset[0]; |
677 | fontset[0] = fs; |
691 | fontset[0] = fs; |
678 | |
692 | |
679 | prop = (*fs)[1]->properties (); |
693 | prop = (*fs)[1]->properties (); |
680 | prop.height += lineSpace; |
694 | prop.height += lineSpace; |
|
|
695 | prop.width += letterSpace; |
681 | |
696 | |
682 | fs->set_prop (prop, false); |
697 | fs->set_prop (prop, false); |
683 | |
698 | |
684 | fwidth = prop.width; |
699 | fwidth = prop.width; |
685 | fheight = prop.height; |
700 | fheight = prop.height; |
… | |
… | |
899 | int old_width = szHint.width; |
914 | int old_width = szHint.width; |
900 | int old_height = szHint.height; |
915 | int old_height = szHint.height; |
901 | |
916 | |
902 | window_calc (newwidth, newheight); |
917 | window_calc (newwidth, newheight); |
903 | |
918 | |
904 | if (!HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END))) |
919 | bool set_hint = !HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END)); |
|
|
920 | |
|
|
921 | // to avoid races between us and the wm, we clear the incremental size hints around the xresizewindow |
|
|
922 | if (set_hint) |
|
|
923 | { |
|
|
924 | szHint.flags &= ~(PBaseSize | PResizeInc); |
905 | XSetWMNormalHints (dpy, parent[0], &szHint); |
925 | XSetWMNormalHints (dpy, parent[0], &szHint); |
|
|
926 | szHint.flags |= PBaseSize | PResizeInc; |
|
|
927 | } |
906 | |
928 | |
907 | if (!ignoreparent) |
929 | if (!ignoreparent) |
908 | { |
930 | { |
909 | #ifdef SMART_RESIZE |
931 | #ifdef SMART_RESIZE |
910 | /* |
932 | /* |
… | |
… | |
950 | #else |
972 | #else |
951 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
973 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
952 | #endif |
974 | #endif |
953 | } |
975 | } |
954 | |
976 | |
|
|
977 | if (set_hint) |
|
|
978 | XSetWMNormalHints (dpy, parent[0], &szHint); |
|
|
979 | |
955 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
980 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
956 | |
981 | |
957 | if (fix_screen || newwidth != old_width || newheight != old_height) |
982 | if (fix_screen || newwidth != old_width || newheight != old_height) |
958 | { |
983 | { |
959 | if (scrollBar.state) |
984 | if (scrollBar.state) |
… | |
… | |
965 | |
990 | |
966 | #ifdef HAVE_BG_PIXMAP |
991 | #ifdef HAVE_BG_PIXMAP |
967 | if (bgPixmap.window_size_sensitive ()) |
992 | if (bgPixmap.window_size_sensitive ()) |
968 | update_background (); |
993 | update_background (); |
969 | #endif |
994 | #endif |
970 | |
|
|
971 | scr_clear (); |
|
|
972 | } |
995 | } |
973 | |
996 | |
974 | if (fix_screen || old_height == 0) |
997 | if (fix_screen || old_height == 0) |
975 | scr_reset (); |
998 | scr_reset (); |
976 | |
999 | |
… | |
… | |
1055 | |
1078 | |
1056 | /* Checking whether input method is running. */ |
1079 | /* Checking whether input method is running. */ |
1057 | bool |
1080 | bool |
1058 | rxvt_term::IMisRunning () |
1081 | rxvt_term::IMisRunning () |
1059 | { |
1082 | { |
1060 | char *p; |
|
|
1061 | Atom atom; |
1083 | Atom atom; |
1062 | Window win; |
1084 | Window win; |
1063 | char server[IMBUFSIZ]; |
1085 | char server[IMBUFSIZ]; |
1064 | |
1086 | |
1065 | /* get current locale modifier */ |
1087 | /* get current locale modifier */ |
1066 | if ((p = XSetLocaleModifiers (NULL)) != NULL) |
1088 | if (char *p = XSetLocaleModifiers (0)) |
1067 | { |
1089 | { |
1068 | strcpy (server, "@server="); |
1090 | strcpy (server, "@server="); |
1069 | strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1091 | strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */ |
1070 | |
1092 | |
1071 | if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ |
1093 | if (p = strchr (server + 1, '@')) /* first one only */ |
1072 | *p = '\0'; |
1094 | *p = '\0'; |
1073 | |
1095 | |
1074 | atom = XInternAtom (dpy, server, False); |
1096 | atom = XInternAtom (dpy, server, False); |
1075 | win = XGetSelectionOwner (dpy, atom); |
1097 | win = XGetSelectionOwner (dpy, atom); |
1076 | |
1098 | |